logo       

bug#3984: 23.0.96; defadvice of call-interactively defeats interactive-p: msg#00626

bug-gnu-emacs-gnu

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

> 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



Google Custom Search

News | Mail Home | sitemap | FAQ | advertise