bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60730: 29.0.60; Free variable with :buffer keyword in ert-with-temp-


From: J.P.
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
User-agent: Gnus/5.13 (Gnus v5.13)

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.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]