Functions quitting a window and consequently affected by this
variable are `switch-to-prev-buffer', `delete-windows-on',
-`replace-buffer-in-windows' and `quit-restore-window'."
+`replace-buffer-in-windows' and `quit-window'."
:type '(choice
(const :tag "Never" nil)
(const :tag "Automatic" automatic)
;; Unrecord BUFFER in WINDOW.
(unrecord-window-buffer window buffer)))))
-(defun quit-restore-window (&optional window kill)
- "Quit WINDOW in some way.
-WINDOW must be a live window and defaults to the selected window.
-Return nil.
+(defun quit-window (&optional kill window)
+ "Quit WINDOW and bury its buffer.
+WINDOW defaults to the selected window.
+With a prefix argument, kill the buffer instead.
According to information stored in WINDOW's `quit-restore' window
parameter either \(1) delete WINDOW and its frame, \(2) delete
WINDOW, \(3) restore the buffer previously displayed in WINDOW,
or \(4) make WINDOW display some other buffer than the present
-one. If non-nil, reset `quit-restore' parameter to nil.
-
-Optional argument KILL non-nil means in addition kill WINDOW's
-buffer. If KILL is nil, put WINDOW's buffer at the end of the
-buffer list. Interactively, KILL is the prefix argument."
- (interactive "i\nP")
+one. If non-nil, reset `quit-restore' parameter to nil."
+ (interactive "P")
(setq window (window-normalize-live-window window))
(let ((buffer (window-buffer window))
(quit-restore (window-parameter window 'quit-restore))
(switch-to-prev-buffer window 'bury-or-kill)))
;; Kill WINDOW's old-buffer if requested
- (when kill (kill-buffer buffer))
- nil))
+ (if kill (kill-buffer buffer))))
\f
;;; Splitting windows.
(defsubst window-split-min-size (&optional horizontal)
(with-current-buffer buffer-to-kill
(remove-hook 'kill-buffer-hook delete-window-hook t))))))
-(defun quit-window (&optional kill window)
- "Quit WINDOW and bury its buffer.
-With a prefix argument, kill the buffer instead. WINDOW defaults
-to the selected window.
-
-If WINDOW is non-nil, dedicated, or a minibuffer window, delete
-it and, if it's alone on its frame, its frame too. Otherwise, or
-if deleting WINDOW fails in any of the preceding cases, display
-another buffer in WINDOW using `switch-to-buffer'.
-
-Optional argument KILL non-nil means kill WINDOW's buffer.
-Otherwise, bury WINDOW's buffer, see `bury-buffer'."
- (interactive "P")
- (let ((buffer (window-buffer window)))
- (if (or window
- (window-minibuffer-p window)
- (window-dedicated-p window))
- ;; WINDOW is either non-nil, a minibuffer window, or dedicated;
- ;; try to delete it.
- (let* ((window (or window (selected-window)))
- (frame (window-frame window)))
- (if (frame-root-window-p window)
- ;; WINDOW is alone on its frame.
- (delete-frame frame)
- ;; There are other windows on its frame, delete WINDOW.
- (delete-window window)))
- ;; Otherwise, switch to another buffer in the selected window.
- (switch-to-buffer nil))
-
- ;; Deal with the buffer.
- (if kill
- (kill-buffer buffer)
- (bury-buffer buffer))))
\f
(defvar recenter-last-op nil
"Indicates the last recenter operation performed.