* Zach Kost-Smith [2012-06-10 14:17] writes:
However, when the user interrupt initiates from the Slime repl, this handler is bypassed entirely and my wrapper code isn't run. I don't know enough about the way Slime/Swank uses conditions to understand what is happening here. Does anybody know how I can successfully handle a user interrupt that is initiated from within Emacs, either via changing my code or hacking on Slime/Swank itself?
SLIME uses multiple threads and sb-thread:interrupt-thread to force them to invoke the debugger. Presumably SBCL signals sb-sys:interactive-interrupt only when it receives a SIGINT and only in the main thread. Pressing C-c C-c in the non-comint repl sends something on a socket but no SIGINT.
You could write your own Emacs command
(defun my-interrupt-command () (interactive) (let ((slime-current-thread t)) (slime-eval `(sb-thread:interrupt-thread (swank::find-worker-thread swank::*emacs-connection* :repl-thread) (cl:lambda () (cl:signal 'sb-sys:interactive-interrupt))))))
and bind it to C-c C-c.
Helmut