Subject: Alternative to ert-with-temp-file/ert-with-temp-directory

From: Stefan Kangas <[email-masked]>
Date: Mon, 24 Feb 2025 20:10:17 +0000

Severity: wishlist

I'm happy that the ert-with-temp-file and ert-with-temp-directory have
proven useful enough to now be documented in the ERT manual.  However,
I've actually not been to happy with them when they are used for more
than one file or directory, because it leads to deep and ugly nesting.

Before we release Emacs 31 with them, making them in effect
non-experimental by documenting them, I would like to replace them with
something better.  However, before I start writing up the code, do we
have any good ideas what a better interface should look like?

Consider creating two files and a directory, which currently looks like:

    (ert-with-temp-file elfile
      :suffix ".el"
      (ert-with-temp-file elcfile
        :suffix ".elc"
        (ert-with-temp-directory dir
          :suffix "suf"
          ...)))

The best I could come up with to replace it is this:

    (ert-with-temp-files ((elfile :suffix ".el")
                          (elcfile :suffix ".elc")
                          (dir :suffix "suf"))
      ...)

Thoughts or better ideas?  Thanks!