branch: master
commit 01d30bf5294c55f04a9140222df7ae2be7c53510
Merge: 357c54d 4f57d25
Author: R. Bernstein <[email protected]>
Commit: GitHub <[email protected]>
Merge pull request #163 from FelipeLema/master
Customizable "search for this (relative) bp file"
---
realgud/common/file.el | 45 ++++++++++++++++++++++++---------------------
1 file changed, 24 insertions(+), 21 deletions(-)
diff --git a/realgud/common/file.el b/realgud/common/file.el
index cd27057..3ca1b30 100644
--- a/realgud/common/file.el
+++ b/realgud/common/file.el
@@ -23,11 +23,15 @@
value is associated filesystem string presumably in the
filesystem")
+
(declare-function realgud:strip 'realgud)
(declare-function realgud-loc-goto 'realgud-loc)
(declare-function buffer-killed? 'helper)
(declare-function compilation-find-file 'compile)
+(defcustom realgud-file-find-function 'compilation-find-file
+ "Function to call when we can't easily find file")
+
(defun realgud:file-line-count(filename)
"Return the number of lines in file FILENAME, or nil FILENAME can't be
found"
@@ -76,30 +80,29 @@ problem as best as we can determine."
(unless (and filename (file-readable-p filename))
(if find-file-fn
- (setq filename (funcall find-file-fn filename))
+ (setq filename (funcall find-file-fn filename))
;; FIXME: Remove the below by refactoring to use the above find-file-fn
;; else
(if (and ignore-file-re (string-match ignore-file-re filename))
- (message "tracking ignored for psuedo-file %s" filename)
- ;; else
- (let ((remapped-filename))
- (if (gethash filename realgud-file-remap)
- (progn
- (setq remapped-filename (gethash filename realgud-file-remap))
- (if (file-exists-p remapped-filename)
- (setq filename remapped-filename)
- (remhash filename realgud-file-remap)))
- ;; else
- (progn
- (setq remapped-filename
- (buffer-file-name
- (compilation-find-file (point-marker) filename directory)))
- (when (and remapped-filename (file-exists-p remapped-filename))
- (puthash filename remapped-filename realgud-file-remap)
- (setq filename remapped-filename)
- )
- )))
- )
+ (message "tracking ignored for pseudo-file %s" filename)
+ ;; else
+ (let ((remapped-filename))
+ (if (gethash filename realgud-file-remap)
+ (progn
+ (setq remapped-filename (gethash filename realgud-file-remap))
+ (if (file-exists-p remapped-filename)
+ (setq filename remapped-filename)
+ (remhash filename realgud-file-remap)))
+ ;; else
+ (let ((found-file (funcall realgud-file-find-function
(point-marker) filename directory)))
+ (when found-file
+ (setq remapped-filename (buffer-file-name found-file))
+ (when (and remapped-filename (file-exists-p
remapped-filename))
+ (puthash filename remapped-filename realgud-file-remap)
+ (setq filename remapped-filename)
+ ))
+ )))
+ )
;; FIXME: remove above -----------------------------------.
))
(if filename