From: Juri Linkov <juri@linkov.net>
To: 67993@debbugs.gnu.org
Cc: martin rudalics <rudalics@gmx.at>
Subject: bug#67993: Selecting buffer automatically
Date: Thu, 04 Jan 2024 19:12:23 +0200 [thread overview]
Message-ID: <865y09nmp0.fsf@mail.linkov.net> (raw)
In-Reply-To: <86zfy0g641.fsf@mail.linkov.net> (Juri Linkov's message of "Sat, 23 Dec 2023 19:51:10 +0200")
Martin, do you agree with this change?
If ok, then I could update the documentation as well.
>>>> I believe this should be customizable with something like
>>>>
>>>> (setopt display-buffer-alist
>>>> '(("\\*Compile-Log\\*" nil (select-window . t))))
>>>
>>> Thank you for the advice, but I tried this and it didn't work.
>>> *Compile-log* buffer isn't selected.
>>
>> This feature was discussed in bug#33258 and bug#46034,
>> but not yet implemented. It should be easy to implement
>> exactly the same way as 'windmove-display-in-direction'
>> selects the old or new window in 'post-command-hook'.
>> Ok, I will post a patch to bug-gnu-emacs.
>
> Here is the patch that allows using (select-window . t) in display-buffer-alist
> to select the displayed window, and (select-window . nil) to deselect windows
> selected by such functions as pop-to-buffer:
>
> diff --git a/lisp/window.el b/lisp/window.el
> index 40070a4d929..fad95601a55 100644
> --- a/lisp/window.el
> +++ b/lisp/window.el
> @@ -7851,6 +7856,16 @@ display-buffer
> (while (and functions (not window))
> (setq window (funcall (car functions) buffer alist)
> functions (cdr functions)))
> + (when-let ((select-window (assq 'select-window alist)))
> + (letrec ((postfun
> + (lambda ()
> + (if (cdr select-window)
> + (when (window-live-p window)
> + (select-window window))
> + (when (window-live-p (old-selected-window))
> + (select-window (old-selected-window))))
> + (remove-hook 'post-command-hook postfun))))
> + (add-hook 'post-command-hook postfun)))
> (and (windowp window) window))))
>
> (defun display-buffer-other-frame (buffer)
next prev parent reply other threads:[~2024-01-04 17:12 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-23 17:51 bug#67993: Selecting buffer automatically Juri Linkov
2024-01-04 17:12 ` Juri Linkov [this message]
2024-01-05 9:23 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-06 17:40 ` Juri Linkov
2024-01-07 14:56 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-07 16:51 ` Juri Linkov
2024-01-08 8:55 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-09 17:20 ` Juri Linkov
2024-01-10 8:37 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-10 17:12 ` Juri Linkov
2024-01-11 9:15 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-12 7:46 ` Juri Linkov
2024-01-13 10:39 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-14 18:48 ` Juri Linkov
2024-01-15 10:23 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-15 17:56 ` Juri Linkov
2024-01-16 10:18 ` martin rudalics via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-01-16 16:54 ` 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=865y09nmp0.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=67993@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 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).