APPROVE COMMIT xemacs-base
This patch is needed if you use keyboard macros with advised functions.
Index: xemacs-packages/xemacs-base/ChangeLog
===================================================================
RCS file: /cvs/xemacs/XEmacs/packages/xemacs-packages/xemacs-base/ChangeLog,v
retrieving revision 1.243
diff -u -U 0 -r1.243 ChangeLog
--- xemacs-packages/xemacs-base/ChangeLog 10 Jan 2011 07:38:39 -0000 1.243
+++ xemacs-packages/xemacs-base/ChangeLog 9 Aug 2011 16:30:14 -0000
@@ -0,0 +1,11 @@
+2009-08-19 Stephen J. Turnbull <stephen(a)xemacs.org>
+
+ Conditionally define and use `called-interactively-p'.
+
+ * advice.el (called-interactively-p): defun if not fboundp.
+ (car): Use it in example.
+ (ad-enable-regexp):
+ (ad-disable-regexp):
+ (ad-make-advised-definition):
+ Use it instead of `interactive-p'.
+
Index: xemacs-packages/xemacs-base/advice.el
===================================================================
RCS file: /cvs/xemacs/XEmacs/packages/xemacs-packages/xemacs-base/advice.el,v
retrieving revision 1.4
diff -u -u -r1.4 advice.el
--- xemacs-packages/xemacs-base/advice.el 21 Jul 2010 15:01:12 -0000 1.4
+++ xemacs-packages/xemacs-base/advice.el 9 Aug 2011 16:30:21 -0000
@@ -218,7 +218,7 @@
;; "Make `car' an interactive function."
;; (interactive "xCar of list: ")
;; ad-do-it
-;; (if (interactive-p)
+;; (if (called-interactively-p)
;; (message "%s" ad-return-value)))
@@ -1821,6 +1821,22 @@
;; During a normal load this is a noop:
(require 'advice-preload "advice.el")
+(defmacro ad-xemacs-p ()
+ ;;Expands into Non-nil constant if we run XEmacs.
+ ;;Unselected conditional code will be optimized away during compilation.
+ (or (featurep 'xemacs) (string-match "XEmacs" emacs-version)))
+
+;; #### This compatibility kludge should be moved into a `future' package.
+(unless (fboundp 'called-interactively-p)
+ (defsubst called-interactively-p ()
+ "Non-nil if this function was invoked with `call-interactively'.
+`call-interactively' is implicitly applied when a function is invoked as a
+command, as well as the occasional explicit use by commands which delegate
+argument gathering to other functions.
+ This implementation is a kludge; semantics are different in batch-mode,
+and may subtly differ in an interactive session."
+ (or (interactive-p) executing-kbd-macro)))
+
;; We need this; it's not available on 21.4 or early 21.5.
(defun-when-void special-operator-p (object)
"Return whether OBJECT is a special operator.
@@ -2323,7 +2339,7 @@
(interactive
(list (ad-read-regexp "Enable advices via regexp: ")))
(let ((matched-advices (ad-enable-regexp-internal regexp 'any t)))
- (if (interactive-p)
+ (if (called-interactively-p)
(message "%d matching advices enabled" matched-advices))
matched-advices))
@@ -2333,7 +2349,7 @@
(interactive
(list (ad-read-regexp "Disable advices via regexp: ")))
(let ((matched-advices (ad-enable-regexp-internal regexp 'any nil)))
- (if (interactive-p)
+ (if (called-interactively-p)
(message "%d matching advices disabled" matched-advices))
matched-advices))
@@ -3038,7 +3054,7 @@
(not advised-interactive-form))
;; Check whether we were called interactively
;; in order to do proper prompting:
- (` (if (interactive-p)
+ (` (if (called-interactively-p)
(call-interactively '(, origname))
(, (ad-make-mapped-call
orig-arglist advised-arglist origname)))))
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://lists.xemacs.org/mailman/listinfo/xemacs-patches