From: martin rudalics via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Juri Linkov <juri@linkov.net>
Cc: Dmitry Gutov <dmitry@gutov.dev>, 74361@debbugs.gnu.org
Subject: bug#74361: [PATCH] New option xref-navigation-display-window-action
Date: Tue, 26 Nov 2024 10:15:11 +0100 [thread overview]
Message-ID: <25443bb1-788a-4f06-9350-5d2c666f6795@gmx.at> (raw)
In-Reply-To: <871pyzp6br.fsf@mail.linkov.net>
> Better to use something else. The 'category' alist entry
> is intended to be used only in display-buffer calls like this:
>
> (display-buffer (get-buffer-create "*info*")
> '(nil (category . Info-mode)))
>
> to allow using 'category' in the condition part of display-buffer-alist
> to match the display-buffer call:
>
> (add-to-list 'display-buffer-alist
> '((category . Info-mode)
> (display-buffer-same-window)))
What I meant was to use precisely that as
(add-to-list 'display-buffer-alist
'((category . foo)
(display-buffer-same-window)))
Info-mode OTOH is confusing here: It should IMO be matched by
(buffer-mode (with-current-buffer buffer major-mode))
in 'display-buffer-reuse-mode-window' since Info-mode is the
buffer-local value of 'major-mode' in Info buffers. Setting it up as a
category makes hardly sense to me.
'foo' would be much more generic (you don't say 'comint-mode' either in
your proposed change) and completely detached from the specific buffer
you intend to show (in general you can't guess 'comint' from the major
mode of the buffer to show). Hence a category called 'foo' would in my
concept be matched by 'buffer-match-p' via 'category' passed as car of
CONDITION and a 'category' entry passed via the action alist by the
caller of 'display-buffer'.
> What you proposed is a different usage of 'category'
> that makes sense in the action part of display-buffer-alist:
>
> (add-to-list 'display-buffer-alist
> '("\*Help\*"
> (display-buffer-same-window)
> (category . Info-mode)))
No. A user would have no idea of the name of the buffer.
> It would be cleaner to use a different action for this feature, e.g.:
>
> (add-to-list 'display-buffer-alist
> '("\*Help\*"
> (display-buffer-reuse-category-window)
> (category . Info-mode)))
>
> or without an alist entry:
>
> (add-to-list 'display-buffer-alist
> '("\*Help\*"
> (display-buffer-reuse-category-window)))
> The only problem is that it will change the current default behavior,
> so instead of using the lru window it will prefer to use the window
> with the same category.
Right. It would (1) address the problem raised in bugs like Bug#74246
and would (2) still allow users to handle 'display-comint-buffer-action'
and 'display-tex-shell-buffer-action' in your sense. If and when for
the latter 'display-buffer-use-some-window' is called, the original
suggestion of the caller of 'display-buffer' has been levered out
already.
Obviously, the caller has to be aware of the fact that providing
(category . foo) without an action function will eventually give
'display-buffer-use-some-window' the opportunity to override the lru
with using a window that previously displayed a buffer that was supplied
with the same category argument. Can you think of any harm this could
do? I think the benefit of getting rid of the lru behavior in these
cases by far outweighs any such harms.
> I customized 'display-buffer-base-action'
> to use 'get-mru-window', so I won't be affected by this change,
> but I care about other users. Are you sure it would be expectable
> for users to display buffers with the same category in one window?
> How they could revert this behavior back to the previous default?
By adding a (some-window . nil) or (some-window . lru) entry which would
override the 'category' entry.
> This is why I suggest to create a separate action. If you are sure
> it should be used by default, then it could be inserted
> before display-buffer-use-some-window here:
>
> (defconst display-buffer-fallback-action
> '((display-buffer--maybe-same-window
> display-buffer-reuse-window
> display-buffer--maybe-pop-up-frame-or-window
> display-buffer-in-previous-window
> display-buffer-reuse-category-window ;; <-- NEW!
> display-buffer-use-some-window
> display-buffer-pop-up-frame))
>
> Otherwise, users will be able to use the new action
> display-buffer-reuse-category-window in their customizations
> of display-buffer-alist.
What I want is to get rid of the lru behavior in the context of say
Bug#74246 for users who do _not want_ to tinker with
'display-buffer-alist'. Most Emacs users know how to split windows.
Few of them may want to have ‘display-buffer’ use them up piecemeal by
eventually displaying images in all of them.
martin
next prev parent reply other threads:[~2024-11-26 9:15 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-14 22:29 bug#74361: [PATCH] New option xref-navigation-display-window-action Dmitry Gutov
2024-11-15 0:50 ` Dmitry Gutov
2024-11-15 7:49 ` Juri Linkov
2024-11-15 19:05 ` Dmitry Gutov
2024-11-16 19:12 ` Juri Linkov
2024-11-18 1:28 ` Dmitry Gutov
2024-11-19 18:33 ` Juri Linkov
2024-11-19 19:43 ` Dmitry Gutov
2024-11-20 7:11 ` Juri Linkov
2024-11-20 19:12 ` Dmitry Gutov
2024-11-21 7:34 ` Juri Linkov
2024-11-25 1:58 ` Dmitry Gutov
2024-11-27 1:45 ` Dmitry Gutov
2024-11-20 8:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-20 17:31 ` Juri Linkov
2024-11-20 19:10 ` Dmitry Gutov
2024-11-21 7:29 ` Juri Linkov
2024-11-20 19:08 ` Dmitry Gutov
2024-11-22 9:22 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-23 9:35 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-23 18:45 ` Juri Linkov
2024-11-23 19:16 ` Juri Linkov
2024-11-24 8:59 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-24 17:40 ` Juri Linkov
2024-11-25 9:18 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-25 17:49 ` Juri Linkov
2024-11-26 9:15 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2024-11-27 1:52 ` Dmitry Gutov
2024-11-27 8:58 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-27 13:07 ` Dmitry Gutov
2024-11-27 7:30 ` Juri Linkov
2024-11-27 9:00 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-20 8:36 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 12:13 ` Eli Zaretskii
2024-11-15 17:20 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-11-15 19:10 ` Dmitry Gutov
2024-11-16 8:43 ` Eli Zaretskii
2024-11-18 1:42 ` Dmitry Gutov
2024-11-18 12:25 ` Eli Zaretskii
2024-11-18 16:10 ` Dmitry Gutov
2024-11-18 17:03 ` Eli Zaretskii
2024-11-19 1:21 ` Dmitry Gutov
2024-11-19 15:33 ` Eli Zaretskii
2024-11-19 19:51 ` Dmitry Gutov
2024-11-20 12:54 ` Eli Zaretskii
2024-11-21 10:37 ` Eli Zaretskii
2024-11-21 18:01 ` Juri Linkov
2024-11-21 19:16 ` Eli Zaretskii
2024-11-21 19:39 ` Juri Linkov
2024-11-21 19:56 ` Eli Zaretskii
2024-11-22 7:29 ` Juri Linkov
2024-11-22 8:20 ` Eli Zaretskii
2024-11-23 18:25 ` Juri Linkov
2024-11-23 18:53 ` Eli Zaretskii
2024-11-23 19:14 ` Juri Linkov
2024-11-23 19:36 ` Eli Zaretskii
2024-11-24 7:34 ` Juri Linkov
2024-11-24 9:42 ` Eli Zaretskii
2024-11-25 7:28 ` Juri Linkov
2024-11-19 18:36 ` Juri Linkov
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25443bb1-788a-4f06-9350-5d2c666f6795@gmx.at \
--to=bug-gnu-emacs@gnu.org \
--cc=74361@debbugs.gnu.org \
--cc=dmitry@gutov.dev \
--cc=juri@linkov.net \
--cc=rudalics@gmx.at \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).