I'm working on a software project for Emacs that has some tests that can be run in batch mode for quick regression testing. However, when the tests fail, the stack traces in the terminal are cut off at the top, so I have to run the failing test again in an interactive Emacs session to view the full stack trance and find out where the error actually occurred. Is there some variable I can modify that will extend the maximum length of the stack traces that Emacs prints to the terminal in batch mode?
If you want a simple test case to produce a really deep stack trace that will get cut off, here's a trivial case of infinite recursion, which emacs will abort when it reaches a certain depth:
emacs -Q -batch --eval '(defun f () (f))' -f toggle-debug-on-error -f f
Here is the exact output of that command on my system:
Debug on Error enabled globally
...
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
f()
command-line-1(("--eval" "(defun f () (f))" "-f" "toggle-debug-on-error" "-f" "f"))
command-line()
normal-top-level()
In particular, note that the line after Debug on Error enabled globally
is actually an ellipsis in the output, there's no way to go any deeper into the stack trace without running interactively.
It looks like debugger-batch-max-lines
is what you're after:
M-x customize-group
RET debugger
RET
(defcustom debugger-batch-max-lines 40
"Maximum lines to show in debugger buffer in a noninteractive Emacs.
When the debugger is entered and Emacs is running in batch mode,
if the backtrace text has more than this many lines,
the middle is discarded, and just the beginning and end are displayed."
:type 'integer
:group 'debugger
:version "21.1")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With