GNU bug report logs - #61179
lambda inside interactive form of around advice isn't a closure

Previous Next

Package: emacs;

Reported by: Jonas Bernoulli <jonas <at> bernoul.li>

Date: Mon, 30 Jan 2023 15:49:01 UTC

Severity: normal

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Jonas Bernoulli <jonas <at> bernoul.li>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 61179 <at> debbugs.gnu.org
Subject: bug#61179: lambda inside interactive form of around advice isn't a closure
Date: Wed, 01 Feb 2023 02:33:55 +0100
Stefan Monnier <monnier <at> iro.umontreal.ca> 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




This bug report was last modified 2 years and 159 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.