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

From: Juri Linkov <[email-masked]>
Date: Tue, 03 Dec 2024 19:24:14 +0200

>> It kills the target buffer, not the source buffer?
>> The idea was to set a buffer-local variable in the source buffer.
>
> But you want to display the target buffer.  How would 'display-buffer'
> find the buffer-local value of the source buffer?

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))))