17

I have C-x C-k bound to kill-this-buffer. But when I enter into a buffer which is running a process like Python or MySQL, if I do C-x C-k it asks

Buffer "*Python*" has a running process; kill it (y or n)?

How can I kill process buffers without confirmation?

17

Remove the corresponding function from the relevant variable :

(setq kill-buffer-query-functions (delq 'process-kill-buffer-query-function kill-buffer-query-functions))

How did I find this ?

kill-this-buffer uses kill-buffer internally, which references the variable kill-buffer-query-functions.

  • I put this line into my startup file and no errors are shown in the message buffer. When I have a scheme process running (started with run-scheme) when exiting still a dialog pops up and asks "Active processes exist; kill them and exit anyway?". – user905686 Aug 24 '16 at 10:32
  • @user905686 That's a question asked by save-buffers-kill-emacs and unrelated to killing the buffers. – YoungFrog Aug 24 '16 at 11:48
  • Now I see that it works for just killing a buffer. I thought exiting emacs would try to kill the buffers and that therefore the confirmation dialog has the same origin. I asked a new question: Exiting emacs without confirmation to kill running processes. – user905686 Aug 25 '16 at 9:43
4

Or the simpler one would be :

(setq kill-buffer-query-functions nil)

Inspired from abo-abo config

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.