diff options
author | Richard M. Stallman <rms@gnu.org> | 2003-09-12 00:52:08 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 2003-09-12 00:52:08 +0000 |
commit | 0f790c74e1c595fb8ce3984ba7a7492ac951db44 (patch) | |
tree | 11ea54b71be772e835c9da9a880ef151c1291f66 /lisp | |
parent | f87ef6b12d0cc7fc029e70bb55d2af0b1bc90081 (diff) | |
download | emacs-0f790c74e1c595fb8ce3984ba7a7492ac951db44.tar.gz |
(kill-buffer-and-window): Remove `yes-or-no-p' so that
the function is less noisy. Now only `kill-buffer' can ask questions.
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/window.el | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lisp/window.el b/lisp/window.el index 0dadd4195c6..2cfc254b220 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -532,11 +532,18 @@ Return non-nil if the window was shrunk." (defun kill-buffer-and-window () "Kill the current buffer and delete the selected window." (interactive) - (if (yes-or-no-p (format "Kill buffer `%s'? " (buffer-name))) - (let ((buffer (current-buffer))) - (delete-window (selected-window)) - (kill-buffer buffer)) - (error "Aborted"))) + (let ((window-to-delete (selected-window)) + (delete-window-hook (lambda () + (condition-case nil + (delete-window) + (error nil))))) + (add-hook 'kill-buffer-hook delete-window-hook t t) + (if (kill-buffer (current-buffer)) + ;; If `delete-window' failed before, we rerun it to regenerate + ;; the error so it can be seen in the minibuffer. + (when (eq (selected-window) window-to-delete) + (delete-window)) + (remove-hook 'kill-buffer-hook delete-window-hook t)))) (defun quit-window (&optional kill window) "Quit the current buffer. Bury it, and maybe delete the selected frame. |