aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGemini Lasswell2018-08-07 19:39:06 -0700
committerGemini Lasswell2018-08-27 10:43:57 -0700
commit674f276c0ab3e9759d33f37971ef87f84a3b0683 (patch)
treec7e0f9df4af624099d8d9372fd72fac200d67184
parentf2701917e28b2aca6d98d8214e5ef2ff648a11f8 (diff)
downloademacs-674f276c0ab3e9759d33f37971ef87f84a3b0683.tar.gz
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.
-rw-r--r--lisp/emacs-lisp/backtrace.el12
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 @@
34(eval-when-compile (require 'cl-lib)) 34(eval-when-compile (require 'cl-lib))
35(eval-when-compile (require 'pcase)) 35(eval-when-compile (require 'pcase))
36(eval-when-compile (require 'subr-x)) ; if-let 36(eval-when-compile (require 'subr-x)) ; if-let
37(require 'find-func)
37(require 'help-mode) ; Define `help-function-def' button type. 38(require 'help-mode) ; Define `help-function-def' button type.
38(require 'lisp-mode) 39(require 'lisp-mode)
39 40
@@ -735,11 +736,11 @@ Format it according to VIEW."
735 (evald (backtrace-frame-evald frame)) 736 (evald (backtrace-frame-evald frame))
736 (fun (backtrace-frame-fun frame)) 737 (fun (backtrace-frame-fun frame))
737 (args (backtrace-frame-args frame)) 738 (args (backtrace-frame-args frame))
738 (def (and (symbolp fun) (fboundp fun) (symbol-function fun))) 739 (def (find-function-advised-original fun))
739 (fun-file (or (symbol-file fun 'defun) 740 (fun-file (or (symbol-file fun 'defun)
740 (and (subrp def) 741 (and (subrp def)
741 (not (eq 'unevalled (cdr (subr-arity def)))) 742 (not (eq 'unevalled (cdr (subr-arity def))))
742 (find-lisp-object-file-name fun def)))) 743 (find-lisp-object-file-name fun def))))
743 (fun-pt (point))) 744 (fun-pt (point)))
744 (cond 745 (cond
745 ((and evald (not debugger-stack-frame-as-list)) 746 ((and evald (not debugger-stack-frame-as-list))
@@ -762,7 +763,8 @@ Format it according to VIEW."
762 (insert (backtrace--print-to-string fun-and-args))) 763 (insert (backtrace--print-to-string fun-and-args)))
763 (cl-incf fun-pt))) 764 (cl-incf fun-pt)))
764 (when fun-file 765 (when fun-file
765 (make-text-button fun-pt (+ fun-pt (length (symbol-name fun))) 766 (make-text-button fun-pt (+ fun-pt
767 (length (backtrace--print-to-string fun)))
766 :type 'help-function-def 768 :type 'help-function-def
767 'help-args (list fun fun-file))) 769 'help-args (list fun fun-file)))
768 ;; After any frame that uses eval-buffer, insert a comment that 770 ;; After any frame that uses eval-buffer, insert a comment that