I have a buffer (belonging to ein mode that got into a bad state) that throws an elisp error every time I try to kill it (using ibuffer, M-x kill-this-buffer, etc.)

Backtrace suggests that the buffer is trying to run some elisp that is failing. Is it possible to just kill that buffer without running any hooks?

  • maybe you can try to set kill-buffer-hook, which is buffer-local to nil. Don't know if this will solve the problem. Commented Jun 30, 2020 at 10:44

1 Answer 1


I think you have to write a tiny bit of Lisp. Type the following into M-: (M-x eval-expression). You don't need line breaks, they're just for readability.

(with-current-buffer "name of buffer"
  (let (kill-buffer-hook kill-buffer-query-functions)
  • This unfortunately doesn't work in my case: ein:notebook-kill-buffer-query hook runs and causes an error down the road. Commented Jul 1, 2020 at 9:52
  • @LeoAlekseyev I think I see the problem: the hooks are local, and kill-buffer implicitly switches to the buffer that it's about to be killed. My new version should work. Commented Jul 1, 2020 at 10:49

Your Answer

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

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