Move 'backtrace' from subr.el to backtrace.el

* lisp/subr.el (backtrace, backtrace--print-frame): Remove functions.
* lisp/emacs-lisp/backtrace.el (backtrace-backtrace): Remove function.
(backtrace): New function.
(backtrace-to-string): Make argument optional.
* doc/lispref/debugging.texi (Internals of Debugger): Update
description of 'backtrace' function.
This commit is contained in:
Gemini Lasswell 2018-07-18 08:30:45 -07:00
parent ca98377280
commit 83af893fc0
3 changed files with 17 additions and 33 deletions

View file

@ -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)