Reputation: 10940
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.
Upvotes: 1
Views: 280
Reputation: 5678
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.
Upvotes: 1
Reputation: 10940
According to the MIT Scheme user manual's section about interrupting the REPL:
- C-c C-c
- C-g
Abort whatever Scheme evaluation is currently running and return to the top-level REPL. If no evaluation is running, this is equivalent to evaluating
(cmdl-interrupt/abort-top-level)
So there are two ways to quickly exit the debugger:
CtrlcCtrlc — Unfortunately, this method is unsuitable when using MIT Scheme with rlwrap (i.e. rlwrap mit-scheme
). When in the debugger, rlwrap
somehow causes the second Ctrlc to be ignored.
Ctrlg — This works well with rlwrap, and requires less key presses than the above.
Upvotes: 0