From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#60730: 29.0.60; Free variable with :buffer keyword in ert-with-temp-file Date: Sat, 28 Jan 2023 17:03:07 +0200 Message-ID: <83edreaehg.fsf@gnu.org> References: <87o7r5ji3q.fsf@neverwas.me> <874jsazqzz.fsf@neverwas.me> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26668"; mail-complaints-to="usenet@ciao.gmane.io" Cc: stefankangas@gmail.com, 60730@debbugs.gnu.org To: "J.P." Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jan 28 16:04:21 2023 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 1pLmke-0006gX-TB for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 28 Jan 2023 16:04:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLmkR-0004wd-Le; Sat, 28 Jan 2023 10:04:07 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLmkQ-0004wT-FF for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2023 10:04:06 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pLmkM-0001Qq-D0 for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2023 10:04:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pLmkL-0001fY-Vd for bug-gnu-emacs@gnu.org; Sat, 28 Jan 2023 10:04:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 28 Jan 2023 15:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60730 X-GNU-PR-Package: emacs Original-Received: via spool by 60730-submit@debbugs.gnu.org id=B60730.16749182136365 (code B ref 60730); Sat, 28 Jan 2023 15:04:01 +0000 Original-Received: (at 60730) by debbugs.gnu.org; 28 Jan 2023 15:03:33 +0000 Original-Received: from localhost ([127.0.0.1]:41373 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLmjs-0001ea-NS for submit@debbugs.gnu.org; Sat, 28 Jan 2023 10:03:33 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48712) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pLmjo-0001eF-6Z for 60730@debbugs.gnu.org; Sat, 28 Jan 2023 10:03:31 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLmjh-0001Mk-Ah; Sat, 28 Jan 2023 10:03:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=QrjIKlRUsDK69Zt+cX23zrD+DIWZpbpve157vxCop88=; b=MbQXJvGCrxEM lAar20MPwSMde9/HTPHl5znkkgLeww3J6fr9aN6mNEZrrcYK/eOOUHRiwg+3E+XXuDI32QbColmlS rR9RwXa33E0hI3n5Aqqp65SgvcSJo/Aq9vallA7uVrZ/sTvlsWCsN644ev9bQWaollWcorHMnBzVF VrTTNUODw5B62uAQWCYEnv51Oz1p2fNPgXBbaP5G1tO9SThNUiSy7QV9zlVLq6I99tRgzSjLz1cRt vHvCWX6iDvFYgfcTFoqpEZZUvoB+FlhuqVOvoOGXqfPNswpoP2jjHVgD42nOlOcpWw3pOEuu2OvUr drqWeB4veBrUjlXoBjYDDQ==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLmjg-0005T8-HD; Sat, 28 Jan 2023 10:03:20 -0500 In-Reply-To: <874jsazqzz.fsf@neverwas.me> (jp@neverwas.me) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:254301 Archived-At: > Cc: Stefan Kangas > From: "J.P." > Date: Sat, 28 Jan 2023 06:13:36 -0800 > > Perhaps I should have filed another report for this. It's a similar > error in the same vicinity on the same branch, so I figured might as > well piggyback. > > I'm getting "reference to free variable `utf-8'" warnings (from > `elisp-flymake--batch-compile-for-flymake') when linting tests > containing `ert-with-temp-file'. This doesn't show up if > `coding-system-for-write' is nil or if you pass in a quoted keyword > argument for `:coding'. Adding a quote like this seems to make it go > away: > > diff --git a/lisp/emacs-lisp/ert-x.el b/lisp/emacs-lisp/ert-x.el > index 98a017c8a8e..70b136c5c55 100644 > --- a/lisp/emacs-lisp/ert-x.el > +++ b/lisp/emacs-lisp/ert-x.el > @@ -484,7 +484,7 @@ ert-with-temp-file > (suffix (or suffix ert-temp-file-suffix > (ert--with-temp-file-generate-suffix > (or (macroexp-file-name) buffer-file-name))))) > - `(let* ((coding-system-for-write ,(or coding coding-system-for-write)) > + `(let* ((coding-system-for-write ',(or coding coding-system-for-write)) > (,temp-file (,(if directory 'file-name-as-directory 'identity) > (make-temp-file ,prefix ,directory ,suffix ,text))) > (,name ,(if directory > > Not sure if that's the right call, though. If this keyword is already > seeing action in the wild, perhaps it's worth ensuring that its argument > arrives unquoted? Or maybe another type check (to accompany the one for > `name') would do? Can you show the results of macro-expansion both when coding has a value and when it is nil (and then coding-system-for-write is nil or has a non-nil value)?