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


View this message in rfc822 format

From: "J.P." <jp <at> neverwas.me>
To: 60730 <at> debbugs.gnu.org
Cc: Stefan Kangas <stefankangas <at> gmail.com>
Subject: bug#60730: 29.0.60; Free variable with :buffer keyword in ert-with-temp-file
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?

Thanks in advance.




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.