emacs-diffs
[Top][All Lists]
Advanced

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

emacs-27 19534f9 1/2: Make sure default-directory relates to the origina


From: Dmitry Gutov
Subject: emacs-27 19534f9 1/2: Make sure default-directory relates to the originating buffer
Date: Thu, 4 Feb 2021 15:06:32 -0500 (EST)

branch: emacs-27
commit 19534f988c0f29199dfd51d627392bccf7426253
Author: Dmitry Gutov <dgutov@yandex.ru>
Commit: Dmitry Gutov <dgutov@yandex.ru>

    Make sure default-directory relates to the originating buffer
    
    * lisp/progmodes/xref.el (xref--show-xref-buffer):
    Pick up default-directory value from the caller
    (https://lists.gnu.org/archive/html/emacs-devel/2021-01/msg00551.html).
    (xref-show-definitions-buffer-at-bottom): Same.
    
    (cherry picked from commit 6e73e07a6f5cbdd1c5ae6e0f3fbd0f8f56813f1a)
---
 lisp/progmodes/xref.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 4c53c09..309f48a 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -852,8 +852,10 @@ Return an alist of the form ((FILENAME . (XREF ...)) ...)."
           (or
            (assoc-default 'fetched-xrefs alist)
            (funcall fetcher)))
-         (xref-alist (xref--analyze xrefs)))
+         (xref-alist (xref--analyze xrefs))
+         (dd default-directory))
     (with-current-buffer (get-buffer-create xref-buffer-name)
+      (setq default-directory dd)
       (xref--xref-buffer-mode)
       (xref--show-common-initialize xref-alist fetcher alist)
       (pop-to-buffer (current-buffer))
@@ -903,13 +905,15 @@ Return an alist of the form ((FILENAME . (XREF ...)) 
...)."
 When there is more than one definition, split the selected window
 and show the list in a small window at the bottom.  And use a
 local keymap that binds `RET' to `xref-quit-and-goto-xref'."
-  (let ((xrefs (funcall fetcher)))
+  (let ((xrefs (funcall fetcher))
+        (dd default-directory))
     (cond
      ((not (cdr xrefs))
       (xref-pop-to-location (car xrefs)
                             (assoc-default 'display-action alist)))
      (t
       (with-current-buffer (get-buffer-create xref-buffer-name)
+        (setq default-directory dd)
         (xref--transient-buffer-mode)
         (xref--show-common-initialize (xref--analyze xrefs) fetcher alist)
         (pop-to-buffer (current-buffer)



reply via email to

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