Function: quit-windows-on

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

Signature

(quit-windows-on &optional BUFFER-OR-NAME KILL FRAME)

Documentation

Quit all windows showing BUFFER-OR-NAME.

BUFFER-OR-NAME may be a buffer or the name of an existing buffer and defaults to the current buffer. Optional argument KILL non-nil means to kill BUFFER-OR-NAME. KILL nil means to bury BUFFER-OR-NAME. Optional argument FRAME is handled as by delete-windows-on.

This function calls quit-window on all candidate windows showing BUFFER-OR-NAME.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/window.el.gz
(defun quit-windows-on (&optional buffer-or-name kill frame)
  "Quit all windows showing BUFFER-OR-NAME.
BUFFER-OR-NAME may be a buffer or the name of an existing buffer
and defaults to the current buffer.  Optional argument KILL
non-nil means to kill BUFFER-OR-NAME.  KILL nil means to bury
BUFFER-OR-NAME.  Optional argument FRAME is handled as by
`delete-windows-on'.

This function calls `quit-window' on all candidate windows
showing BUFFER-OR-NAME."
  (interactive "bQuit windows on (buffer):\nP")
  (let ((buffer (window-normalize-buffer buffer-or-name))
	;; Handle the "inverted" meaning of the FRAME argument wrt other
	;; `window-list-1' based function.
	(all-frames (cond ((not frame) t) ((eq frame t) nil) (t frame))))
    (dolist (window (window-list-1 nil nil all-frames))
      (if (eq (window-buffer window) buffer)
	  (quit-window kill window)
	;; If a window doesn't show BUFFER, unrecord BUFFER in it.
	(unrecord-window-buffer window buffer)))))