GNU bug report logs - #60730
29.0.60; Free variable with :buffer keyword in ert-with-temp-file

Previous Next

Package: emacs;

Reported by: "J.P." <jp <at> neverwas.me>

Date: Wed, 11 Jan 2023 13:51:01 UTC

Severity: normal

Found in version 29.0.60

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 60730 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: "J.P." <jp <at> neverwas.me>
Cc: stefankangas <at> gmail.com, 60730 <at> debbugs.gnu.org
Subject: Re: bug#60730: 29.0.60;
 Free variable with :buffer keyword in ert-with-temp-file
Date: Sat, 28 Jan 2023 17:03:07 +0200
> Cc: Stefan Kangas <stefankangas <at> gmail.com>
> From: "J.P." <jp <at> neverwas.me>
> 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)?




This bug report was last modified 2 years and 169 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.