From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: xref call project-current in correct buffer
Date: Tue, 15 Nov 2022 13:37:56 -0800 [thread overview]
Message-ID: <86y1sb99vv.fsf@stephe-leake.org> (raw)
In-Reply-To: <8635ak9hny.fsf@stephe-leake.org> (Stephen Leake's message of "Tue, 15 Nov 2022 10:49:53 -0800")
[-- Attachment #1: Type: text/plain, Size: 25 bytes --]
Actually attach the patch
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: xref.diff --]
[-- Type: text/x-patch, Size: 990 bytes --]
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)))
(t
+ ;; 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--transient-buffer-mode)
- (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 . ,size-fun))))
[-- Attachment #3: Type: text/plain, Size: 647 bytes --]
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
next prev parent reply other threads:[~2022-11-15 21:37 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-15 18:49 xref call project-current in correct buffer Stephen Leake
2022-11-15 20:10 ` Eli Zaretskii
2022-11-15 21:37 ` Stephen Leake [this message]
2022-11-15 21:48 ` Dmitry Gutov
2022-11-15 21:55 ` Dmitry Gutov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86y1sb99vv.fsf@stephe-leake.org \
--to=stephen_leake@stephe-leake.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).