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 !

  • 2
    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 '15 at 1:41
4

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)
  • You're awesome. It works ! – wizmer Sep 30 '15 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 '16 at 16:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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