Re: Has lexical binding declaration format changed in Emacs 30 or 31?

[email protected]
Newsgroups gmane.emacs.help
Message-ID <[email protected]>
Pierre Rouleau <[email protected]> writes:

> Hi all,
>
> I started seeing the byte compiler generating the
>
> "Warning (bytecomp): file has no ‘lexical-binding’ directive on its first
> line"
>
> for files that do have the declaration.
>
> For example, the file:
> gnu-elpa-keyring-update-2025.10.1/gnu-elpa-keyring-update.el
>
> The first line of the file seems OK to me:
>
> ;;; gnu-elpa-keyring-update.el --- Update Emacs's GPG keyring for GNU ELPA
>  -*- lexical-binding: t; -*-
>
> I have seen this on
> GNU Emacs 30.2.50 (build 2, aarch64-apple-darwin23.6.0, NS appkit-2487.70
> Version 14.8.2 (Build 23J126)) of 2025-11-26
>
> Has the format requirement changed for Emacs 30 or 31?

See the NEWS file (C-h n) for Emacs 30:

   *** Warn about missing 'lexical-binding' directive.
   The compiler now warns if an Elisp file lacks the standard
   '-*- lexical-binding: ... -*-' cookie on the first line.
   This line typically looks something like

   ;;; My little pony mode  -*- lexical-binding: t -*-

So, the format has not changed and there appears to be some
other problem.  You could try ‘emacs -Q’ and then read and
compile your file to see whether you can reproduce the
problem.

Also, the command ‘elisp-enable-lexical-binding’ inserts the
‘-*- lexical-binding: t -*-’ into a buffer and sets
‘lexical-binding’ to t.  Try:

   M-x e-e-l-b

This is more evidence that the format has not changed.

-- 
The lyf so short, the craft so long to lerne.
- Geoffrey Chaucer, The Parliament of Birds.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.