GNU bug report logs - #53626
28.0.91; project-find-regexp (C-x p g) twice results in searching different projects

Previous Next

Package: emacs;

Reported by: sbaugh <at> catern.com

Date: Sat, 29 Jan 2022 19:12:01 UTC

Severity: normal

Found in version 28.0.91

Done: Dmitry Gutov <dgutov <at> yandex.ru>

Bug is archived. No further changes may be made.

Full log


Message #35 received at 53626 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Sean Whitton <spwhitton <at> spwhitton.name>, sbaugh <at> catern.com,
 53626 <at> debbugs.gnu.org
Subject: Re: 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
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.




This bug report was last modified 3 years and 92 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.