[Top][All Lists]

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

Re: xref call project-current in correct buffer

From: Stephen Leake
Subject: Re: xref call project-current in correct buffer
Date: Tue, 15 Nov 2022 13:37:56 -0800
User-agent: Gnus/5.13 (Gnus v5.13)

Actually attach the patch
diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index bb36688ef8..2d73ab82b8 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1243,10 +1243,14 @@ xref-show-definitions-buffer-at-bottom
       (xref-pop-to-location (car xrefs)
                             (assoc-default 'display-action alist)))
+      ;; xref--analyze uses (project-current), so it must be done in
+      ;; the original buffer.
+      (setq xrefs (xref--analyze xrefs))
       (with-current-buffer (get-buffer-create xref-buffer-name)
         (xref--ensure-default-directory dd (current-buffer))
-        (xref--show-common-initialize (xref--analyze xrefs) fetcher alist)
+        (xref--show-common-initialize xrefs fetcher alist)
         (pop-to-buffer (current-buffer)
                        `(display-buffer-in-direction . ((direction . below)
                                                         (window-height . 
Stephen Leake <stephen_leake@stephe-leake.org> writes:

> I ran into a situation where xref failed because
> xref-show-definitions-buffer-at-bottom calls project-current in the
> *xref* buffer, not the original source buffer, and the project in that
> buffer is different from the one in the *xref* buffer.
> The attached patch fixes it, but there are other possible ways to do it;
> pass the project to xref--analyze, or set a local variable containing
> the project.
> In addition, refresh-buffer in the *xref* buffer will have the same
> problem, so setting the original project in a local variable might be
> the best way.

-- Stephe

reply via email to

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