Subject: 24.2; interactive calls with defadvice

From: Uday S Reddy <[email-masked]>
Date: Fri, 8 Feb 2013 20:36:14 +0000

I would expect that the following code would print

  before
  test
  after

However, it only prints "before" and "after", no "test".  So, it seems that
the defadvice eats away the interactivity of the function call.

Is this a bug or a feature?

Cheers,
Uday

--------

(defun test ()
  (interactive)
  (when (called-interactively-p 'any)
    (message "test")
    (sit-for 1)))

(defadvice test (around test-advice activate)
  (when (called-interactively-p 'any) (message "before") (sit-for 1))
  ad-do-it
  (when (called-interactively-p 'any) (message "after") (sit-for 1)))

In GNU Emacs 24.2.1 (i386-mingw-nt5.1.2600)
 of 2012-08-29 on MARVIN
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.6) --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-3.0.9/include'

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: ENU
  value of $XMODIFIERS: nil
  locale-coding-system: cp1252
  default enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  outline-minor-mode: t
  savehist-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
. e l c <return> C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-f C-f C-f C-f C-f C-f C-f C-f C-f v m - C-n C-n C-n 
C-n C-n C-b C-b C-b v m - C-n C-n C-b C-b C-b C-b C-f 
v m - C-x C-s M-x b y t e - c o m SPC SPC <return> 
<up> <return> M-x b u y t <backspace> <backspace> <backspace> 
y t e - c 0 m <backspace> <backspace> o m SPC SPC <return> 
<up> <up> <return> M-x l o a d - f i l e <return> <up> 
<up> <return> M-x t e s t <return> C-p C-p C-p C-p 
C-p C-a C-x q s i t - f o r SPC 2 <return> s i t - 
f o r SPC 1 <return> SPC SPC SPC C-p C-p C-p C-p C-p 
C-p C-p C-a C-x q v m - i n t e a c t i v e - p <return> 
c a l l e d - i n t e r a c t i v e l y - p <return> 
C-x <escape> <escape> C-g C-x q v m - i n t e r a c 
t i v e - p <return> c a l l e d - i n t e r a c t 
v <backspace> i v e l y - p SPC ' a n y <return> SPC 
SPC SPC C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p 
C-p C-p C-p C-p C-p C-a C-SPC C-n C-n C-n C-n C-n C-n 
C-n C-w C-x C-s C-SPC C-x . C-x C-k C-x m C-x k <return> 
M-x r e p o r t - e m a c s - SPC b SPC <return>

Recent messages:
Mark set
Replaced 3 occurrences
Mark set
Saving file d:/Home/udr/tmp/test.el...
Wrote d:/Home/udr/tmp/test.el
Mark activated
Parsing d:/Home/udr/.mailrc...
Parsing y:/dotfiles/.mailrc... done
Parsing d:/Home/udr/.mailrc... done
Making completion list...

Load-path shadows:
y:/gnu/vm/trunk/emacs24/lisp/vm-vcard hides d:/gnu/emacs-24.2/../site-lisp/vm-vcard
y:/gnu/vm/trunk/emacs24/lisp/vm-serial hides d:/gnu/emacs-24.2/../site-lisp/vm-serial
y:/gnu/vm/trunk/emacs24/lisp/vm-ps-print hides d:/gnu/emacs-24.2/../site-lisp/vm-ps-print
y:/gnu/vm/trunk/emacs24/lisp/vm-grepmail hides d:/gnu/emacs-24.2/../site-lisp/vm-grepmail
y:/gnu/vm/trunk/emacs24/lisp/vm-biff hides d:/gnu/emacs-24.2/../site-lisp/vm-biff
y:/gnu/vm/trunk/emacs24/lisp/vcard hides d:/gnu/emacs-24.2/../site-lisp/vcard
d:/gnu/emacs-24.2/../site-lisp/longlines hides d:/gnu/emacs-24.2/lisp/longlines
d:/gnu/emacs-24.2/../site-lisp/undigest hides d:/gnu/emacs-24.2/lisp/mail/undigest

Features:
(shadow emacsbug message format-spec mml mml-sec mm-decode mm-bodies
mm-encode gmm-utils mailheader mailalias newcomment compile comint
ansi-color bbdb-hooks mail-parse rfc2231 w3m-form w3m browse-url doc-view
jka-compr dired-x mydired dired image-mode w3m-hist w3m-fb bookmark-w3m
w3m-ems wid-edit w3m-ccl ccl w3m-favicon w3m-image w3m-proc w3m-util vm-w3m
help-mode view utf-7 network-stream starttls tls u-vm-color my-vm vc-bzr
etags ring vm-ps-print vm-rfaddons vm-message vm-macro bbdb-vm vm-autoload
bbdb-snarf mail-extr rfc822 vm misearch multi-isearch ind-util info easymenu
outline-magic noutline outline easy-mmode scala-mode2 scala-mode2-map
scala-mode2-fontlock scala-mode2-indent scala-mode2-paragraph
scala-mode2-syntax scala-mode2-lib bbdb-autoloads bbdb-com mailabbrev bbdb
vm-digest vm-reply vm-save vm-virtual vm-summary-faces vm-delete vm-pop utf7
vm-imap vm-sort vm-undo vm-mime vm-page vm-motion vm-thread vm-mouse
vm-toolbar vm-menu tapestry vm-window vm-crypto vm-summary vm-folder
vm-minibuf vm-misc timezone vm-pcrisis vm-autoloads vm-version vm-vars
myautopair autopair warnings cl savehist session tex-site movement
natural-space NatSpeak sendmail rfc2047 rfc2045 ietf-drums mail-utils
auth-source eieio byte-opt bytecomp byte-compile cconv macroexp assoc
gnus-util mm-util mail-prsvr password-cache epa-file epa epg epg-config
regexp-opt paren echistory chistory ehelp electric derived advice help-fns
advice-preload edmacro kmacro time-date tooltip ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 disp-table ls-lisp w32-win w32-vars tool-bar
dnd fontset image fringe lisp-mode register page menu-bar rfn-eshadow timer
select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face files text-properties overlay sha1
md5 base64 format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process multi-tty emacs)