GNU bug report logs -
#3984
23.0.96; defadvice of call-interactively defeats interactive-p
Previous Next
Reported by: "Drew Adams" <drew.adams <at> oracle.com>
Date: Thu, 30 Jul 2009 22:45:04 UTC
Severity: minor
Done: Stefan Monnier <monnier <at> iro.umontreal.ca>
Bug is archived. No further changes may be made.
Full log
Message #123 received at 3984 <at> debbugs.gnu.org (full text, mbox):
> After a little more consideration, I think I know what the bug is. The goal
> of "advice--called-interactively-skip" is to skip all the advice-related
> stack frames of the called function, not advice-related stack frames for
> advice on call-interactively.
Oh, right. How 'bout the patch below?
Stefan
=== modified file 'lisp/subr.el'
--- lisp/subr.el 2013-09-18 03:50:18 +0000
+++ lisp/subr.el 2013-09-20 14:34:03 +0000
@@ -4246,6 +4246,8 @@
if those frames don't seem special and otherwise, it should return
the number of frames to skip (minus 1).")
+(defconst internal--call-interactively (symbol-function 'call-interactively))
+
(defun called-interactively-p (&optional kind)
"Return t if the containing function was called by `call-interactively'.
If KIND is `interactive', then only return t if the call was made
@@ -4321,7 +4323,9 @@
;; Somehow, I sometimes got `command-execute' rather than
;; `call-interactively' on my stacktrace !?
;;(`(,_ . (t command-execute . ,_)) t)
- (`(,_ . (t call-interactively . ,_)) t)))))
+ (`(,_ . (t ,(or `call-interactively
+ (pred (eq internal--call-interactively))) . ,_))
+ t)))))
(defun interactive-p ()
"Return t if the containing function was run directly by user input.
This bug report was last modified 11 years and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.