在 MIT Scheme 的 REPL 中是否有一种快速退出调试器的方法? [英] Is there a fast way to exit the debugger in MIT Scheme's REPL?

查看:52
本文介绍了在 MIT Scheme 的 REPL 中是否有一种快速退出调试器的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我尝试在 MIT Scheme 的 REPL 中使用一个未定义的变量:

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> 

这会自动将我带入调试器.要退出调试器,我必须键入 (restart 1).是否有一种替代方法不涉及仅输入 11 个字符即可退出调试器?这三个选项都需要输入 11 个字符,这有点傻.

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.

推荐答案

根据 Flux 的回答,按 CTRLC 两次将与 mit-scheme,但 不是,当它在 rlwrap

According to Flux's answer, pressing CTRLC twice will work with mit-scheme, but not when it runs within rlwrap

为了使 rlwrap 更加透明"关于 CTRLCCTRLG

In order to make rlwrap more "transparent" with regard to CTRLC and CTRLG

  • 使用 -W (--polling) 选项:rlwrap -W 将使 rlwrap 唤醒每 40 毫秒检查一次客户端是否已更改其终端设置(在您的情况下,它的 中断符)
  • 在您的 .inputrc 中添加几行:
  • Use the -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)
  • Add a few lines to your .inputrc:
$if mit-scheme
  "\C-c" rlwrap-direct-keypress
  "\C-g" rlwrap-direct-keypress
$endif

那些行会告诉 rlwrap(当包装 mit-scheme 时)传递 CTRLCCTRLG 即使在行编辑的中间.

Those lines will tell rlwrap (when wrapping mit-scheme) to pass on CTRLC and CTRLG even when in the middle of a line edit.

通过这两个调整,我无法区分 rlwrapped 和 unwrapped mit-scheme

With those two tweaks, I can't tell the difference anymore in interrupt behaviour between rlwrapped and unwrapped mit-scheme

-W 需要 rlwrap >= 0.41, rlwrap-direct-keypress >= 0.43

-W needs rlwrap >= 0.41, rlwrap-direct-keypress >= 0.43

要更深入地解释为什么这是有效的(以及为什么需要选项和 .inputrc 条目),请参阅 这个 rlwrap 问题在 Github 上.

For a more in-depth explanation why this works (and why the options and .inputrc entries are necessary) see this rlwrap issue on Github.

这篇关于在 MIT Scheme 的 REPL 中是否有一种快速退出调试器的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆