From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: 70949@debbugs.gnu.org
Subject: bug#70949: display-buffer-choose-some-window
Date: Wed, 05 Jun 2024 19:48:52 +0300 [thread overview]
Message-ID: <86v82nbuwb.fsf@mail.linkov.net> (raw)
In-Reply-To: <86d70100-efeb-4326-aece-3ec78e023a4f@gmx.at> (martin rudalics's message of "Wed, 5 Jun 2024 10:46:27 +0200")
>> The most reliable way to identify a series of related buffers
>> is to set a buffer-local variable in the origin buffer
>> to the window where outgoing buffers are displayed.
>
> How would this work in the case of 'vc-dir'? There you have a status
> buffer whose buffer-local variable you probably want to set. You call
> 'vc-diff' which calls 'vc-diff-internal' which eventually calls
> 'pop-to-buffer' which chooses the window of the outgoing buffer. How
> would you set up the variable in this scenario?
The same way as the condition function allows to check
the original buffer, e.g. customization to show
outgoing 'vc-diff' buffers in the same window
where the 'vc-dir' was displayed:
(defun display-buffer-from-vc-dir-p (_buffer-name _action)
(with-current-buffer (window-buffer)
(derived-mode-p '(vc-dir-mode))))
(add-to-list 'display-buffer-alist
'(display-buffer-from-vc-dir-p
display-buffer-same-window
(inhibit-same-window . nil)))
This means using
(with-current-buffer (window-buffer)
(setq-local display-buffer-previous-window (selected-window)))
after every buffer display from the original buffer.
>> Ideally, the users need to express their preference by a single alist entry.
>> For example:
>>
>> (use-previous-window . t) -- then all outgoing buffers will be displayed
>> in the same window
>>
>> (use-mru-window . t) -- then all outgoing buffers will be displayed
>> in the most recently used window
>> instead of the default lru
>>
>> Or maybe a unified alist entry:
>>
>> (prefer . previous-window)
>> (prefer . mru-window)
>
> It's trivial to set up such an association for "*vc-diff*". But what
> would you do when calling 'vc-diff' with a different BUFFER argument?
> Which kind of association would you set up for showing the next error
> buffer in compilation output?
The displayed buffer has no significance. The buffer-local variable
will be set in the original buffer to the value of the displayed window.
next prev parent reply other threads:[~2024-06-05 16:48 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 16:56 bug#70949: display-buffer-choose-some-window Juri Linkov
2024-05-15 8:06 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-15 16:49 ` Juri Linkov
2024-05-16 8:20 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-17 6:40 ` Juri Linkov
2024-05-18 9:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-20 6:15 ` Juri Linkov
2024-05-20 8:01 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-20 16:54 ` Juri Linkov
2024-05-21 8:21 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-21 17:18 ` Juri Linkov
2024-05-22 7:39 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-23 6:16 ` Juri Linkov
2024-05-23 7:22 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-23 17:27 ` Juri Linkov
2024-05-24 9:32 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-24 17:38 ` Juri Linkov
2024-05-26 8:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-27 17:52 ` Juri Linkov
2024-05-28 8:05 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-28 16:19 ` Juri Linkov
2024-05-29 8:49 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-30 6:34 ` Juri Linkov
2024-05-30 8:54 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-31 6:18 ` Juri Linkov
2024-05-31 9:45 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-02 6:39 ` Juri Linkov
2024-06-04 8:20 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-04 16:43 ` Juri Linkov
2024-06-05 8:46 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-05 16:48 ` Juri Linkov [this message]
2024-06-06 9:19 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-07 6:37 ` Juri Linkov
2024-06-07 8:23 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-07 16:45 ` Juri Linkov
2024-06-08 9:12 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-06-09 17:04 ` 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86v82nbuwb.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=70949@debbugs.gnu.org \
--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 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.