bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#53626: 28.0.91; project-find-regexp (C-x p g) twice results in searc


From: Dmitry Gutov
Subject: bug#53626: 28.0.91; project-find-regexp (C-x p g) twice results in searching different projects
Date: Fri, 4 Feb 2022 04:32:44 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0

On 30.01.2022 08:28, Sean Whitton wrote:
These bindings hide the
buffer-local value for default-directory in*xref*, such that
xref--show-xref-buffer is only able to set the binding's value, not the
real buffer-local value, and so when the let forms unwind*xref*'s old
default-directory is restored.

I have to say I'm surprised by this mechanic: not even setq-local helps.

Guess we could kill the xref buffer every time, instead of erasing and re-filling it, though. Like

diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el
index 4efa652084..bb08db726b 100644
--- a/lisp/progmodes/xref.el
+++ b/lisp/progmodes/xref.el
@@ -1111,6 +1111,7 @@ xref--show-xref-buffer
          (xref-alist (xref--analyze xrefs))
          (dd default-directory)
          buf)
+    (ignore-errors (kill-buffer xref-buffer-name))
     (with-current-buffer (get-buffer-create xref-buffer-name)
       (setq default-directory dd)
       (xref--xref-buffer-mode)

It has the unfortunate side-effect of having that buffer displayed in a different window, though. Or at least the possibility (though it happens every time here).

Maybe some kill-but-recreate-and-show-in-the-same-window-first kind of hack would do the trick.





reply via email to

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