Subject: Re: bug#74361: [PATCH] New option xref-navigation-display-window-action

From: Juri Linkov <[email-masked]>
Date: Sat, 07 Dec 2024 19:18:34 +0200

>>>>         (with-current-buffer buffer
>>>>           (setq-local display-buffer-previous-window (selected-window)))))
>>>
>>> This relies on 'ofun' selecting a window and would not work for plain
>>> 'display-buffer'.  Right?
>>
>> It should work for plain 'display-buffer' because of using 'with-current-buffer'.
>
> 'display-buffer' per se doesn't care about the current buffer.  The
> assumption that the selected window also holds the current buffer is
> nowhere guaranteed.  Just think of 'display-buffer' running from a
> timer.

I meant the buffer that was current at the beginning of the command:
(window-buffer (old-selected-window)).