]> git.eshelyaron.com Git - emacs.git/commitdiff
Bug#31671 band-aid
authorGemini Lasswell <gazally@runbox.com>
Wed, 21 Nov 2018 20:20:34 +0000 (12:20 -0800)
committerGemini Lasswell <gazally@runbox.com>
Fri, 23 Nov 2018 20:32:59 +0000 (12:32 -0800)
lisp/emacs-lisp/debug.el

index 7fc2b41c70c528a9a3e82292b41095b8ea51040a..4a0442e8c708b4eaa5787f665c99e1d6245048de 100644 (file)
@@ -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)