Subject: Re: bug#61179: lambda inside interactive form of around advice isn't a closure

From: Michael Heerdegen <[email-masked]>
Date: Sun, 05 Feb 2023 00:47:58 +0100

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <[email-masked]> writes:

> I installed a patch in `master` which should fix this problem, both for
> the case where the code is interpreted and for the case where it is
> byte-compiled.

Very good.

This seems to break some of my private code.  Didn't look into your
change so far.

My code generates function advices with the following semantics: You
specify an alternative function and a condition (as a predicate
function).  When the advice is enabled, whenever the function is called
the predicate is first checked for a non-nil result.  When non-nil, the
alternative function that had been specified is called (recursive calls
are bot affected however).  When nil, the original function is called.

I'm using this hack only in my init file for convenience, I like the
semantics for this purpose.

Here is a recipe for emacs -Q:

Worked as I wanted until now.  But with your patch installed when
compiling the above snipped I get a *Compile Log* saying:

| Compiling internal form(s) at Sun Feb  5 00:36:11 2023
| int-lambda.elc: Error: ‘lambda’ defined after use in (lambda (old-spec3) (let ((test-result0 (#[0 "\300\207" [t] 1]))) (cons (if test-result0 'mel-ad-run-replacement 'mel-ad-run-original) (advice-eval-interactive-spec (if (not test-result0) old-spec3))))) (missing ‘require’ of a library file?)
| int-lambda.elc: Error: ‘lambda’ used as function name is invalid

Who is to blame?

TIA,

Michael.