如何取消`edebug-defun`?


13

我如何撤消的影响edebug-defun?换句话说,edebug当调用特定功能时,如何取消导致进入调试模式的指令?

另外,我真的很想知道这个问题的答案在文档中。我所寻找的时间比人们认为必要的时间长得多...

Answers:


16

来自(info "(elisp) Instrumenting")

   To remove instrumentation from a definition, simply re-evaluate its
definition in a way that does not instrument.  There are two ways of
evaluating forms that never instrument them: from a file with `load',
and from the minibuffer with `eval-expression' (`M-:').

IOW,最简单的方法是C-M-x不带前缀参数(如果已edebug-all-defs设置,则带前缀参数)。


谢谢!在看到答案之后,我现在绝对可以确定,找到答案的唯一方法就是对所有Emacs和Elisp文档进行线性搜索。
kjo

FWIW我希望有一种简便的方法可以一次从所有定义中删除检测(即使分散在多个文件中),但是我不知道。
YoungFrog

@kjo我是通过在elisp手册中打开edebug部分并浏览这些部分来找到它的。知道“ edebug-defun的效果”被称为“工具化”无疑会有所帮助。
YoungFrog 2016年

2
@kjo此外,如果您M-x report-emacs-bug通过说出在寻找答案时实际尝试的内容来报告错误(),则可以改进文档。
YoungFrog

9

换句话说,当调用特定功能时,如何取消导致edebug进入调试模式的指令?

通过设置edebug-initial-mode为,可以在不删除检测的情况下获得此效果go。这样,只有设置了断点,您才会在edebug中停止。从Emacs 25.1开始,您可以使用以下命令快速完成此操作edebug-set-initial-modeC-x C-a C-m g

(info "(elisp) Edebug Execution Modes")

‘g’
     Go: run until the next breakpoint (‘edebug-go-mode’).  *Note
     Breakpoints::.

[...]

When you enter a new Edebug level, the initial execution mode comes
from the value of the variable ‘edebug-initial-mode’ (*note Edebug
Options::).  By default, this specifies step mode.

[...]

Command: edebug-set-initial-mode

This command, bound to C-x C-a C-m, sets edebug-initial-mode. It
prompts you for a key to indicate the mode. You should enter one of
the eight keys listed above, which sets the corresponding mode.
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.