Subject: bug#33870: 27.0.50; xref-goto-xref not configurable

From: João Távora <[email-masked]>
Date: Thu, 27 Dec 2018 21:49:28 +0000

Juri Linkov <[email-masked]> writes:

>>     Here are two very simple Emacs -Q recipes that demonstrate [the bug]
>
> Thanks for the recipes.
>
>>        emacs -Q
>>        C-x 3 [split-window-right]
>>        C-x 2 [split-window-below]
>>        M-. xref-backend-definitions RET [xref-find-definitions]
>>        C-n [next-line]
>>        RET [xref-goto-xref]
>>      
>>     Expected the definition to be found in the original window where I
>>     pressed M-. but instead it was found in another. Another case:
>
> It could help to try using 'get-mru-window'.  Please ask Martin
> if there is a display action that uses 'get-mru-window', or how
> to temporarily change the default behavior from 'get-lru-window'
> to 'get-mru-window'.

There may be a misunderstanding here.  Those recipes are for a bug that
has already been fixed: this code is now working like it should.

Are you saying that you could make the code use other functions to
produce the same behaviour, i.e. refactor it?  That's fine by me: feel
free to try, but I don't see a lot of motivation for it.

>
>>        emacs -Q
>>        C-x 4 . xref-backend-definitions RET [xref-find-definitions-other-window]
>>        C-n
>>        RET
>>      
>>     Expected the definition to be found in some other window, different
>>     from the one I pressed M-. on. Instead went to the same one. Also,
>>     in both situations, expected the window configuration to be the same
>>     as if I had searched for, say, xref-backend-functions [which only
>>     has a single definition].
>
> This can be configured with the display buffer alist
> `(inhibit-same-window . t)'.

Same here.  I'm not an expert in the `display-buffer-alist' DSL, but I
think you are again papering over the fact that between
xref-find-definitions-other-window and the final destination buffer
there is sometimes an *xref* buffer in its own window.  So I don't think
'inhibit-same-window' wouldn't help here.  But again, feel free to
rework the code to your standards and if it passes these two tests, it's
a good start.

João