diff options
| author | Michal Nazarewicz | 2015-01-22 00:14:42 +0100 |
|---|---|---|
| committer | Michal Nazarewicz | 2015-01-30 11:43:04 +0100 |
| commit | 5a971bd30207a3bb7038ee7870abf7c4c4e99dc1 (patch) | |
| tree | 5376a968912566c5609f1d2b2b005888c1e0defd | |
| parent | c9d238316c6a4bb16a89de0d8babf782d77c4856 (diff) | |
| download | emacs-5a971bd30207a3bb7038ee7870abf7c4c4e99dc1.tar.gz emacs-5a971bd30207a3bb7038ee7870abf7c4c4e99dc1.zip | |
files.el: avoid asking whether to kill Emacs multiple times
* lisp/files.el (save-buffers-kill-emacs): If `confirm-kill-emacs' is
set, but user has just been asked whether they really want to kill Emacs
(for example with a ‘Modified buffers exist; exit anyway?’ prompt) , do
not ask them for another confirmation.
| -rw-r--r-- | lisp/ChangeLog | 7 | ||||
| -rw-r--r-- | lisp/files.el | 63 |
2 files changed, 41 insertions, 29 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index de41aeb8107..c5da87075f3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2015-01-30 Michal Nazarewicz <mina86@mina86.com> | ||
| 2 | |||
| 3 | * lisp/files.el (save-buffers-kill-emacs): If `confirm-kill-emacs' | ||
| 4 | is set, but user has just been asked whether they really want to | ||
| 5 | kill Emacs (for example with a ‘Modified buffers exist; exit | ||
| 6 | anyway?’ prompt), do not ask them for another confirmation. | ||
| 7 | |||
| 1 | 2015-01-29 Jay Belanger <jay.p.belanger@gmail.com> | 8 | 2015-01-29 Jay Belanger <jay.p.belanger@gmail.com> |
| 2 | 9 | ||
| 3 | * lisp/calc/calc-units.el (calc-convert-exact-units): New function. | 10 | * lisp/calc/calc-units.el (calc-convert-exact-units): New function. |
diff --git a/lisp/files.el b/lisp/files.el index 40a42897419..5e80cb76599 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -6590,35 +6590,40 @@ Runs the members of `kill-emacs-query-functions' in turn and stops | |||
| 6590 | if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." | 6590 | if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." |
| 6591 | (interactive "P") | 6591 | (interactive "P") |
| 6592 | (save-some-buffers arg t) | 6592 | (save-some-buffers arg t) |
| 6593 | (and (or (not (memq t (mapcar (function | 6593 | (let ((confirm confirm-kill-emacs)) |
| 6594 | (lambda (buf) (and (buffer-file-name buf) | 6594 | (and |
| 6595 | (buffer-modified-p buf)))) | 6595 | (or (not (memq t (mapcar (function |
| 6596 | (buffer-list)))) | 6596 | (lambda (buf) (and (buffer-file-name buf) |
| 6597 | (yes-or-no-p "Modified buffers exist; exit anyway? ")) | 6597 | (buffer-modified-p buf)))) |
| 6598 | (or (not (fboundp 'process-list)) | 6598 | (buffer-list)))) |
| 6599 | ;; process-list is not defined on MSDOS. | 6599 | (progn (setq confirm nil) |
| 6600 | (let ((processes (process-list)) | 6600 | (yes-or-no-p "Modified buffers exist; exit anyway? "))) |
| 6601 | active) | 6601 | (or (not (fboundp 'process-list)) |
| 6602 | (while processes | 6602 | ;; process-list is not defined on MSDOS. |
| 6603 | (and (memq (process-status (car processes)) '(run stop open listen)) | 6603 | (let ((processes (process-list)) |
| 6604 | (process-query-on-exit-flag (car processes)) | 6604 | active) |
| 6605 | (setq active t)) | 6605 | (while processes |
| 6606 | (setq processes (cdr processes))) | 6606 | (and (memq (process-status (car processes)) '(run stop open listen)) |
| 6607 | (or (not active) | 6607 | (process-query-on-exit-flag (car processes)) |
| 6608 | (with-current-buffer-window | 6608 | (setq active t)) |
| 6609 | (get-buffer-create "*Process List*") nil | 6609 | (setq processes (cdr processes))) |
| 6610 | #'(lambda (window _value) | 6610 | (or (not active) |
| 6611 | (with-selected-window window | 6611 | (with-current-buffer-window |
| 6612 | (unwind-protect | 6612 | (get-buffer-create "*Process List*") nil |
| 6613 | (yes-or-no-p "Active processes exist; kill them and exit anyway? ") | 6613 | #'(lambda (window _value) |
| 6614 | (when (window-live-p window) | 6614 | (with-selected-window window |
| 6615 | (quit-restore-window window 'kill))))) | 6615 | (unwind-protect |
| 6616 | (list-processes t))))) | 6616 | (progn |
| 6617 | ;; Query the user for other things, perhaps. | 6617 | (setq confirm nil) |
| 6618 | (run-hook-with-args-until-failure 'kill-emacs-query-functions) | 6618 | (yes-or-no-p "Active processes exist; kill them and exit anyway? ")) |
| 6619 | (or (null confirm-kill-emacs) | 6619 | (when (window-live-p window) |
| 6620 | (funcall confirm-kill-emacs "Really exit Emacs? ")) | 6620 | (quit-restore-window window 'kill))))) |
| 6621 | (kill-emacs))) | 6621 | (list-processes t))))) |
| 6622 | ;; Query the user for other things, perhaps. | ||
| 6623 | (run-hook-with-args-until-failure 'kill-emacs-query-functions) | ||
| 6624 | (or (null confirm) | ||
| 6625 | (funcall confirm "Really exit Emacs? ")) | ||
| 6626 | (kill-emacs)))) | ||
| 6622 | 6627 | ||
| 6623 | (defun save-buffers-kill-terminal (&optional arg) | 6628 | (defun save-buffers-kill-terminal (&optional arg) |
| 6624 | "Offer to save each buffer, then kill the current connection. | 6629 | "Offer to save each buffer, then kill the current connection. |