Subject: Re: bug#74246: [PATCH] Reuse display windows in image-dired

From: Juri Linkov <[email-masked]>
Date: Wed, 04 Dec 2024 19:18:27 +0200

>> Here is how I do this in the snippet I posted 3 days ago:
>>
>> (setq display-buffer-base-action
>>        '(nil . ((some-window
>>                  . (lambda (_buffer alist)
>>                      (let ((last-window (buffer-local-value
>>                                          'display-buffer-last-window
>>                                          (window-buffer))))
>
> This would imply that
>
> - the window showing the buffer from where to read the value of
>   'display-buffer-last-window' must be selected at the time
>   'display-buffer' is called,
>
> - as a rule, 'display-buffer' cannot set the buffer-local value of
>   'display-buffer-last-window' in the window it uses for showing the
>   buffer.
>
> Both implications seem harmful to me.

In all customizations I relied on the assumption that the source buffer
was current and its window was selected.  And indeed I see the uses
of '(eq window (selected-window))' in display-buffer functions.