unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Dmitry Gutov <dgutov@yandex.ru>
To: Stephen Leake <stephen_leake@stephe-leake.org>,
	emacs-devel <emacs-devel@gnu.org>
Subject: Re: xref call project-current in correct buffer
Date: Tue, 15 Nov 2022 23:55:34 +0200	[thread overview]
Message-ID: <a99f900a-75b0-2dc4-8e30-feb6d4f9afe1@yandex.ru> (raw)
In-Reply-To: <e4b37681-6fdf-64d7-e9ef-2e300c88a158@yandex.ru>

On 15.11.2022 23:48, Dmitry Gutov wrote:
> On 15.11.2022 23:37, Stephen Leake wrote:
>> +      ;; xref--analyze uses (project-current), so it must be done in
>> +      ;; the original buffer.
>> +      (setq xrefs (xref--analyze xrefs))
> 
> LGTM, thanks!
> 
> Maybe change the comment from "uses" to "can use" (or "might"), because 
> that only happens with the currently default value of 
> xref-file-name-display. Or not. That's a very minor detail.

Actually, how about this one?

The difference is slight, but we don't reuse a variable for a value with 
different structure, and it mirrors the same variable in related/similar 
functions in this package.

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 0213ab3cc5..3e04291bc3 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1230,16 +1230,20 @@ xref-show-definitions-buffer-at-bottom
           (max-height (/ (window-height) 2))
           (size-fun (lambda (window)
                       (fit-window-to-buffer window max-height)))
+         xref-alist
           buf)
      (cond
       ((not (cdr xrefs))
        (xref-pop-to-location (car xrefs)
                              (assoc-default 'display-action alist)))
       (t
+      ;; Call it here because it can call (project-current), and that
+      ;; might depend on individual buffer, not just directory.
+      (setq xref-alist (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 xref-alist fetcher alist)
          (pop-to-buffer (current-buffer)
                         `(display-buffer-in-direction . ((direction . 
below)
                                                          (window-height 
. ,size-fun))))




      reply	other threads:[~2022-11-15 21:55 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
2022-11-15 21:48   ` Dmitry Gutov
2022-11-15 21:55     ` Dmitry Gutov [this message]

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=a99f900a-75b0-2dc4-8e30-feb6d4f9afe1@yandex.ru \
    --to=dgutov@yandex.ru \
    --cc=emacs-devel@gnu.org \
    --cc=stephen_leake@stephe-leake.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).