简体   繁体   English

使用 Emacs 和 SLIME 抑制 SBCL 中的调试器?

[英]Suppressing the Debugger in SBCL with Emacs and SLIME?

Putting in the following code into ~/.sbclrc allows me to receive a simplified error message without diving into the debugger (which I find a bit irritating) when using the SBCL REPL from the command line.将以下代码放入~/.sbclrc允许我在从命令行使用SBCL REPL 时接收简化的错误消息,而无需深入调试器(我觉得这有点烦人)。

 (defun print-condition-hook (condition hook)
  "Print this error message (condition) and abort the current operation."
  (declare (ignore hook))
  (princ condition)
  (clear-input)
  (abort))

(setf *debugger-hook* #'print-condition-hook)

When running the SBCL REPL from within Emacs and SLIME , which is my usual way of interacting with it, the REPL insists on diving into the debugger each time I have an error.当从EmacsSLIME运行 SBCL REPL 时,这是我通常与之交互的方式,每当我遇到错误时,REPL 都会坚持进入调试器。

How do I suppress the debugger, while still getting a simplified error message/condition, when working with SBCL from within Emacs and SLIME?在 Emacs 和 SLIME 中使用 SBCL 时,如何抑制调试器,同时仍然得到简化的错误消息/条件?

In SBCL, check sb-ext:*invoke-debugger-hook* in addition to cl:*debugger-hook* .在 SBCL 中,检查sb-ext:*invoke-debugger-hook*除了cl:*debugger-hook* SLIME and SLY use both of them, not just one. SLIME 和 SLY 两者都用,而不是只用一个。 Updating the former to use your function should give the behavior you want.更新前者以使用您的 function 应该会产生您想要的行为。

The debugger is one of the things that makes Common Lisp nice to use.调试器是让 Common Lisp 好用的原因之一。 I can understand turning it off in some limited situations, but it's hard to imagine turning it off all the time, by default.我可以理解在某些有限的情况下将其关闭,但很难想象默认情况下始终将其关闭。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM