2

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. – AltruisticDelay Jun 30 at 10:44
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)
    (kill-buffer)))
| improve this answer | |
  • This unfortunately doesn't work in my case: ein:notebook-kill-buffer-query hook runs and causes an error down the road. – Leo Alekseyev Jul 1 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. – Gilles 'SO- stop being evil' Jul 1 at 10:49

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.