summaryrefslogtreecommitdiff
path: root/test/lisp/files-tests.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 /test/lisp/files-tests.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 'test/lisp/files-tests.el')
-rw-r--r--test/lisp/files-tests.el23
1 files changed, 23 insertions, 0 deletions
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