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


Message #86 received at 74246 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> linkov.net>
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: Re: bug#74246: [PATCH] Reuse display windows in image-dired
Date: Thu, 12 Dec 2024 10:23:59 +0100
>> By having grep do the following:
>>
>> - Issue a first request to display a buffer from that list,
>>
>> - remember the window used,
>>
>> - set the local variable in the target buffer to the remembered value
>>    before calling 'display-buffer' again.
>
> What if the user switches buffers in that window, but still wants
> to continue visiting next buffers from grep in the same window?

It would have been the buffer-local value in the last target buffer
displayed.  But it's inconvenient and obviously fails if that target
buffer has been deleted in the meantime.  So it's not a good solution
either.  It's only advantage would have been that such a local variable
could have been shared between applications - grep and xref say - to
make sure one and the same buffer would always go to the same window.

> grep/xref should remember that window in a buffer-local variable?

As I'd envision it, xref would use a conceptually global variable called
'xref-target-window' or 'xref-last-window-used' and grep would do
something similar.

>> and propose it via a (some-window . ,window) alist entry in the next
>> call together with 'display-buffer-use-some-window'?
>
> Such providing that window in the display-buffer call would be very nice
> to do, e.g. with a more descriptive name like (previous-window . ,window).
> This will make easier for users to customize by using different actions
> that handle such alist entry: 'display-buffer-in-previous-window' or
> 'display-buffer-use-some-window'.

No objections; just that the semantics of "previous-window" was so far a
"window that was showing that buffer" while here we would mean a "window
that was showing a buffer from the same caller".

> Then a category will be continued to be used only for matching,
> e.g. the call
>
>    (display-buffer buffer `((nil (category . grep) (previous-window . ,window))))
>
> could be customized to match a category and to use the previous window:
>
>    ((category . grep)
>     (display-buffer-in-previous-window))

Wouldn't that be overkill?  The user's customization would have no
effect IIUC.  I'd say

    (display-buffer buffer `((nil (category . grep) (some-window . ,window))))

would be grep's proposal and a user's

    ((category . grep)
     (display-buffer-in-previous-window))

would try to find a window that previously displayed the buffer first.

martin




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.