summaryrefslogtreecommitdiff
path: root/lisp/files.el
diff options
context:
space:
mode:
authorPhilipp Stephani <phst@google.com>2016-09-27 20:47:23 +0200
committerPhilipp Stephani <phst@google.com>2016-10-01 14:25:27 +0200
commitb661efd90d9bd57430761b0e87fcc8723ec24814 (patch)
tree2808dd470064a2ac929dd28804359886a650f9ad /lisp/files.el
parente1c5422e7bc2fbe0ecf5ab501b39d32fac61e747 (diff)
downloademacs-b661efd90d9bd57430761b0e87fcc8723ec24814.tar.gz
Make querying to kill processes customizable
Introduce a new customization option, `confirm-kill-processes', that users can set to nil if they don't want Emacs to nag them about killing processes. * lisp/files.el (confirm-kill-processes): New customization option. (save-buffers-kill-emacs): Use customization option. * test/lisp/files-tests.el (files-test--save-buffers-kill-emacs--confirm-kill-processes): Add test for new customization option. * doc/emacs/entering.texi (Exiting): Document new user option. * doc/lispref/processes.texi (Query Before Exit): Document new user option. * etc/NEWS: Document new user option.
Diffstat (limited to 'lisp/files.el')
-rw-r--r--lisp/files.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 4bd708deed8..f481b9967c4 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6757,11 +6757,22 @@ be a predicate function; for example `yes-or-no-p'."
:group 'convenience
:version "21.1")
+(defcustom confirm-kill-processes t
+ "Non-nil if Emacs should confirm killing processes on exit.
+If this variable is nil, the value of
+`process-query-on-exit-flag' is ignored. Otherwise, if there are
+processes with a non-nil `process-query-on-exit-flag', Emacs will
+prompt the user before killing them."
+ :type 'boolean
+ :group 'convenience
+ :version "26.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 without asking.
If there are active processes where `process-query-on-exit-flag'
-returns non-nil, asks whether processes should be killed.
+returns non-nil and `confirm-kill-processes' is non-nil,
+asks whether processes should be killed.
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")
@@ -6776,6 +6787,7 @@ if any returns nil. If `confirm-kill-emacs' is non-nil, calls it."
(yes-or-no-p "Modified buffers exist; exit anyway? ")))
(or (not (fboundp 'process-list))
;; process-list is not defined on MSDOS.
+ (not confirm-kill-processes)
(let ((processes (process-list))
active)
(while processes