emacs-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] Fix display-buffer-use-some-window to honor reusable-frames


From: Eli Zaretskii
Subject: Re: [PATCH] Fix display-buffer-use-some-window to honor reusable-frames
Date: Sat, 28 Jan 2023 18:02:48 +0200

> Date: Sat, 28 Jan 2023 16:35:52 +0100
> Cc: tgbugs@gmail.com, emacs-devel@gnu.org, larsi@gnus.org
> From: martin rudalics <rudalics@gmx.at>
> 
>  > I'm not sure what are your recommendations regarding the feature
>  > installed as result of that discussion.  Would you mind spelling them
>  > out?
> 
> Most of it has been said back then in this dialogue:

It's a very long discussion.  Just reading all of it takes time, let
alone understanding all that you two have been considering.  I hoped
you could help me do this more efficiently.

>    >> This
>    >>
>    >> +  (when-let ((window (display-buffer-use-some-window
>    >> +                      buffer (cons (cons 'inhibit-same-window t) 
> alist))))
>    >> +    (window-bump-use-time window)))
>    >>
>    >> alone will bump the use time for a _reused_ window only.  A freshly
>    >> popped up window will continue to be the first candidate for reuse and
>    >> only then enter the cycle of windows to reuse.
>    >
>    > How do we bump the use to for a new window, then?
> 
>    By bumping the time stamp of _any_ window 'display-buffer' uses for
>    displaying a buffer (just like XEmacs does).
> 
>    >> XEmacs treats _all_ windows it creates or uses equal in this regard
>    >> including those on other frames.
>    >
>    > Oh, other frames, too...  I think we'll leave that as an exercise for
>    > the reader.
> 
>    Then when you switch from one frame to another, any problems you've
>    found on the previous frame will immediately reemerge on the new frame.
> 
> We need a way to bump the time stamp of _any_ window used.

Sorry, I don't understand what that means in practice.  Specifically,
what do you mean by "any window used"? used by whom and under what
circumstances? or do you mean any window that is currently displayed
on all the frames?

> Otherwise,
> the various action functions will continue to fight each other.  Lars
> wanted to go the way XEmacs did but stopped in the middle.  And XEmacs
> uses
> 
>                (if (window-buffer window)
>                    (save-excursion
>                      (save-selected-window
>                        (select-window window)
>                        (record-buffer (window-buffer window)))))
> 
> to bump the use time of every window used by 'display-buffer'.

You mean, do this every time display-buffer is called and selects some
window?  But that would change our behavior for all the callers of
display-buffer, whose names is a legion.  Whereas the intent was to
provide an optional feature that hopefully doesn't affect any existing
behaviors.

>  > Would it work to just temporarily select the window inside
>  > display-buffer-use-least-recent-window, so that its use time is bumped
>  > without any sneaky primitives?  Then we could remove
>  > window-bump-use-time.
> 
> As Lars conceived it, independent 'display-buffer' calls should be able
> to build on previous ones.  Otherwise, we could write a function like
> 'display-many-buffers-at-once', within that function mark all windows
> used as temporarily dedicated to their buffers, and at the end restore
> the previous dedicated states of these windows.  Obviously, a function
> like 'display-many-buffers-at-once' would not qualify as buffer display
> action function.

What do you mean by "independent calls"?  Or what are "dependent
calls" for this purpose?  Without understanding that, I cannot see how
what you wrote here answers my question, sorry.



reply via email to

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