2

Whenever I kill an ansi-term buffer I have to confirm due to the fact of: "ansi-term has a running process; kill it ?", (even if nothing is running btw).

How could I have Emacs killing the term without requiring this confirmation regardless of active processes.

Thanks !

1
  • 3
    Assuming you're running a shell in the terminal, the "running process" is the shell itself. If you exit your shell (typically C-d or exit) before killing the ansi-term buffer, it will not ask you this question.
    – phils
    Sep 30, 2015 at 1:41

1 Answer 1

5

Try something like this:

(defun set-no-process-query-on-exit ()
  (let ((proc (get-buffer-process (current-buffer))))
    (when (processp proc)
      (set-process-query-on-exit-flag proc nil))))

(add-hook 'term-exec-hook 'set-no-process-query-on-exit)
2
  • You're awesome. It works !
    – wizmer
    Sep 30, 2015 at 2:30
  • this is really cool and works for eshell, ansi-term, term etc but strangley not for 'shell'. any clue why?
    – zeltak
    Jul 1, 2016 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.