edebug-trace不复存在

时间:2017-05-29 08:57:19

标签: debugging emacs

在Emacs 25.2中,突然变量edebug-trace不复存在。当我用setq设置它时,它没有效果(跟踪缓冲区没有出现)。可能发生了什么,我该如何解决?

1 个答案:

答案 0 :(得分:1)

  

同时,当我点击组织模式链接时,还有另一种方法可以知道调用哪个函数

您可以使用trace.el跟踪所有org函数(我建议您在准备点击链接之前不要对此进行评估)。

(mapatoms
 (lambda (sym)
   (and (fboundp sym)
        (string-prefix-p "org-" (symbol-name sym))
        (trace-function-foreground sym))))

之后,您可以使用以下命令删除跟踪:

M-x untrace-all RET

编辑:我们也可以将其转换为命令ala elp-instrument-package

(defun my-trace-package (prefix)
  "Trace all functions which start with PREFIX.
For example, to trace all ELP functions, do the following:

\\[my-trace-package] RET elp- RET"
  (interactive ;; derived from `elp-instrument-package'.
   (list (completing-read "Prefix of package to trace: "
                          obarray 'my-traceable-p)))
  (if (zerop (length prefix))
      (error "Tracing all Emacs functions would render Emacs unusable"))
  (mapc (lambda (name)
          (trace-function-foreground (intern name)))
        (all-completions prefix obarray 'my-traceable-p))
  (message "Use %s to cease tracing."
           (substitute-command-keys "\\[untrace-all]")))

(defun my-traceable-p (fun)
  "Predicate for `my-trace-package'."
  (or (functionp fun) (macrop fun)))