PG icon indicating copy to clipboard operation
PG copied to clipboard

Emacs 31 warns on missing lexical bindings for `generic/proof-autoloads.el`

Open iwahbe opened this issue 3 months ago • 4 comments

The warning looks like this (from the *Warnings* buffer):

⛔ Warning (files): Missing ‘lexical-binding’ cookie in "~/.emacs.d/.cache/elpaca/builds/proof-general/generic/proof-autoloads.el".
You can add one with ‘M-x elisp-enable-lexical-binding RET’.
See ‘(elisp)Selecting Lisp Dialect’ and ‘(elisp)Converting to Lexical Binding’
for more information.

Since this is the auto-loads file, this warning shows up when I start Emacs. The warning can be addressed by adding a lexical binding cookie to the file in question. To preserve existing behavior and silence the warning, we can use:

 generic/proof-autoloads.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/generic/proof-autoloads.el b/generic/proof-autoloads.el
index 8090aa0..4f35a9f 100644
--- a/generic/proof-autoloads.el
+++ b/generic/proof-autoloads.el
@@ -1,4 +1,4 @@
-;;; proof-autoloads.el --- automatically extracted autoloads
+;;; proof-autoloads.el --- automatically extracted autoloads  -*- lexical-binding: nil; -*-
 
 ;; This file is part of Proof General.
 

iwahbe avatar Sep 15 '25 11:09 iwahbe

To preserve existing behavior and silence the warning, we can use: [...] -;;; proof-autoloads.el --- automatically extracted autoloads +;;; proof-autoloads.el --- automatically extracted autoloads -- lexical-binding: nil; --

I'd recommend using lexical-binding: t since that's more "future looking" and it works as well because the code in that file behaves identically regardless of the ELisp dialect chosen.

monnier avatar Sep 15 '25 15:09 monnier

@monnier That sounds reasonable. Do you know if the file is auto-generated? I'd be happy to open a PR if I knew where the correct root change was.

iwahbe avatar Sep 15 '25 17:09 iwahbe

@monnier That sounds reasonable. Do you know if the file is auto-generated? I'd be happy to open a PR if I knew where the correct root change was.

I think you want to look at the autoloads target in Makefile.devel.

monnier avatar Sep 15 '25 21:09 monnier

I opened https://github.com/ProofGeneral/PG/pull/846 to address the problem.

iwahbe avatar Sep 23 '25 08:09 iwahbe