summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGerd Moellmann <gerd@gnu.org>2001-01-10 20:19:16 +0000
committerGerd Moellmann <gerd@gnu.org>2001-01-10 20:19:16 +0000
commit11f1530569b446acc94b8972e0e7e0bef2349823 (patch)
tree017cba589c7a76e77680cff0c5919ae93d78e45f
parent02366792116487ada8e1990c8bdbe2db072b63dc (diff)
downloademacs-11f1530569b446acc94b8972e0e7e0bef2349823.tar.gz
(confirm-kill-emacs): New user-option.
(save-buffers-kill-emacs): Ask for final confirmation before killing Emacs.
-rw-r--r--lisp/files.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/files.el b/lisp/files.el
index bd808ddae7b..275c2ef0b4f 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -3644,6 +3644,14 @@ If any of these functions returns nil, killing Emacs is cancelled.
but `kill-emacs', the low level primitive, does not.
See also `kill-emacs-hook'.")
+(defcustom confirm-kill-emacs nil
+ "Ask for confirmation when leaving Emacs."
+ :type '(choice (const :tag "Ask with yes-or-no-p" yes-or-no-p)
+ (const :tag "Ask with y-or-n-p" y-or-n-p)
+ (const :tag "Don't confirm" nil))
+ :group 'emacs
+ :version "21.1")
+
(defun save-buffers-kill-emacs (&optional arg)
"Offer to save each buffer, then kill this Emacs process.
With prefix arg, silently save all file-visiting buffers, then kill."
@@ -3670,6 +3678,8 @@ With prefix arg, silently save all file-visiting buffers, then kill."
(yes-or-no-p "Active processes exist; kill them and exit anyway? "))))
;; 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)))
;; We use /: as a prefix to "quote" a file name