Subject: Re: bug#44611: Prefix arg for xref-goto-xref

From: Eli Zaretskii <[email-masked]>
Date: Tue, 22 Dec 2020 17:53:37 +0200

> From: Juri Linkov <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Tue, 22 Dec 2020 10:58:35 +0200
> 
> >> And since the new keybinding have no disastrous effect, it would safer
> >> for the users to adapt to the new keybinding.
> >
> > What disastrous effects?  AFAICT, TAB buries the XREF buffer, which is
> > not a disaster.
> 
> It takes the same amount of efforts to bring it back: either by finding
> the buried buffer in the buffer list, or running project-find-regexp again.

That doesn't sound like a disaster.  It just means "C-x b" won't offer
that buffer as the first completion candidate.

> > More generally, I think it's wrong to try to make XREF buffers behave
> > like *Grep* buffers.  They are different beasts, I think we
> > established this long ago, when Xref was added to Emacs (I think I
> > even made a comment regarding the difference, and Dmitry responded to
> > the effect that this was intended).  *XREF* and *Grep* look
> > differently and behave differently, and it's impossible to make them
> > be similar enough.
> 
> They might be different when *xref* is used as a completions buffer
> when the *xref* buffer is created by 'M-.' (xref-find-definitions).
> 
> Moreover, now it's possible to use the real *Completions* buffer by
> customizing xref-show-definitions-function to xref--show-defs-minibuffer.
> Even is this case TAB doesn't close the *Completions* buffer.
> 
> But a completely separate case is when the *xref* buffer is created
> by such grep-like commands as project-find-regexp.

Perhaps those other cases need a special variant of xref-mode, where
TAB could have a binding you'd like to see.

> So currently there are two different uses of the *xref* buffer:
> 
> 1. as a transient completions buffer that could be buried
>    after a completion is selected from the buffer;
> 2. as a grep buffer for visiting the found matches.
> 
> In the second case, it's natural to type TAB to navigate results.

If you mean that the first use is as a kind of "completion" buffer,
then I disagree: at least by default it doesn't look and doesn't
behave like a list of completions.  It's an entirely different beast,
unlike anything else I know of that we have in Emacs core.

> Should these cases use different modes with different buffer names?
> Such as a buffer name *xgrep*?

I think it's a slippery slope to take a minor very specialized mode
and start adding variants to it.  But if you insist on having TAB go
to the next candidate, perhaps we will have no other choice than to
take that path.