emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] master 2def5fc 20/56: Customizable "search for this (relative) bp


From: Rocky Bernstein
Subject: [elpa] master 2def5fc 20/56: Customizable "search for this (relative) bp file"
Date: Sat, 27 May 2017 05:02:31 -0400 (EDT)

branch: master
commit 2def5fc61562af6a1ff9a4172b2d7160b53bd322
Author: Felipe Lema <address@hidden>
Commit: Felipe Lema <address@hidden>

    Customizable "search for this (relative) bp file"
    
    I personally don't like `compilation-find-file` prompting me at
    the start of every gdb session when it can't find a relative
    breakpoint in a large code base at a separate folder.
---
 realgud/common/file.el | 48 +++++++++++++++++++++++++++---------------------
 1 file changed, 27 insertions(+), 21 deletions(-)

diff --git a/realgud/common/file.el b/realgud/common/file.el
index cd27057..82f4017 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,32 @@ 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 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
+              (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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]