Subject: bug#78818: 31.0.50; Missing lexical-binding cookies when compiling trampolines

From: Daniel Mendler <[email-masked]>
Date: Wed, 18 Jun 2025 13:52:42 +0200

Eli Zaretskii <[email-masked]> writes:

>> Date: Tue, 17 Jun 2025 20:38:20 +0200
>> From:  Daniel Mendler via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <[email-masked]>
>> 
>> In the *Native-compile-Log* I see the following messages on a newly
>> compiled Emacs 31 from the current Emacs master branch:
>> 
>> Warning (files): Missing ‘lexical-binding’ cookie in "/tmp/emacs-int-comp-subr--trampoline-72756e2d686f6f6b73_run_hooks_0-ZQkOM2.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.
>> Compiling $HOME/.config/emacs/eln-cache/31.0.50-45ab2aa9/subr--trampoline-72756e2d686f6f6b73_run_hooks_0.eln...
>
> Please show a recipe to reproduce this problem starting from "emacs -Q".
> Or at least figure out and tell here compilation of what ELisp file
> triggered this message (it sounds like it's part of your init
> configuration?).  I started "emacs -Q", but didn't see any such
> messages that I could use as a starting point for investigation.
>
> Or, if I'm missing something, could you suggest how to investigate
> this given the information you provided above?

The trampoline .el file is generated by `comp--final' in comp.el. I
found this by grepping for `emacs-int-comp'. The generated Elisp file
doesn't include a `lexical-binding' cookie, which seems to trigger the
warning. As far as I understand the trampolines are generated if native
subrs are advised in the configuration.

Daniel