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-linesis what you’re after:M-x
customize-groupRETdebuggerRET