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

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

bug#11747: 24.1.50; called-interactively-p vs. advice


From: Stefan Monnier
Subject: bug#11747: 24.1.50; called-interactively-p vs. advice
Date: Fri, 08 Feb 2013 17:41:50 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> | This function is meant for implementing advice and other
> | function-modifying features.  Instead of using this, it is sometimes
> | cleaner to give your function an extra optional argument whose
> | `interactive' spec specifies non-nil unconditionally ("p" is a good
> | way to do this), or via (not (or executing-kbd-macro noninteractive)). 
> It seems a bit confusing - is there a "not" missing in the first
> sentence?

No, called-interactively-p is indeed specifically useful when writing
advice (i.e. for use in the advice itself, not in the function that is
advised).
For normal functions, it is usually better (and always more reliable) to
provide an appropriate argument from the `interactive' spec, but doing
that in an advice is a lot more difficult, since it requires modifying
the `interactive' spec, which defadvice does not really let you do (it
lets you override it with another spec, but not modify the existing
spec).


        Stefan





reply via email to

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