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

From: Sean Whitton <[email-masked]>
Date: Thu, 03 Feb 2022 22:32:18 -0700

Hello,

On Fri 04 Feb 2022 at 04:32am +02, Dmitry Gutov wrote:

> 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.

I guess that's dynamic binding for you :)

> Guess we could kill the xref buffer every time, instead of erasing and
> re-filling it, though.
> [...]
> 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.

Maybe we could rename the old buffer to a temp name, then create and
fill the new one, then set the old buffer's window's buffer to the new
one, and finally kill the old one.  But this is not nice at all.

How necessary is it that project.el set up this binding?  Is there
something else it could do to achieve the same effect?

At worst, it seems better to special-case *xref* over in project.el than
in xref.el, but you have a better overall perspective of the two
libraries than me.

-- 
Sean Whitton