Subject: Re: bug#3984: 23.0.96; defadvice of call-interactively defeats interactive-p

From: Stefan Monnier <[email-masked]>
Date: Thu, 30 Jul 2009 21:58:51 -0400

> 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