Subject: Re: bug#74530: 31.0.50; Emacs fails to compile cape package

From: Sean Whitton <[email-masked]>
Date: Tue, 26 Nov 2024 10:10:09 +0800

Hello,

On Mon 25 Nov 2024 at 05:58pm +02, Eli Zaretskii wrote:

>> From: Osama Rebach <[email-masked]>
>> Date: Mon, 25 Nov 2024 16:07:02 +0100
>>
>> Emacs (commit: cf3ea44eb56) fails to compile cape (url: https://github.com/minad/cape,
>> commit: 9a7c44fe8b7).  Reverting commit eb1756a8a55 solves the problem.
>>
>> Steps to reproduce:
>>
>> run: emacs -Q
>>
>> evaluate:
>> (add-to-list 'load-path "/path/to/cape")
>> (byte-compile-file "/path/to/cape/cape-char.el")
>>
>> results:
>> cape-char.el:132:2: Error: Symbol's function definition is void: internal--with-suppressed-warnings
>>
>> I can provide the full nix build log, or more information if needed.
>
> Sean, any ideas?

Line 132 in cape-char.el directly calls a macro which uses when-let, at
top-level, so it calls the with-suppressed-warnings I added in the
recent commit, again at top-level.

Stefan's commit a0f60293d9 says

    `byte-compile-macro-environment` contains definitions which expand
    to code that is only understood by the rest of the byte-compiler, so
    using it for code which isn't being byte-compiled leads to errors
    such as references to non-existing function
    `internal--with-suppressed-warnings`.

So it sounds like we are inappropriately tangling with machinery
internal to the byte compiler.  I used with-suppressed-warnings in a
completely standard way, so I think the most likely thing is that we
have uncovered a bug in the byte compiler, probably something to do with
evaluating top-level forms while compiling.  Adding Stefan.

-- 
Sean Whitton