1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-03 18:41:25 -08:00

Restore some public debugging functions removed in Emacs 27

* lisp/emacs-lisp/backtrace.el (backtrace--to-string): New function.
(backtrace-to-string): Use it.  Fix whitespace (bug#40728).
* lisp/emacs-lisp/debug.el (debugger-insert-backtrace): New function.
Mark it as obsolete.
(debugger-toggle-locals, debug-help-follow): New aliases.
This commit is contained in:
Gemini Lasswell 2020-10-01 19:59:58 +02:00 committed by Lars Ingebrigtsen
parent 08bda922b4
commit 4997032c05
2 changed files with 22 additions and 4 deletions

View file

@ -922,11 +922,15 @@ Output stream used is value of `standard-output'."
(princ (backtrace-to-string (backtrace-get-frames 'backtrace)))
nil)
(defun backtrace-to-string(&optional frames)
(defun backtrace-to-string (&optional frames)
"Format FRAMES, a list of `backtrace-frame' objects, for output.
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)))
(substring-no-properties
(backtrace--to-string
(or frames (backtrace-get-frames 'backtrace-to-string)))))
(defun backtrace--to-string (frames)
(let ((backtrace-fontify nil))
(with-temp-buffer
(backtrace-mode)
@ -934,8 +938,7 @@ function calls currently active."
backtrace-frames frames
backtrace-print-function #'cl-prin1)
(backtrace-print)
(substring-no-properties (filter-buffer-substring (point-min)
(point-max))))))
(filter-buffer-substring (point-min) (point-max)))))
(provide 'backtrace)