diff options
author | Philip Kaludercic <philipk@posteo.net> | 2022-07-31 14:27:28 +0200 |
---|---|---|
committer | Philip Kaludercic <philipk@posteo.net> | 2022-07-31 14:27:28 +0200 |
commit | 118033294136a8fb3a14347ce190b447dd2ff2fe (patch) | |
tree | 3d036aa53a16c1283883b0955cbed77be3295310 /lisp/emacs-lisp/debug-early.el | |
parent | edd73bd0d5474b71cbd4261c6a722be8f652bb9a (diff) | |
parent | ac237334c7672377721e4d27e8ecd6b09d453568 (diff) | |
download | emacs-118033294136a8fb3a14347ce190b447dd2ff2fe.tar.gz emacs-118033294136a8fb3a14347ce190b447dd2ff2fe.tar.bz2 emacs-118033294136a8fb3a14347ce190b447dd2ff2fe.zip |
Merge remote-tracking branch 'origin/master' into feature/package+vc
Diffstat (limited to 'lisp/emacs-lisp/debug-early.el')
-rw-r--r-- | lisp/emacs-lisp/debug-early.el | 50 |
1 files changed, 30 insertions, 20 deletions
diff --git a/lisp/emacs-lisp/debug-early.el b/lisp/emacs-lisp/debug-early.el index 85ed5f2176c..a301c73017e 100644 --- a/lisp/emacs-lisp/debug-early.el +++ b/lisp/emacs-lisp/debug-early.el @@ -35,30 +35,40 @@ (defalias 'debug-early-backtrace #'(lambda () - "Print a trace of Lisp function calls currently active. + "Print a trace of Lisp function calls currently active. The output stream used is the value of `standard-output'. This is a simplified version of the standard `backtrace' function, intended for use in debugging the early parts of the build process." - (princ "\n") - (mapbacktrace - #'(lambda (evald func args _flags) - (let ((args args)) - (if evald - (progn - (princ " ") - (prin1 func) - (princ "(")) - (progn - (princ " (") - (setq args (cons func args)))) - (if args - (while (progn - (prin1 (car args)) - (setq args (cdr args))) - (princ " "))) - (princ ")\n")))))) + (princ "\n") + (let ((print-escape-newlines t) + (print-escape-control-characters t) + (print-escape-nonascii t) + (prin1 (if (and (fboundp 'cl-prin1) + ;; If we're being called while + ;; bootstrapping, we won't be able to load + ;; cl-print. + (require 'cl-print nil t)) + #'cl-prin1 + #'prin1))) + (mapbacktrace + #'(lambda (evald func args _flags) + (let ((args args)) + (if evald + (progn + (princ " ") + (funcall prin1 func) + (princ "(")) + (progn + (princ " (") + (setq args (cons func args)))) + (if args + (while (progn + (funcall prin1 (car args)) + (setq args (cdr args))) + (princ " "))) + (princ ")\n"))))))) (defalias 'debug-early #'(lambda (&rest args) @@ -76,7 +86,7 @@ superseded by `debug' after enough Lisp has been loaded to support the latter, except in batch mode which always uses `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.)" (princ "\nError: ") (prin1 (car (car (cdr args)))) ; The error symbol. |