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

From: Jonas Bernoulli <[email-masked]>
Date: Wed, 01 Feb 2023 02:33:55 +0100

Stefan Monnier <[email-masked]> writes:

> I think I'd try something like:
>
>     (let* ((var :value)
>            (interactive-advice
>             (lambda (spec)
>              (message "interactive: %s" var)
>              (advice-eval-interactive-spec spec)))
>            (advice-body
>             (lambda (fn &rest args)
>               (message "body: %s" var)
>               (apply fn args))))
>       (eval `(lambda (&rest args)
>                (interactive ,interactive-advice)
>                (apply ',advice-body args))
>             t))

I'm having troubles falling asleep because my brain insists on rewording
the following (even though --or perhaps exactly because-- there is not
really any need to mention it at all).  So I might as well try if typing
it out helps. ;)

I actually though of that, and the initial poc worked.  I did that late
at night also updated transient to use it.  In the morning I noticed
that there actually were many errors, and while I suspected that the
failure had nothing to do with this part of my change, it still lost
confidence in that approach, and since I felt some pressure to get
things done before the Emacs pre-release I stopped pursuing it.
Somehow I forgot about it when I wrote the above.

Now that you have suggested the same, my confidence is back.  And now
that I have written the above, I should also be able to fall asleep. ;P

> where the last 4 lines are "generic" and could be turned into
> a helper function if you end up using it several times.
> This should also minimize the amount of code that's hidden from the
> compiler by the backquote.

I'll only need it once; would you recommend using a helper in that case
too?

>         Stefan

    Good night!
    Jonas

    zzzzZZz