From: "Mattias Engdegård" <mattiase@acm.org>
To: 50738@debbugs.gnu.org
Subject: bug#50738: `ert-deftest` bodies should not use lexical-binding=nil
Date: Wed, 22 Sep 2021 13:13:58 +0200 [thread overview]
Message-ID: <8620C815-C0FC-4C81-A1A0-1F0AFBD603AD@acm.org> (raw)
Contrary to the expectations of everybody, the body of `ert-deftest` is always run with `lexical-binding` bound to nil regardless of what the file uses. This bug keeps causing trouble and it's high time we did something about it.
The technical reason for this snag is that the body is evaluated inside a `with-temp-buffer` clause (see `ert--run-test-internal`). Some options, ordered in roughly decreasing order of desirability (subjective):
1. Make with-temp-buffer use the current value of lexical-binding for the temporary buffer, instead of always using nil.
2. Make ert-deftest bodies use lexical-binding=t.
3. Make ert-deftest bodies use the file value of lexical-binding.
Although the last option looks sensible at first glance it's a bit messy in practice because of how ERT works (the value of lexical-binding needs to be threaded through various data structures) and shouldn't we migrate to lexical-binding anyway?
next reply other threads:[~2021-09-22 11:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-22 11:13 Mattias Engdegård [this message]
2021-09-22 14:26 ` bug#50738: `ert-deftest` bodies should not use lexical-binding=nil Mattias Engdegård
2021-09-22 20:33 ` Lars Ingebrigtsen
2021-09-23 5:50 ` Eli Zaretskii
2021-09-25 18:33 ` Mattias Engdegård
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=8620C815-C0FC-4C81-A1A0-1F0AFBD603AD@acm.org \
--to=mattiase@acm.org \
--cc=50738@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.