Subject: Re: bug#51037: [PATCH] Make `print-level` & `print-length` customizable in ERT batch tests

From: Filipp Gunbin <[email-masked]>
Date: Wed, 17 Nov 2021 19:22:08 +0300

On 16/11/2021 08:48 +0100, Lars Ingebrigtsen wrote:

> Michael <[email-masked]> writes:
>
>> New patch attached. Incorporates (I hope) these changes, as well
>> as addresses Eli's issues.
>
> Thanks; applied to Emacs 29 with some minor changes.
>
> -- 
> (domestic pets only, the antidote for overdose, milk.)
>    bloggy blog: http://lars.ingebrigtsen.no

I've got this fixup patch for this, below.

Mainly this fixes `ert' interactive spec, where there was a leftover
second argument, nil.

However I'm not quite sure in this docstring fix:

-mode.  A value of nil will short-circuit this mechanism; line
-lengths will be completely determined by `ert-batch-line-length'
-and `ert-batch-line-level'.  Any other value will be temporarily

The docstring for backtrace-line-length says: "If set to nil or zero,
backtrace mode will not abbreviate the forms it prints."  So the above
sentence, which I removed, was indeed not true?  (a quick look over
its usages confirmed that to me, but I'd like someone else to check)

Thanks.

diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index 36b4408dc8..7f9b7b22c7 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -101,12 +101,10 @@ ert-batch-backtrace-line-length
 forming them.  This variable governs the target maximum line
 length by manipulating these two variables while printing stack
 traces.  Setting this variable to t will re-use the value of
-`backtrace-line-length' while print stack traces in ERT batch
-mode.  A value of nil will short-circuit this mechanism; line
-lengths will be completely determined by `ert-batch-line-length'
-and `ert-batch-line-level'.  Any other value will be temporarily
-bound to `backtrace-line-length' when producing stack traces
-in batch mode.")
+`backtrace-line-length' while printing stack traces in ERT batch
+mode.  Any other value will be temporarily bound to
+`backtrace-line-length' when producing stack traces in batch
+mode.")
 
 (defface ert-test-result-expected '((((class color) (background light))
                                      :background "green1")
@@ -1447,8 +1445,6 @@ ert-run-tests-batch
                         (cond
                          ((eq ert-batch-backtrace-line-length t)
                           backtrace-line-length)
-                         ((eq ert-batch-backtrace-line-length nil)
-                          nil)
                          (t
                           ert-batch-backtrace-line-length)))
                        (print-level ert-batch-print-level)
@@ -2055,8 +2051,7 @@ ert-run-tests-interactively
            (read
             (completing-read (format-prompt "Run tests" default)
                              obarray #'ert-test-boundp nil nil
-                             'ert--selector-history default nil)))
-         nil))
+                             'ert--selector-history default nil)))))
   (let (buffer listener)
     (setq listener
           (lambda (event-type &rest event-args)