From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#50738: `ert-deftest` bodies should not use lexical-binding=nil Date: Wed, 22 Sep 2021 13:13:58 +0200 Message-ID: <8620C815-C0FC-4C81-A1A0-1F0AFBD603AD@acm.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.21\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37249"; mail-complaints-to="usenet@ciao.gmane.io" To: 50738@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Sep 22 13:15:20 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mT0Df-0009TI-9m for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Sep 2021 13:15:19 +0200 Original-Received: from localhost ([::1]:47340 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mT0Dd-0001JS-8y for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 22 Sep 2021 07:15:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mT0DP-0001JJ-DH for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 07:15:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:37436) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mT0DO-0000qp-RZ for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 07:15:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mT0DO-0000na-Je for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 07:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 22 Sep 2021 11:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 50738 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16323092542988 (code B ref -1); Wed, 22 Sep 2021 11:15:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 22 Sep 2021 11:14:14 +0000 Original-Received: from localhost ([127.0.0.1]:48982 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mT0Cc-0000m7-3k for submit@debbugs.gnu.org; Wed, 22 Sep 2021 07:14:14 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mT0CY-0000lu-0X for submit@debbugs.gnu.org; Wed, 22 Sep 2021 07:14:12 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mT0CX-0001AT-6t for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 07:14:09 -0400 Original-Received: from mail1450c50.megamailservers.eu ([91.136.14.50]:39242 helo=mail265c50.megamailservers.eu) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mT0CU-0008Qw-2n for bug-gnu-emacs@gnu.org; Wed, 22 Sep 2021 07:14:08 -0400 X-Authenticated-User: mattiase@bredband.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=megamailservers.eu; s=maildub; t=1632309241; bh=Vgrv+kdF2s92i8bHhanNszifEhCmXfiP5JmldaodCko=; h=From:Subject:Date:To:From; b=M0DDrSXQJESscnuxLZHPxuG3ogCA0TPypMQRLHA3ogR56tQAMGUOL+OcC7WgKSGGj fFmVNKr9VYhmLVUCYb8icN3OvUN5ylf0nHhbEKc95YEvfE4j//7xS6p/z3vA3NGs2G 7zvQYu2yfkcBz1zD8iZv1fVn5PgVCqop0CPxUD2k= Feedback-ID: mattiase@acm.or Original-Received: from stanniol.lan (c-b952e353.032-75-73746f71.bbcust.telenor.se [83.227.82.185]) (authenticated bits=0) by mail265c50.megamailservers.eu (8.14.9/8.13.1) with ESMTP id 18MBDxHt003295 for ; Wed, 22 Sep 2021 11:14:01 +0000 X-Mailer: Apple Mail (2.3445.104.21) X-CTCH-RefID: str=0001.0A742F18.614B0FF9.0012, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0 X-CTCH-VOD: Unknown X-CTCH-Spam: Unknown X-CTCH-Score: 0.000 X-CTCH-Flags: 0 X-CTCH-ScoreCust: 0.000 X-CSC: 0 X-CHA: v=2.4 cv=adICITkt c=1 sm=1 tr=0 ts=614b0ff9 a=von4qPfY+hyqc0zmWf0tYQ==:117 a=von4qPfY+hyqc0zmWf0tYQ==:17 a=kj9zAlcOel0A:10 a=M51BFTxLslgA:10 a=NkP1B6mPVDB6Q4tCyRIA:9 a=CjuIK1q_8ugA:10 X-Origin-Country: SE Received-SPF: softfail client-ip=91.136.14.50; envelope-from=mattiase@acm.org; helo=mail265c50.megamailservers.eu X-Spam_score_int: -11 X-Spam_score: -1.2 X-Spam_bar: - X-Spam_report: (-1.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, SPF_HELO_NONE=0.001, SPF_SOFTFAIL=0.665 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:215081 Archived-At: 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=3Dt. 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?