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: Thu, 30 Jul 2009 15:37:50 -0700

emacs -Q
 
Load (eval) this:
 
(defun foo ()
  (interactive)
  (if (interactive-p)
      (message "INT")
    (message "NOT")))
 
(global-set-key "\C-l" 'foo)
 
(defadvice call-interactively (after foo-advice disable activate)
  (message "AFTER"))
 
(ad-enable-advice 'call-interactively 'after 'foo-advice)
(ad-activate 'call-interactively)
 
Then hit `C-l'.
 
In *Messages*, you will see this:
 
NOT
AFTER
 
Even though `foo' is called interactively, `interactive-p' returns
nil.  Using `called-interactively-p' in place of `interactive-p' gives
the same thing. Same thing no matter how `foo' is called interactively
(e.g. M-x foo, M-: (call-interactively 'foo)).
 
Seems like a bug, but I realize that advising primitives is iffy, and
perhaps advising `call-interactively' is even more iffy.
 
However, advising `call-interactively' seems to work fine otherwise -
this is the only anomaly I've come across.
 
Can someone please explain why this happens, or how to work around it?
 

In GNU Emacs 23.0.96.1 (i386-mingw-nt5.1.2600)
 of 2009-07-09 on SOFT-MJASON
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4)'
 






reply via email to

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