diff options
author | Ryan <rct@thompsonclan.org> | 2013-09-20 15:59:42 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-09-20 15:59:42 -0400 |
commit | 31dca772aded1c089b135d6335e4e444fd63078a (patch) | |
tree | fc0b81bb9e78daae93cca7ef169d366e47afe17a /lisp/subr.el | |
parent | 1e835c22e8ec9e387b4275196103d4d6d0617899 (diff) |
* lisp/subr.el (internal--call-interactively): New const.
(called-interactively-p): Use it.
* test/automated/advice-tests.el (advice-test-called-interactively-p-around)
(advice-test-called-interactively-p-filter-args)
(advice-test-called-interactively-p-around): New tests.
Fixes: debbugs:3984
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index b903ef1ea9..43be9f529b 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -4246,6 +4246,8 @@ I is the index of the frame after FRAME2. It should return nil 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 @@ -4318,9 +4320,9 @@ command is called from a keyboard macro?" (pcase (cons frame nextframe) ;; No subr calls `interactive-p', so we can rule that out. (`((,_ ,(pred (lambda (f) (subrp (indirect-function f)))) . ,_) . ,_) nil) - ;; Somehow, I sometimes got `command-execute' rather than - ;; `call-interactively' on my stacktrace !? - ;;(`(,_ . (t command-execute . ,_)) t) + ;; In case #<subr call-interactively> without going through the + ;; `call-interactively' symbol (bug#3984). + (`(,_ . (t ,(pred (eq internal--call-interactively)) . ,_)) t) (`(,_ . (t call-interactively . ,_)) t))))) (defun interactive-p () |