diff options
Diffstat (limited to 'lisp')
-rw-r--r-- | lisp/emacs-lisp/backtrace.el | 12 | ||||
-rw-r--r-- | lisp/subr.el | 19 |
2 files changed, 8 insertions, 23 deletions
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index 5169c305035..d162983c017 100644 --- a/lisp/emacs-lisp/backtrace.el +++ b/lisp/emacs-lisp/backtrace.el @@ -891,14 +891,18 @@ followed by `backtrace-print-frame', once for each stack frame." ;;; Backtrace printing -(defun backtrace-backtrace () +;;;###autoload +(defun backtrace () "Print a trace of Lisp function calls currently active. Output stream used is value of `standard-output'." - (princ (backtrace-to-string (backtrace-get-frames 'backtrace-backtrace)))) + (princ (backtrace-to-string (backtrace-get-frames 'backtrace))) + nil) -(defun backtrace-to-string(frames) +(defun backtrace-to-string(&optional frames) "Format FRAMES, a list of `backtrace-frame' objects, for output. -Return the result as a string." +Return the result as a string. If FRAMES is nil, use all +function calls currently active." + (unless frames (setq frames (backtrace-get-frames 'backtrace-to-string))) (let ((backtrace-fontify nil)) (with-temp-buffer (backtrace-mode) diff --git a/lisp/subr.el b/lisp/subr.el index f8c19efc379..fbb3e49a35c 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4687,25 +4687,6 @@ The properties used on SYMBOL are `composefunc', `sendfunc', (put symbol 'hookvar (or hookvar 'mail-send-hook))) -(defun backtrace--print-frame (evald func args flags) - "Print a trace of a single stack frame to `standard-output'. -EVALD, FUNC, ARGS, FLAGS are as in `mapbacktrace'." - (princ (if (plist-get flags :debug-on-exit) "* " " ")) - (cond - ((and evald (not debugger-stack-frame-as-list)) - (cl-prin1 func) - (if args (cl-prin1 args) (princ "()"))) - (t - (cl-prin1 (cons func args)))) - (princ "\n")) - -(defun backtrace () - "Print a trace of Lisp function calls currently active. -Output stream used is value of `standard-output'." - (let ((print-level (or print-level 8)) - (print-escape-control-characters t)) - (mapbacktrace #'backtrace--print-frame 'backtrace))) - (defun backtrace-frames (&optional base) "Collect all frames of current backtrace into a list. If non-nil, BASE should be a function, and frames before its |