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 #89 received at 74246 <at> debbugs.gnu.org (full text, mbox):

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: Re: bug#74246: [PATCH] Reuse display windows in image-dired
Date: Thu, 12 Dec 2024 18:40:16 +0200
>> 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.

Please not a global variable.  I often use many pairs of
source/target windows at the same time for different grep/xref results.

>>    (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.

Still too limited solution when the users can't store the last window
for other commands.  Better would be to add a new alist entry that
will force 'display-buffer' to remember the last window from any call:

  (display-buffer buffer `((nil (category . compilation)
                                (remember-last-window . t))))

or by user customization of display-buffer-alist:

  ((category . compilation)
   (nil (remember-last-window . t)))

And a function that stores/restores the last window could be customizable as well.
So the users could decide whether to save it in a buffer-local variable,
or in the window parameter.  This option could be like 'xref-history-storage'
that provides the choice of 'xref-global-history' or 'xref-window-local-history':

  ((category . compilation)
   (nil (remember-last-window . global)))

or

  ((category . compilation)
   (nil (remember-last-window . window-local)))

or

  ((category . compilation)
   (nil (remember-last-window . buffer-local)))




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.