GNU bug report logs - #74246
[PATCH] Reuse display windows in image-dired

Previous Next

Package: emacs;

Reported by: Morgan Smith <Morgan.J.Smith <at> outlook.com>

Date: Thu, 7 Nov 2024 20:25:01 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Juri Linkov <juri <at> linkov.net>
To: martin rudalics <rudalics <at> gmx.at>
Cc: Morgan Smith <Morgan.J.Smith <at> outlook.com>, Eli Zaretskii <eliz <at> gnu.org>, 74246 <at> debbugs.gnu.org, stefankangas <at> gmail.com
Subject: bug#74246: [PATCH] Reuse display windows in image-dired
Date: Mon, 09 Dec 2024 21:16:39 +0200
>> I meant that only the same command (and therefore the same
>> display-buffer call) should reuse the same window.
>> This is why I checked for 'this-command' in the posted snippet.
>> But instead of associating with a command name an alternative approach
>> would be to use a category.
>
> One and the same command may issue an arbitrary number of
> 'display-buffer' calls.  Checking for 'this-command' may work for you in
> a specific context but is certainly not a safe approach for general use.

What would be the safest approach to detect the same 'display-buffer' call?
A category?

>> The *backtrace* buffer is not a problem because it uses own
>> display-buffer alist that overrides display-buffer-use-some-window.
>
> Unless a user has customized it or 'display-buffer-below-selected' fails
> for some reason.

Then displaying it by some-window in the same window instead of lru
looks as a nice thing to do.

>> display-buffer-use-some-window could recheck if the window is still suitable
>> for every use of the same command and display-buffer call.
>
> As I said above this is not reliable.  The only reliable thing is to
> pass the symbol of the function calling 'display-buffer' with some
> unique number identifying the nth call of 'display-buffer' within that
> function.  Everything else is guesswork.

There is already such a symbol: 'category'.

>>>> It's fine to set a buffer-local variable in the buffer where the user
>>>> types a key that displays the target buffer from another source buffer.
>>>> As long as the same buffer is used to get the value of this variable.
>>>
>>> I have no idea of a secure way to retrieve that buffer.
>>
>> It's always the current buffer, even if another buffer is used
>> as the source buffer.
>
> But the current buffer may vary continuously, it might even be the
> minibuffer if I issue the call from there.
>
>> What if the user wants to display an image buffer in another window?
>> Then 'display-buffer-reuse-window' can't be used.
>
> If a user issues the command to display an image in a window that
> already shows an image and insists on using another window, an arbitrary
> other window can be chosen.  Users who want that just get the usual
> chaotic behavior lru provides.  They asked for it.

The users might want to switch displaying to another window,
and continue displaying other images in the same other window.

>> A buffer-local variable should be set in the source buffer only,
>> not in the image buffer.
>
> With 'image-dired' it can be set in the image buffer because that buffer
> is always the same.

This is an exception, not a general rule such as for navigating
grep/xref results.  I see no reason for image-dired be different
from grep/xref.




This bug report was last modified 182 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.