bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec


From: Štěpán Němec
Subject: bug#17871: 24.4.50; (elisp) `Core Advising Primitives': interactive spec as function?
Date: Wed, 21 Aug 2019 10:17:42 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

On Wed, 21 Aug 2019 03:01:23 -0400
Stefan Monnier wrote:

> The interactive form is executed to build the args with which the
> function will be called (hence your advice is only executed after the
> interactive spec), so in order for your code to do what you want,
> we'd have to always wrap the interactive spec identically to the body.

Thank you! I guess from the implementation POV this is obvious, but I
think this simple use case (wrap a function/command) is one of the most
common around advice usage patterns, and I at least was utterly confused
by the behaviour, so I'd have appreciated very much if this "gotcha" was
documented somewhere (my commented example[1] was intended as possible
material for that, but even simple one-sentence mention would be great
help).

> Maybe in this case it'd do what you want, but in many other cases
> it wouldn't.

Do you mean cases where one might _want_ to only affect the body, not
the interactive form? I can't really imagine anything like that... do
you have anything concrete in mind? The current need to wrap the two
separately really feels like jumping through hoops to me[2], but I guess
dwimmishly auto-wrapping the interactive spec sounds kinda dirty, and
would break those other cases I can't imagine.

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=17871#38
[2] Juri's example is a good illustration of that:
    https://debbugs.gnu.org/cgi/bugreport.cgi?bug=36826#41

-- 
Štěpán





reply via email to

[Prev in Thread] Current Thread [Next in Thread]