Variable: delete-window-choose-selected
delete-window-choose-selected is a customizable variable defined in
window.el.gz.
Value
mru
Documentation
How to choose a frame's selected window after window deletion.
When a frame's selected window gets deleted, Emacs has to choose another live window on that frame to serve as its selected window. This option allows to control which window gets selected instead.
The possible choices are 'mru' (the default) to select the most
recently used window on that frame, and 'pos' to choose the
window at the frame coordinates of point of the previously
selected window. If this is nil, choose the frame's first window
instead. A window with a non-nil no-other-window parameter is
chosen only if all windows on that frame have that parameter set
to a non-nil value.
This variable was added, or its default value changed, in Emacs 28.1.
Probably introduced at or before Emacs version 28.1.
Source Code
;; Defined in /usr/src/emacs/lisp/window.el.gz
(defcustom delete-window-choose-selected 'mru
"How to choose a frame's selected window after window deletion.
When a frame's selected window gets deleted, Emacs has to choose
another live window on that frame to serve as its selected
window. This option allows to control which window gets selected
instead.
The possible choices are 'mru' (the default) to select the most
recently used window on that frame, and 'pos' to choose the
window at the frame coordinates of point of the previously
selected window. If this is nil, choose the frame's first window
instead. A window with a non-nil `no-other-window' parameter is
chosen only if all windows on that frame have that parameter set
to a non-nil value."
:type '(choice (const :tag "Most recently used" mru)
(const :tag "At position of deleted" pos)
(const :tag "Frame's first " nil))
:group 'windows
:group 'frames
:version "28.1")