all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>
Cc: tgbugs@gmail.com, emacs-devel@gnu.org, larsi@gnus.org
Subject: Re: [PATCH] Fix display-buffer-use-some-window to honor reusable-frames
Date: Sat, 28 Jan 2023 16:35:52 +0100	[thread overview]
Message-ID: <e4be06c9-98fa-0a60-64de-679c862356f5@gmx.at> (raw)
In-Reply-To: <83sffuap62.fsf@gnu.org>

 >> 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	other threads:[~2023-01-28 15:35 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27  5:17 [PATCH] Fix display-buffer-use-some-window to honor reusable-frames Tom Gillespie
2023-01-27  5:25 ` Tom Gillespie
2023-01-27  6:19   ` Tom Gillespie
2023-01-27 13:03     ` Eli Zaretskii
2023-01-28 10:46       ` martin rudalics
2023-01-28 11:12         ` Eli Zaretskii
2023-01-28 15:35           ` martin rudalics [this message]
2023-01-28 16:02             ` Eli Zaretskii
2023-01-29 17:39               ` martin rudalics
2023-01-29 18:41                 ` Eli Zaretskii
2023-01-29 18:50                   ` Tom Gillespie
2023-01-30 16:43                   ` martin rudalics
2023-01-30 17:38                     ` Eli Zaretskii
2023-01-30 17:57                       ` martin rudalics
2023-01-30 18:04                         ` Eli Zaretskii
2023-01-31  8:45                           ` martin rudalics
2023-01-31 14:01                             ` Eli Zaretskii
2023-02-01 10:45                               ` martin rudalics
2023-02-01 17:38                                 ` Eli Zaretskii
2023-02-01 18:33                                   ` martin rudalics
2023-01-28 19:04         ` Tom Gillespie
2023-01-28 20:01           ` Tom Gillespie
2023-01-29 17:39             ` martin rudalics
2023-01-29 19:02               ` Tom Gillespie
2023-01-30 16:44                 ` martin rudalics
2023-01-30 17:43                   ` Tom Gillespie
2023-01-30 17:58                     ` martin rudalics
2023-01-30 19:40                       ` Tom Gillespie
2023-01-30 22:45                         ` Tom Gillespie
2023-01-31  8:46                           ` martin rudalics
2023-01-31 18:38                             ` Tom Gillespie
2023-02-01  9:08                               ` martin rudalics
2023-02-01 17:19                                 ` Tom Gillespie
2023-02-01 18:32                                   ` martin rudalics
2023-02-02 16:39                                     ` martin rudalics
2023-02-02 19:57                                       ` Tom Gillespie
2023-02-03  9:09                                         ` martin rudalics
2023-02-11 15:44                                           ` Eli Zaretskii
2023-02-11 18:15                                           ` Tom Gillespie
2023-02-12  9:33                                             ` martin rudalics
2023-02-18 17:46                                               ` Eli Zaretskii
2023-02-20  9:03                                                 ` martin rudalics
2023-02-20 11:55                                                   ` Eli Zaretskii
2023-02-20 18:14                                                     ` martin rudalics
2023-02-21 12:02                                                       ` Eli Zaretskii
2023-01-31  8:46                         ` martin rudalics
2023-01-29 17:48         ` Juri Linkov
2023-01-29 18:48           ` Eli Zaretskii
2023-02-06 10:01         ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e4be06c9-98fa-0a60-64de-679c862356f5@gmx.at \
    --to=rudalics@gmx.at \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    --cc=tgbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.