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: martin rudalics
Subject: Re: [PATCH] Fix display-buffer-use-some-window to honor reusable-frames
Date: Sat, 28 Jan 2023 16:35:52 +0100

>> Sorry but I had no idea what 'display-buffer-use-least-recent-window' is
>> and what it is supposed to accomplish.
>
> See bug#45688.  You took part in its discussion.

I remember.  But I never read the code Lars installed including that of
'window-bump-use-time'.  I would not have left alone a doc-string saying

  Display BUFFER in an existing window, but that hasn't been used lately.

for example.

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

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

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

martin



reply via email to

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