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

[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: Drew Adams
Subject: bug#3984: 23.0.96; defadvice of call-interactively defeats interactive-p
Date: Fri, 31 Jul 2009 07:19:13 -0700

> > 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.

Unfortunately, the code with `interactive-p' is not mine. The defadvice is mine,
but it needs to work for user functions, including those that call
`interactive-p' or `called-interactively-p'.

Is there no way the Emacs implementation could be fixed to handle this better?
Couldn't it take into consideration the `ad-*' stuff that results from advising
`call-interactively'? IOW, couldn't it look for `call-interactively' in its
advised form also?






reply via email to

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