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.
Asked
Active
Viewed 425 times
6

Gilles 'SO- stop being evil'
- 22,318
- 4
- 56
- 92

wvxvw
- 11,342
- 2
- 31
- 56
1 Answers
4
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.

wasamasa
- 22,178
- 1
- 66
- 99
debug-on-event
, since for me this wasUSR2
. 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:57kill
command and does not usesignals
for communcation). – Jonathan Leech-Pepin Jan 20 '15 at 15:21