Suppose I try to use an undefined variable in MIT Scheme's REPL:
1 ]=> blablabla
;Unbound variable: blablabla
;To continue, call RESTART with an option number:
; (RESTART 3) => Specify a value to use instead of blablabla.
; (RESTART 2) => Define blablabla to a given value.
; (RESTART 1) => Return to read-eval-print level 1.
2 error>
This automatically brings me into the debugger. To exit the debugger, I have to type (restart 1)
. Is there an alternative way that does not involve typing 11 characters just to exit the debugger? It's a bit silly that all three options involve typing 11 characters.
According to Flux's answer, pressing CTRLC twice will work with mit-scheme
, but not when it runs within rlwrap
In order to make rlwrap
more "transparent" with regard to CTRLC and CTRLG
-W
(--polling
) option: rlwrap -W
will make rlwrap
wake up every 40 msecs to check whether the client has changed its terminal settings (in your case, its interrupt character).inputrc
:$if mit-scheme
"\C-c" rlwrap-direct-keypress
"\C-g" rlwrap-direct-keypress
$endif
Those lines will tell rlwrap
(when wrapping mit-scheme
) to pass on CTRLC and CTRLG even when in the middle of a line edit.
With those two tweaks, I can't tell the difference anymore in interrupt behaviour between rlwrapped and unwrapped mit-scheme
-W
needs rlwrap
>= 0.41, rlwrap-direct-keypress
>= 0.43
For a more in-depth explanation why this works (and why the options and .inputrc
entries are necessary) see this rlwrap issue on Github.