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

"Drew Adams" <[email protected]>
Newsgroups gmane.emacs.bugs,gmane.emacs.pretest.bugs
Message-ID <[email protected]>
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)'
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.