window's @code{quit-restore} parameter (@pxref{Window Parameters}).
@deffn Command quit-window &optional kill window
-This command quits @var{window} and buries its buffer. The argument
-@var{window} must be a live window and defaults to the selected one.
-With prefix argument @var{kill} non-@code{nil}, it kills the buffer
-instead of burying it.
+This command quits @var{window} and buries its buffer. (It could also
+kill the buffer, subject to @code{quit-window-kill-buffer}, see below.)
+The argument @var{window} must be a live window and defaults to the
+selected one. With prefix argument @var{kill} non-@code{nil}, it kills
+the buffer instead of burying it.
@vindex quit-window-hook
The function @code{quit-window} first runs @code{quit-window-hook}.
which does the hard work.
@end deffn
-The following option tells @code{quit-window} whether it should
-preferably kill or bury @var{window}'s buffer.
+The following option tells @code{quit-window} whether it should kill or
+bury @var{window}'s buffer when the @var{kill} argument is @code{nil}.
@defopt quit-window-kill-buffer
-If this is @code{nil} and @var{kill} is @code{nil}, @code{quit-window}
-will bury @var{window}'s buffer. If this is @code{t},
-@code{quit-window} will try to kill @var{window}'s buffer. Otherwise,
-this should be a list of major modes. @code{quit-window} will kill the
-buffer of @var{window} regardless of the value of @var{kill} if that
-buffer's major mode is either a member of this list or is derived from a
-member of this list. In any other case, @code{quit-window} will kill
-the buffer only if @var{kill} is non-@code{nil} and bury it otherwise.
+This variable controls whether @code{quit-window} kills the buffer of
+its @var{window} argument. If the value is @code{nil} (the default)
+@code{quit-window} will kill @var{window}'s buffer only if the
+@var{kill} argument is non-@code{nil}. If this is @code{t},
+@code{quit-window} will try to kill @var{window}'s buffer regardless of
+the value of the @var{kill} argument. Otherwise, this should be a list
+of major modes; @code{quit-window} will kill the buffer of @var{window}
+regardless of the value of @var{kill} if that buffer's major mode is
+either a member of this list or is derived from a member of this list.
+In any other case, @code{quit-window} will kill the buffer only if
+@var{kill} is non-@code{nil} and bury it otherwise.
@end defopt
You can get more control by calling @code{quit-restore-window} instead
(bury-buffer-internal buffer)))))
(defcustom quit-window-kill-buffer nil
- "Non-nil means `quit-window' will try to kill WINDOW's buffer.
-If this is nil and the KILL argument is nil, `quit-window' will bury
-WINDOW's buffer. If this is t, `quit-window' will always try to kill
-WINDOW's buffer. Otherwise, this should be a list of major modes.
-`quit-window' will kill the buffer of its WINDOW argument regardless of
-the value of KILL if that buffer's major mode is either a member of this
-list or is derived from a member of this list. In any other case,
-`quit-window' will kill the buffer only if KILL is non-nil and bury it
-otherwise."
+ "Non-nil means `quit-window' will try to kill buffer of WINDOW it quits.
+If this variable is nil (the default), `quit-window' will bury WINDOW's
+buffer if the KILL argument is nil and kill it otherwise.
+If this is t, `quit-window' will try to kill WINDOW's buffer regardless
+of the value of KILL.
+If this is a list of major modes, `quit-window' will kill the WINDOW's
+buffer regardless of the value of KILL if that buffer's major mode is
+either a member of this list or is derived from a member of this list.
+For any other value, `quit-window' will kill the buffer only if KILL is
+non-nil and bury it otherwise."
:type '(choice (boolean :tag "All major modes")
(repeat (symbol :tag "Major mode")))
:version "31.1"
"Quit WINDOW and bury its buffer.
WINDOW must be a live window and defaults to the selected one.
With prefix argument KILL non-nil, kill the buffer instead of
-burying it.
+burying it. If `quit-window-kill-buffer' is non-nil, perhaps
+kill the buffer even if KILL is nil; see the doc string of
+that variable for the details.
This calls the function `quit-restore-window' to delete WINDOW or
show some other buffer in it. See Info node `(elisp) Quitting