In spite of all the advice that it is a bad idea, I still would like Emacs to stop asking me "Active processes exist; kill them and exit anyway" when I hit C-c C-x. I would like it to simply kill all active processes without asking.
How can I accomplish this?
More generally: You can use M-: (kill-process PROCESS) RET , where PROCESS "may be a process, a buffer, or the name of a process or buffer", with those names being as they appear in the output of list-processes .
If you started Emacs from a terminal, the parent process normally resumes control. The low-level primitive for killing Emacs is kill-emacs . This command calls the hook kill-emacs-hook , then exits the Emacs process and kills it.
This snippet (goes into your .emacs customization file) will temporarily make Emacs believes that there is no active process when you kill it, and therefore you won't get the annoying prompt.
(require 'cl-lib) (defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate) "Prevent annoying \"Active processes exist\" query when you quit Emacs." (cl-letf (((symbol-function #'process-list) (lambda ()))) ad-do-it))
You can accomplish this by setting query-on-exit flag for each process to nil. You can use a hook to do this automatically when executing a command interpreter:
(add-hook 'comint-exec-hook (lambda () (set-process-query-on-exit-flag (get-buffer-process (current-buffer)) nil)))
The next version of Emacs (25.3 or 26.1) will have a new customization option confirm-kill-processes
to make this simpler. You can then say M-x customize-variable RET confirm-kill-processes RET
and set the variable to nil
to suppress the confirmation prompt.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With