From b661efd90d9bd57430761b0e87fcc8723ec24814 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Tue, 27 Sep 2016 20:47:23 +0200 Subject: 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. --- test/lisp/files-tests.el | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'test/lisp/files-tests.el') diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 479848abb23..80d5e5befbc 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el @@ -197,5 +197,28 @@ form.") (setenv "FOO" foo-env) (setenv "BAR" bar-env)))) +(ert-deftest files-test--save-buffers-kill-emacs--confirm-kill-processes () + "Test that `save-buffers-kill-emacs' honors +`confirm-kill-processes'." + (cl-letf* ((yes-or-no-p-prompts nil) + ((symbol-function #'yes-or-no-p) + (lambda (prompt) + (push prompt yes-or-no-p-prompts) + nil)) + (kill-emacs-args nil) + ((symbol-function #'kill-emacs) + (lambda (&optional arg) (push arg kill-emacs-args))) + (process + (make-process + :name "sleep" + :command (list + (expand-file-name invocation-name invocation-directory) + "-batch" "-Q" "-eval" "(sleep-for 1000)"))) + (confirm-kill-processes nil)) + (save-buffers-kill-emacs) + (kill-process process) + (should-not yes-or-no-p-prompts) + (should (equal kill-emacs-args '(nil))))) + (provide 'files-tests) ;;; files-tests.el ends here -- cgit v1.2.1