bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#3984:


From: Ryan
Subject: bug#3984:
Date: Fri, 20 Sep 2013 09:54:24 -0700
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130801 Thunderbird/17.0.8


On 9/20/13 7:35 AM, Stefan Monnier wrote:
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.

That would certainly work, assuming that subr.el is always loaded before nadvice.el (so call-interactively could not possibly be advised yet), which seems likely to be true since subr.el contains so many core functions.

Since this bug report is just about advising call-interactively, which we now have a fix for, should I open a separate bug about the around advice?





reply via email to

[Prev in Thread] Current Thread [Next in Thread]