tags:

views:

209

answers:

3

Hello,

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?

Thanks,

  • a
+2  A: 

You can't without hacking. If you are feeling adventurous, replace definition of save-buffers-kill-emacs in your .emacs so that it doesn't ask (but don't forget to repeat procedure each time you upgrade Emacs afterwards). Standard defition of that function asks without any ways to customize that behavior.

EDIT:

Alternatively, you could redefine yes-or-no-p like this (untested):

(defadvise yes-or-no-p (around hack-exit (prompt))
   (if (string= prompt "Active processes exist; kill them and exit anyway? ")
       t
      ad-do-it))
doublep
+5  A: 

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.

(defadvice save-buffers-kill-emacs (around no-query-kill-emacs activate)
  "Prevent annoying \"Active processes exist\" query when you quit Emacs."
  (flet ((process-list ())) ad-do-it))
polyglot
Totally sweet, thanks!!!
Adam
+5  A: 

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 () (process-kill-without-query (get-buffer-process (current-buffer)))))
Jürgen Hötzel
Note that the docs say (regarding process-kill-without-query) "This function is obsolete since 22.1" and recommend using set-process-query-on-exit-flag instead.
Sean