diff options
author | Gemini Lasswell <gazally@runbox.com> | 2018-08-07 19:39:06 -0700 |
---|---|---|
committer | Gemini Lasswell <gazally@runbox.com> | 2018-08-27 10:43:57 -0700 |
commit | 674f276c0ab3e9759d33f37971ef87f84a3b0683 (patch) | |
tree | c7e0f9df4af624099d8d9372fd72fac200d67184 /lisp/emacs-lisp | |
parent | f2701917e28b2aca6d98d8214e5ef2ff648a11f8 (diff) | |
download | emacs-674f276c0ab3e9759d33f37971ef87f84a3b0683.tar.gz emacs-674f276c0ab3e9759d33f37971ef87f84a3b0683.tar.bz2 emacs-674f276c0ab3e9759d33f37971ef87f84a3b0683.zip |
Fix links in backtraces to work on advised built-ins (Bug#25393)
* lisp/emacs-lisp/backtrace.el (backtrace--print-func-and-args): Make
links to the original definition of advised functions. Handle the
case when the function slot of the backtrace frame contains the
definition of a built-in function.
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r-- | lisp/emacs-lisp/backtrace.el | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index f13b43b465c..e82d4f5a5a2 100644 --- a/lisp/emacs-lisp/backtrace.el +++ b/lisp/emacs-lisp/backtrace.el @@ -34,6 +34,7 @@ (eval-when-compile (require 'cl-lib)) (eval-when-compile (require 'pcase)) (eval-when-compile (require 'subr-x)) ; if-let +(require 'find-func) (require 'help-mode) ; Define `help-function-def' button type. (require 'lisp-mode) @@ -735,11 +736,11 @@ Format it according to VIEW." (evald (backtrace-frame-evald frame)) (fun (backtrace-frame-fun frame)) (args (backtrace-frame-args frame)) - (def (and (symbolp fun) (fboundp fun) (symbol-function fun))) + (def (find-function-advised-original fun)) (fun-file (or (symbol-file fun 'defun) - (and (subrp def) - (not (eq 'unevalled (cdr (subr-arity def)))) - (find-lisp-object-file-name fun def)))) + (and (subrp def) + (not (eq 'unevalled (cdr (subr-arity def)))) + (find-lisp-object-file-name fun def)))) (fun-pt (point))) (cond ((and evald (not debugger-stack-frame-as-list)) @@ -762,7 +763,8 @@ Format it according to VIEW." (insert (backtrace--print-to-string fun-and-args))) (cl-incf fun-pt))) (when fun-file - (make-text-button fun-pt (+ fun-pt (length (symbol-name fun))) + (make-text-button fun-pt (+ fun-pt + (length (backtrace--print-to-string fun))) :type 'help-function-def 'help-args (list fun fun-file))) ;; After any frame that uses eval-buffer, insert a comment that |