xref mode question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

xref mode question

David Spain
I'm using Emacs 25.2.2 and am trying to figure out a way in which from
the XREF window of an Emacs tags table search to get it to visit an
entry listed in that same window and not overwrite the original source
window I had open which I'm visiting the tag from. In other words, I'd
like the XREF window to go away and be replaced with the source from the
followed xref.

I miss the older functionality of the default binding of 'C-x 4 .' or as
it was known in Emacs 23 and previous versions (find-tag-other-window).

I DO like the newer xref mechanism as it shows all found references, I
just want to be able to visit a specific xref without losing my original
source window in the process.

I thought maybe the <TAB> key would do this in the XREF buffer, the
documentation would lead me to believe that, BUT the <TAB> key doesn't
do anything but attempt to insert a tab into the XREF buffer. I do have
a customization set on the <TAB> key for c-mode for the way I prefer it
to work. Could that be causing trouble? I tend to doubt that.

Any suggestions appreciated.

Thanks,
David Spain

Reply | Threaded
Open this post in threaded view
|

RE: xref mode question

Drew Adams
> I miss the older functionality of the default binding of 'C-x 4 .' or
> as it was known in Emacs 23 and previous versions (find-tag-other-window).

It's still available, BTW.  You can bind it to whatever
key you like (including `C-x 4 .').

Reply | Threaded
Open this post in threaded view
|

Re: xref mode question

Eli Zaretskii
In reply to this post by David Spain
> From: David Spain <[hidden email]>
> Date: Fri, 15 Nov 2019 16:23:57 -0500
>
> I'm using Emacs 25.2.2 and am trying to figure out a way in which from
> the XREF window of an Emacs tags table search to get it to visit an
> entry listed in that same window and not overwrite the original source
> window I had open which I'm visiting the tag from. In other words, I'd
> like the XREF window to go away and be replaced with the source from the
> followed xref.
>
> I miss the older functionality of the default binding of 'C-x 4 .' or as
> it was known in Emacs 23 and previous versions (find-tag-other-window).

There isn't any single command to do that, because making the XREF
window "go away" makes it hard to get that window back, if you want to
examine the other candidates.  However, you can close the XREF window
with the 'q' command, when you don't need it anymore.

The XREF facility doesn't usually show the XREF window, because it in
most cases finds just one candidate and shows it immediately, and in
those cases "C-x 4 ." works just like it did with etags.

We tried to implement something like what you want, but every attempt
caused some unpleasant side effects.

The problem is not bad, however, at least IMO, because you can easily
go back to your original source buffer with "M-,".

> I DO like the newer xref mechanism as it shows all found references, I
> just want to be able to visit a specific xref without losing my original
> source window in the process.

The C-o command tries to do that, but only if there's another window
showing the file where the tag lives.

> I thought maybe the <TAB> key would do this in the XREF buffer, the
> documentation would lead me to believe that, BUT the <TAB> key doesn't
> do anything but attempt to insert a tab into the XREF buffer.

??? Does that happen in "emacs -Q"?  It doesn't for me.

However, TAB just buries the XREF buffer, it doesn't necessarily leave
your previous buffer displayed in some other window.

> I do have a customization set on the <TAB> key for c-mode for the
> way I prefer it to work. Could that be causing trouble? I tend to
> doubt that.

Could be, trying in "emacs -Q" will tell.

Reply | Threaded
Open this post in threaded view
|

Re: xref mode question

Dmitry Gutov
On 16.11.2019 10:00, Eli Zaretskii wrote:
>> I thought maybe the <TAB> key would do this in the XREF buffer, the
>> documentation would lead me to believe that, BUT the <TAB> key doesn't
>> do anything but attempt to insert a tab into the XREF buffer.
> ??? Does that happen in "emacs -Q"?  It doesn't for me.
>
> However, TAB just buries the XREF buffer, it doesn't necessarily leave
> your previous buffer displayed in some other window.
>

I think David is maybe reading documentation on the web (which is for
the latest release), but trying this scenario in an older version (25.2.2).