summaryrefslogtreecommitdiff
path: root/lisp/window.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/window.el')
-rw-r--r--lisp/window.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/window.el b/lisp/window.el
index 0f17bb28b4c..aff99d36c59 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -5151,7 +5151,10 @@ nil means to not handle the buffer in a particular way. This
(cond
;; First try to delete dedicated windows that are not side windows.
((and dedicated (not (eq dedicated 'side))
- (window--delete window 'dedicated (eq bury-or-kill 'kill))))
+ (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))))
((and (not prev-buffer)
(eq (nth 1 quit-restore) 'tab)
(eq (nth 3 quit-restore) buffer))