Subject: bug#18139: 24.4.50; called-interactively-p and skip advice:

From: raman <[email-masked]>
Date: Wed, 30 Jul 2014 06:56:45 -0700

This should hopefully produce the  backtrace --  

I'll give two recipes below  -- the first is impossible  for me to try 

1. emacs -q
2. load-library ruby-mode
3. evaluate this form:

(defadvice backward-sexp (around test pre act comp)
(when (called-interactively-p 'interactive)
      (message "advice!"))
ad-do-it)
3. Open a ruby file test.rb
4. type 
puts "foo"
5. Invoke electric-newline-and-indent -- to trigger the bug.

Recipe 2:

Do the same as above with emacspeak loaded -- and without bothering with
the  additional piece of advice.

I'll attach the emacspeak generated backtrace below.
Debugger entered--Lisp error: (quit)
  advice--called-interactively-skip(3 (t ad-Advice-backward-sexp #[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] 1) (t apply ad-Advice-backward-sexp #[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] 1))
  run-hook-with-args-until-success(advice--called-interactively-skip 3 (t ad-Advice-backward-sexp #[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] 1) (t apply ad-Advice-backward-sexp #[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] 1))
  called-interactively-p(interactive)
  ad-Advice-backward-sexp(#[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] 1)
  apply(ad-Advice-backward-sexp #[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] 1)
  #[128 "\300\301\302#\207" [apply ad-Advice-backward-sexp #[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] nil] 5 nil "^p"](1)
  #[0 "\300\301!\210\302\207" [#[128 "\300\301\302#\207" [apply ad-Advice-backward-sexp #[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] nil] 5 nil "^p"] 1 nil] 2 "\n\n(fn)"]()
  funcall(#[0 "\300\301!\210\302\207" [#[128 "\300\301\302#\207" [apply ad-Advice-backward-sexp #[256 "\211\204\300\262\301[!\207" [1 forward-sexp] 3 2382034 "^p"] nil] 5 nil "^p"] 1 nil] 2 "\n\n(fn)"])
  #[0 "\304\242;\205\306\304\242\"AC\304\307\240\210`\300 \306
  funcall(#[0 "\304\242;\205\306\304\242\"AC\304\307\240\210`\300 \306
  smie-backward-sexp(";")
  smie-indent-keyword()
  run-hook-with-args-until-success(smie-indent-keyword)
  smie-indent-calculate()
  smie-indent-virtual()
  smie-indent-after-keyword()
  run-hook-with-args-until-success(smie-indent-after-keyword)
  smie-indent-calculate()
  #[0 "\212\301y\210\302\303w\210`\300\242Y\203\300\303\240\210\304 \206\301)\207" [(nil) 0 " 	" nil smie-indent-calculate] 2 "\n\n(fn)"]()
  funcall(#[0 "\212\301y\210\302\303w\210`\300\242Y\203\300\303\240\210\304 \206\301)\207" [(nil) 0 " 	" nil smie-indent-calculate] 2 "\n\n(fn)"])
  smie-indent-line()
  indent-according-to-mode()
  #[0 "\300\301!\210\302\303\301\"\210\304 \207" [delete-horizontal-space t newline nil indent-according-to-mode] 3 1970172 "*"]()
  ad-Advice-newline-and-indent(#[0 "\300\301!\210\302\303\301\"\210\304 \207" [delete-horizontal-space t newline nil indent-according-to-mode] 3 1970172 "*"])
  apply(ad-Advice-newline-and-indent #[0 "\300\301!\210\302\303\301\"\210\304 \207" [delete-horizontal-space t newline nil indent-according-to-mode] 3 1970172 "*"] nil)
  newline-and-indent()
  electric-newline-and-maybe-indent()
  funcall-interactively(electric-newline-and-maybe-indent)
  call-interactively(electric-newline-and-maybe-indent nil nil)
  command-execute(electric-newline-and-maybe-indent)