[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#3984: 23.0.96; defadvice of call-interactively defeats interactive-p
From: |
Stefan Monnier |
Subject: |
bug#3984: 23.0.96; defadvice of call-interactively defeats interactive-p |
Date: |
Thu, 30 Jul 2009 21:58:51 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) |
> Can someone please explain why this happens, or how to work around it?
Because the implementation of interactive-p (and called-interactively-p)
is brittle: it looks at the latest stack frames to see the name of the
caller, so if you add things between the call to `call-interactively'
and the corresponding function call, it gets confused.
To work around it, don't use `interactive-p' and instead add an optional
argument (call it `interactive') to your function and pass it an
explicit non-nil value from the interactive spec.
Stefan