如何以编程方式触发或使用edebug进行检测?

时间:2013-09-02 14:32:28

标签: debugging emacs elisp

C-u C-M-x使用edebug检测评估defun表单。我能以编程方式执行此操作吗?我想这样做,因为我想写一个以下形式的elisp文件:

;;; define a function with edebug instrumented.
...


;;; do something that invokes the function with particular arguments.
...

然后我可以在该elisp文件上运行emacs -q --load,逐步执行代码,了解有关错误的进一步调查,在我原来的emacs会话中编辑elisp文件,再次运行emacs -q --load ,并重复。

1 个答案:

答案 0 :(得分:3)

~/test.el

(defun square (x)
  (* x x))

~/testtest.el

(with-current-buffer (find-file-noselect "~/test.el")
  (re-search-forward "square")  
  (edebug-defun))
(square 5)

bash

emacs -q -l ~/testtest.el