Here is a proposed patch that unifies the two print-backtrace-and-quit cases (batch mode and the failsafe). The patch is large mostly because of required reindenting, in fact only 15-20 lines are changed. I tested that it works as expected in batch mode, but don't know how to test the failsafe, I never did this. Please test yourself. I also verified that it doesn't change the normal (interactive) backtrace. How I tested in batch mode: $ emacs --batch --eval "(let ((debug-on-error t)) (require 'registry) (defun bar () (bar)) (defun foo (x) (bar)) (foo (registry-db)))" - must use `cl-prin1' for the dummy registry object; - must properly cut out the middle from the intentionally very long backtrace. I don't have access to Emacs repository, so I cannot apply it myself. I can only write emails and hope that someone applies the patches or otherwise does something about the problem. Paul On Sun, 5 Jan 2020 at 00:31, Stefan Monnier wrote: > > > noninteractive)" condition. In the patch I didn't try to unify your > > "failsafe" mode with non-interactive use, since I don't really know > > what you wrote the commit for. > > The commit was specifically prompted by the case mentioned in the comment: > > ;; This happens for example while handling an error in code from > ;; early-init.el with --debug-init. > > I can't remember the exact previous behavior, but it was not right (you > got neither a good *backtrace* because the GUI wasn't up, nor a clean > stacktrace on stdout/stderr). > > > Stefan >