I am getting the following message when I do C-x C-c to exit Emacs:

error in process sentinel: Selecting deleted buffer

So instead of exiting Emacs like normal, I am forced to close it through Task Manager.

An Internet search and some testing shows that it might be because of package prelude or flycheck but I have not installed it.

Q: How to find which package is causing this error and remove it? How can I debug this error?

  • 1
    Try checking which processes are running with M-x list-processes.
    – nanny
    Nov 26, 2014 at 14:10
  • @nanny Its not showing any processes.
    – Anusha
    Nov 26, 2014 at 15:30
  • 2
    A sentinel is a function that is associated to an asynchronous process and gets called in response to state changes in that process. You need to identifying the async process or the sentinel. Does toggle-debug-on-error give you any traceback?
    – dfeich
    Nov 26, 2014 at 23:12
  • @dfeich Yes. smeargle-highlight.
    – Anusha
    Nov 26, 2014 at 23:15
  • @dfeich Thanks a lot. I can do without this package till there is some indication of why this error was coming. Is there a tutorial to debug errors in emacs. Didnt know command you mentioned. If you could give some pointers on that in the answer, it would be very helpful. Thanks.
    – Anusha
    Nov 26, 2014 at 23:24

1 Answer 1


It seems that Emacs starts killing buffers before it has asked the user all the questions it might have to ask to avoid losing data. So it kills a buffer which happens to be the buffer which some process outputs to. (I think it shouldn't do that until after having terminated the respective process, and maybe it normally does and there are unusual circumstances causing Emacs to do it to early here).

Then it kills the process because process-query-on-exit-flag returns nil. Because that changes the state of the process its sentinel is run. And finally we are at the bug: the sentinel should use (when (buffer-live-p (process-buffer process) ...) but doesn't. Please file that as a bug.

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.