[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#67993: Selecting buffer automatically
From: |
Juri Linkov |
Subject: |
bug#67993: Selecting buffer automatically |
Date: |
Thu, 04 Jan 2024 19:12:23 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu) |
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)
- bug#67993: Selecting buffer automatically,
Juri Linkov <=
- bug#67993: Selecting buffer automatically, martin rudalics, 2024/01/05
- bug#67993: Selecting buffer automatically, Juri Linkov, 2024/01/06
- bug#67993: Selecting buffer automatically, martin rudalics, 2024/01/07
- bug#67993: Selecting buffer automatically, Juri Linkov, 2024/01/07
- bug#67993: Selecting buffer automatically, martin rudalics, 2024/01/08
- bug#67993: Selecting buffer automatically, Juri Linkov, 2024/01/09
- bug#67993: Selecting buffer automatically, martin rudalics, 2024/01/10
- bug#67993: Selecting buffer automatically, Juri Linkov, 2024/01/10
- bug#67993: Selecting buffer automatically, martin rudalics, 2024/01/11
- bug#67993: Selecting buffer automatically, Juri Linkov, 2024/01/12