I am working on a software project for Emacs that has some tests that can be run in batch for quick regression testing. However, when tests fail, the stack traces in the terminal are truncated at the top, so I have to run the test again with an error in an Emacs interactive session in order to view the full trance of the stack and find out where the error occurred. Is there some kind of variable that I can change that extends the maximum length of stack traces that Emacs prints to the terminal in batch mode?
If you want a simple test case to create a really deep stack trace that will be trimmed, here is a trivial case of infinite recursion that emacs will break 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 this 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 globallyis actually an ellipsis in the output, so there is no way to delve into the stack trace without starting interactively.
source
share