[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 88e0e034ef: 2022-05-14 Martin Rudalics <address@hidden>
From: |
Martin Rudalics |
Subject: |
master 88e0e034ef: 2022-05-14 Martin Rudalics <address@hidden> |
Date: |
Sat, 14 May 2022 03:22:43 -0400 (EDT) |
branch: master
commit 88e0e034eff81194b775fd3d1e7cbd28eeb610f6
Author: Martin Rudalics <rudalics@gmx.at>
Commit: Martin Rudalics <rudalics@gmx.at>
2022-05-14 Martin Rudalics <rudalics@gmx.at>
* lisp/window.el (quit-restore-select-window): New function.
(quit-restore-window): Call 'quit-restore-select-window' to avoid
selecting inactive minibuffer window (Bug#55403).
---
lisp/window.el | 25 +++++++++++++++----------
1 file changed, 15 insertions(+), 10 deletions(-)
diff --git a/lisp/window.el b/lisp/window.el
index 0787e6390c..e378652e28 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5142,6 +5142,14 @@ all window-local buffer lists."
:version "27.1"
:group 'windows)
+(defun quit-restore-select-window (window)
+ "Select WINDOW after having quit another one.
+Do not select an inactive minibuffer window."
+ (when (and (window-live-p window)
+ (or (not (window-minibuffer-p window))
+ (minibuffer-window-active-p window)))
+ (select-window window)))
+
(defun quit-restore-window (&optional window bury-or-kill)
"Quit WINDOW and deal with its buffer.
WINDOW must be a live window and defaults to the selected one.
@@ -5191,15 +5199,13 @@ nil means to not handle the buffer in a particular way.
This
((and dedicated (not (eq dedicated 'side))
(window--delete window 'dedicated (eq bury-or-kill 'kill)))
;; If the previously selected window is still alive, select it.
- (when (window-live-p (nth 2 quit-restore))
- (select-window (nth 2 quit-restore))))
+ (quit-restore-select-window (nth 2 quit-restore)))
((and (not prev-buffer)
(eq (nth 1 quit-restore) 'tab)
(eq (nth 3 quit-restore) buffer))
(tab-bar-close-tab)
;; If the previously selected window is still alive, select it.
- (when (window-live-p (nth 2 quit-restore))
- (select-window (nth 2 quit-restore))))
+ (quit-restore-select-window (nth 2 quit-restore)))
((and (not prev-buffer)
(or (eq (nth 1 quit-restore) 'frame)
(and (eq (nth 1 quit-restore) 'window)
@@ -5211,8 +5217,7 @@ nil means to not handle the buffer in a particular way.
This
;; Delete WINDOW if possible.
(window--delete window nil (eq bury-or-kill 'kill)))
;; If the previously selected window is still alive, select it.
- (when (window-live-p (nth 2 quit-restore))
- (select-window (nth 2 quit-restore))))
+ (quit-restore-select-window (nth 2 quit-restore)))
((and (listp (setq quad (nth 1 quit-restore)))
(buffer-live-p (car quad))
(eq (nth 3 quit-restore) buffer))
@@ -5256,8 +5261,8 @@ nil means to not handle the buffer in a particular way.
This
;; Reset the quit-restore parameter.
(set-window-parameter window 'quit-restore nil)
;; Select old window.
- (when (window-live-p (nth 2 quit-restore))
- (select-window (nth 2 quit-restore))))
+ ;; If the previously selected window is still alive, select it.
+ (quit-restore-select-window (nth 2 quit-restore)))
(t
;; Show some other buffer in WINDOW and reset the quit-restore
;; parameter.
@@ -5270,8 +5275,8 @@ nil means to not handle the buffer in a particular way.
This
(when (eq dedicated 'side)
(set-window-dedicated-p window 'side))
(window--delete window nil (eq bury-or-kill 'kill))
- (when (window-live-p (nth 2 quit-restore))
- (select-window (nth 2 quit-restore))))))
+ ;; If the previously selected window is still alive, select it.
+ (quit-restore-select-window (nth 2 quit-restore)))))
;; Deal with the buffer.
(cond
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 88e0e034ef: 2022-05-14 Martin Rudalics <address@hidden>,
Martin Rudalics <=