[slime-devel] Handling Slime interrupts

Zach Kost-Smith zachkostsmith at gmail.com
Sun Jun 10 14:17:37 UTC 2012


Is there a way to handle a Slime initiated user interrupt.

For context: I am writing a shell interaction library and would like to
intercept user interrupts in order to call sigstop and, possibly,
subsequently call sigcont or sigkill to pause, unpause, or kill the shell
process.  From the command line (i.e. without Slime) or the inferior lisp
process comint buffer, I can handle the condition
sb-sys:interactive-interrupt in SBCL and get results along the lines I
would like:

> * (handler-case (loop :while t :do (sleep 1))
(sb-sys:interactive-interrupt (cond) (print "test") (error cond)))
>
> ;; User inputs C-c
>
> "test" ;; <- My code is run
> debugger invoked on a SB-SYS:INTERACTIVE-INTERRUPT in thread #<THREAD
>                                                                "initial
thread" RUNNING
>
{1002940EE1}>:
>   Interactive interrupt at #x7FFFF79CA350.
>
> Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.
>
> restarts (invokable by number or by possibly-abbreviated name):
>   0: [ABORT] Exit debugger, returning to top level.
>
> (#:EVAL-THUNK)
> 0]

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?

Zach KS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/slime-devel/attachments/20120610/b40edd75/attachment.html>


More information about the slime-devel mailing list