Function: quit-window

quit-window is an interactive and byte-compiled function defined in window.el.gz.

Signature

(quit-window &optional KILL WINDOW)

Documentation

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.

This calls the function quit-restore-window to delete WINDOW or show some other buffer in it. See Info node (elisp) Quitting Windows for more details.

The functions in quit-window-hook will be run before doing anything else.

Probably introduced at or before Emacs version 24.1.

Key Bindings

Aliases

verilog-quit-window Info-exit (obsolete since 27.1)

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun quit-window (&optional kill window)
  "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.

This calls the function `quit-restore-window' to delete WINDOW or
show some other buffer in it.  See Info node `(elisp) Quitting
Windows' for more details.

The functions in `quit-window-hook' will be run before doing
anything else."
  (interactive "P")
  ;; Run the hook from the buffer implied to get any buffer-local
  ;; values.
  (with-current-buffer (window-buffer (window-normalize-window window))
    (run-hooks 'quit-window-hook))
  (quit-restore-window window (if kill 'kill 'bury)))