Mercurial > emacs
comparison lisp/window.el @ 52481:f1cce2846e29
(kill-buffer-and-window): Remove `yes-or-no-p' so that
the function is less noisy. Now only `kill-buffer' can ask questions.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 12 Sep 2003 00:52:08 +0000 |
parents | 695cf19ef79e |
children | de1a002c48c7 |
comparison
equal
deleted
inserted
replaced
52480:dc467d89341e | 52481:f1cce2846e29 |
---|---|
530 (fit-window-to-buffer window (window-height window))))) | 530 (fit-window-to-buffer window (window-height window))))) |
531 | 531 |
532 (defun kill-buffer-and-window () | 532 (defun kill-buffer-and-window () |
533 "Kill the current buffer and delete the selected window." | 533 "Kill the current buffer and delete the selected window." |
534 (interactive) | 534 (interactive) |
535 (if (yes-or-no-p (format "Kill buffer `%s'? " (buffer-name))) | 535 (let ((window-to-delete (selected-window)) |
536 (let ((buffer (current-buffer))) | 536 (delete-window-hook (lambda () |
537 (delete-window (selected-window)) | 537 (condition-case nil |
538 (kill-buffer buffer)) | 538 (delete-window) |
539 (error "Aborted"))) | 539 (error nil))))) |
540 (add-hook 'kill-buffer-hook delete-window-hook t t) | |
541 (if (kill-buffer (current-buffer)) | |
542 ;; If `delete-window' failed before, we rerun it to regenerate | |
543 ;; the error so it can be seen in the minibuffer. | |
544 (when (eq (selected-window) window-to-delete) | |
545 (delete-window)) | |
546 (remove-hook 'kill-buffer-hook delete-window-hook t)))) | |
540 | 547 |
541 (defun quit-window (&optional kill window) | 548 (defun quit-window (&optional kill window) |
542 "Quit the current buffer. Bury it, and maybe delete the selected frame. | 549 "Quit the current buffer. Bury it, and maybe delete the selected frame. |
543 \(The frame is deleted if it is contains a dedicated window for the buffer.) | 550 \(The frame is deleted if it is contains a dedicated window for the buffer.) |
544 With a prefix argument, kill the buffer instead. | 551 With a prefix argument, kill the buffer instead. |