debug-early: Print bytecode in a more manageable way
* lisp/emacs-lisp/debug-early.el (debug-early-backtrace): Escape newlines to and bytecodes to make backtraces slightly more readable. Use `cl-prin1` when available.
This commit is contained in:
parent
73088b30cf
commit
08108a856a
1 changed files with 24 additions and 20 deletions
|
@ -42,23 +42,27 @@ This is a simplified version of the standard `backtrace'
|
||||||
function, intended for use in debugging the early parts
|
function, intended for use in debugging the early parts
|
||||||
of the build process."
|
of the build process."
|
||||||
(princ "\n")
|
(princ "\n")
|
||||||
|
(let ((print-escape-newlines t)
|
||||||
|
(print-escape-control-characters t)
|
||||||
|
(print-escape-nonascii t)
|
||||||
|
(prin1 (if (fboundp 'cl-prin1) #'cl-prin1 #'prin1)))
|
||||||
(mapbacktrace
|
(mapbacktrace
|
||||||
#'(lambda (evald func args _flags)
|
#'(lambda (evald func args _flags)
|
||||||
(let ((args args))
|
(let ((args args))
|
||||||
(if evald
|
(if evald
|
||||||
(progn
|
(progn
|
||||||
(princ " ")
|
(princ " ")
|
||||||
(prin1 func)
|
(funcall prin1 func)
|
||||||
(princ "("))
|
(princ "("))
|
||||||
(progn
|
(progn
|
||||||
(princ " (")
|
(princ " (")
|
||||||
(setq args (cons func args))))
|
(setq args (cons func args))))
|
||||||
(if args
|
(if args
|
||||||
(while (progn
|
(while (progn
|
||||||
(prin1 (car args))
|
(funcall prin1 (car args))
|
||||||
(setq args (cdr args)))
|
(setq args (cdr args)))
|
||||||
(princ " ")))
|
(princ " ")))
|
||||||
(princ ")\n"))))))
|
(princ ")\n")))))))
|
||||||
|
|
||||||
(defalias 'debug-early
|
(defalias 'debug-early
|
||||||
#'(lambda (&rest args)
|
#'(lambda (&rest args)
|
||||||
|
@ -76,7 +80,7 @@ superseded by `debug' after enough Lisp has been loaded to
|
||||||
support the latter, except in batch mode which always uses
|
support the latter, except in batch mode which always uses
|
||||||
`debug-early'.
|
`debug-early'.
|
||||||
|
|
||||||
(In versions of Emacs prior to Emacs 29, no backtrace was
|
\(In versions of Emacs prior to Emacs 29, no backtrace was
|
||||||
available before `debug' was usable.)"
|
available before `debug' was usable.)"
|
||||||
(princ "\nError: ")
|
(princ "\nError: ")
|
||||||
(prin1 (car (car (cdr args)))) ; The error symbol.
|
(prin1 (car (car (cdr args)))) ; The error symbol.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue