This question already has an answer here:

Sometimes Lisp hangs due to an infinite loop, making the whole of Emacs unresponsive, so it can't process any input, C-g included. So, I was hoping for there to be a way to maybe send it an emergency call from the outside, which would interrupt the Lisp interpreter, but would not kill Emacs altogether. I've experimented with sending some signals by means of kill -s <signal>, but Emacs seems to quit no matter what signal it is.

marked as duplicate by Gilles Apr 21 '16 at 9:55

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


It's possible to unconditionally enter the debugger by sending the value of debug-on-event (should be USR2 by default) as signal as documented in the Error Debugging section in the Emacs Lisp manual.

I found this rather useless to be honest since it just gave me a way to inspect a backtrace, not to unfreeze Emacs. YMMV obviously. As noted in the comments the other issue with this is that it won't work on Windows systems since those use neither kill nor signals for process communication.

  • It will only invoke debugger if there's some code executing, right? (I've tried sending it when Emacs is idle, and nothing happened, but Emacs didn't quit, so it's a plus). It is also useful to note that you need to check the value of debug-on-event, since for me this was USR2. I think that as long as I could drop into debugger I could either change the loop iterator variable or to throw to exit iteration... well, I'll check the next time this happens. Thanks though, much appreciated! – wvxvw Jan 20 '15 at 13:57
  • Right, fixed that. – wasamasa Jan 20 '15 at 15:18
  • 1
    As a note, this will not work on Windows (no kill command and does not use signals for communcation). – Jonathan Leech-Pepin Jan 20 '15 at 15:21

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