From: Gemini Lasswell Date: Wed, 21 Nov 2018 20:20:34 +0000 (-0800) Subject: Bug#31671 band-aid X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b2f0a4e86c6d13977ec2d57e4c282c7c849905cb;p=emacs.git Bug#31671 band-aid --- diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 7fc2b41c70c..4a0442e8c70 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -169,14 +169,28 @@ first will be printed into the backtrace buffer." (inhibit-redisplay ;; Don't really try to enter debugger within an eval from redisplay. debugger-value) - ((and (eq t (framep (selected-frame))) - (equal "initial_terminal" (terminal-name))) + ((or (and (eq t (framep (selected-frame))) + (equal "initial_terminal" (terminal-name))) + (and (bound-and-true-p main-thread) + (not (eq main-thread (current-thread))))) + ;; Either: ;; We're in the initial-frame (where `message' just outputs to stdout) so ;; there's no tty or GUI frame to display the backtrace and interact with - ;; it: just dump a backtrace to stdout. + ;; it. + ;; ;; This happens for example while handling an error in code from ;; early-init.el with --debug-init. + ;; + ;; Or: + ;; We're in a non-main thread, in which keyboard interaction is currently + ;; not implemented. + ;; + ;; So: + ;; Just dump a backtrace to stdout/Messages. (message "Error: %S" args) + (when (and (bound-and-true-p main-thread) + (not (eq main-thread (current-thread)))) + (message "Thread: %s" (current-thread))) (let ((print-escape-newlines t) (print-escape-control-characters t) (print-level 8)