[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 5a971bd: files.el: avoid asking whether to kill Ema
From: |
Michal Nazarewicz |
Subject: |
[Emacs-diffs] master 5a971bd: files.el: avoid asking whether to kill Emacs multiple times |
Date: |
Fri, 30 Jan 2015 10:43:10 +0000 |
branch: master
commit 5a971bd30207a3bb7038ee7870abf7c4c4e99dc1
Author: Michal Nazarewicz <address@hidden>
Commit: Michal Nazarewicz <address@hidden>
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.
---
lisp/ChangeLog | 7 ++++++
lisp/files.el | 63 ++++++++++++++++++++++++++++++-------------------------
2 files changed, 41 insertions(+), 29 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index de41aeb..c5da870 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
+2015-01-30 Michal Nazarewicz <address@hidden>
+
+ * 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.
+
2015-01-29 Jay Belanger <address@hidden>
* lisp/calc/calc-units.el (calc-convert-exact-units): New function.
diff --git a/lisp/files.el b/lisp/files.el
index 40a4289..5e80cb7 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
if any returns nil. If `confirm-kill-emacs' is non-nil, calls it."
(interactive "P")
(save-some-buffers arg t)
- (and (or (not (memq t (mapcar (function
- (lambda (buf) (and (buffer-file-name buf)
- (buffer-modified-p buf))))
- (buffer-list))))
- (yes-or-no-p "Modified buffers exist; exit anyway? "))
- (or (not (fboundp 'process-list))
- ;; process-list is not defined on MSDOS.
- (let ((processes (process-list))
- active)
- (while processes
- (and (memq (process-status (car processes)) '(run stop open
listen))
- (process-query-on-exit-flag (car processes))
- (setq active t))
- (setq processes (cdr processes)))
- (or (not active)
- (with-current-buffer-window
- (get-buffer-create "*Process List*") nil
- #'(lambda (window _value)
- (with-selected-window window
- (unwind-protect
- (yes-or-no-p "Active processes exist; kill them and
exit anyway? ")
- (when (window-live-p window)
- (quit-restore-window window 'kill)))))
- (list-processes t)))))
- ;; Query the user for other things, perhaps.
- (run-hook-with-args-until-failure 'kill-emacs-query-functions)
- (or (null confirm-kill-emacs)
- (funcall confirm-kill-emacs "Really exit Emacs? "))
- (kill-emacs)))
+ (let ((confirm confirm-kill-emacs))
+ (and
+ (or (not (memq t (mapcar (function
+ (lambda (buf) (and (buffer-file-name buf)
+ (buffer-modified-p buf))))
+ (buffer-list))))
+ (progn (setq confirm nil)
+ (yes-or-no-p "Modified buffers exist; exit anyway? ")))
+ (or (not (fboundp 'process-list))
+ ;; process-list is not defined on MSDOS.
+ (let ((processes (process-list))
+ active)
+ (while processes
+ (and (memq (process-status (car processes)) '(run stop open
listen))
+ (process-query-on-exit-flag (car processes))
+ (setq active t))
+ (setq processes (cdr processes)))
+ (or (not active)
+ (with-current-buffer-window
+ (get-buffer-create "*Process List*") nil
+ #'(lambda (window _value)
+ (with-selected-window window
+ (unwind-protect
+ (progn
+ (setq confirm nil)
+ (yes-or-no-p "Active processes exist; kill them
and exit anyway? "))
+ (when (window-live-p window)
+ (quit-restore-window window 'kill)))))
+ (list-processes t)))))
+ ;; Query the user for other things, perhaps.
+ (run-hook-with-args-until-failure 'kill-emacs-query-functions)
+ (or (null confirm)
+ (funcall confirm "Really exit Emacs? "))
+ (kill-emacs))))
(defun save-buffers-kill-terminal (&optional arg)
"Offer to save each buffer, then kill the current connection.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 5a971bd: files.el: avoid asking whether to kill Emacs multiple times,
Michal Nazarewicz <=