bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: martin rudalics
Subject: bug#74246: [PATCH] Reuse display windows in image-dired
Date: Thu, 12 Dec 2024 18:24:39 +0100
User-agent: Mozilla Thunderbird

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

I do that too.  Just that my "source window" is a sidebar of the target
window.

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

In that case the 'last-window' parameter maintained by 'display-buffer'
would have to become a list of categories.  Then what about two grep
operations running in parallel as you mention above: Would they share
the same target window?

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

... buffer-local where - in the source or the target buffer?

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

Just think of describing this in the manual.

But I already see: We'll have to maintain a buffer-local variable, say
'xref-last-window' in the source buffer, have xref consult that variable
and pass it as (last-window . ,xref-last-window) to 'display-buffer'.
The value returned by 'display-buffer' would then become the new value
of 'xref-last-window' in the source buffer.  Would that be OK with you?

martin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]