From 05bfa8f34f3eedec3ad2fdb45971476a8c8f49b1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 26 Jul 2007 18:49:14 +0000 Subject: [PATCH] (ad-interactive-p, ad-interactive-form): Remove. (ad-body-forms, ad-advised-interactive-form, ad-make-cache-id) (ad-make-advised-definition, ad-cache-id-verification-code): Use commandp and interactive-form instead. --- lisp/ChangeLog | 9 ++++++++- lisp/emacs-lisp/advice.el | 41 ++++++++++++--------------------------- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 616dfd16859..378d0c3fe22 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,8 +1,15 @@ +2007-07-26 Stefan Monnier + + * emacs-lisp/advice.el (ad-interactive-p, ad-interactive-form): Remove. + (ad-body-forms, ad-advised-interactive-form, ad-make-cache-id) + (ad-make-advised-definition, ad-cache-id-verification-code): + Use commandp and interactive-form instead. + 2007-07-26 Dan Nicolaescu * vc-git.el: Relicense to GPLv3 or later. (vc-directory-exclusion-list, vc-handled-backends): Remove. - + * vc-hooks.el (vc-handled-backends): Add GIT. * vc.el (vc-directory-exclusion-list): Add .git. diff --git a/lisp/emacs-lisp/advice.el b/lisp/emacs-lisp/advice.el index 4891de726b8..c6e80453d72 100644 --- a/lisp/emacs-lisp/advice.el +++ b/lisp/emacs-lisp/advice.el @@ -2473,10 +2473,6 @@ will clear the cache." (setq definition (indirect-function definition))) (and (subrp definition) (eq (cdr (subr-arity definition)) 'unevalled))) -(defmacro ad-interactive-p (definition) - ;;"non-nil if DEFINITION can be called interactively." - (list 'commandp definition)) - (defmacro ad-subr-p (definition) ;;"non-nil if DEFINITION is a subr." (list 'subrp definition)) @@ -2590,22 +2586,13 @@ that property, or otherwise use `(&rest ad-subr-args)'." (natnump docstring)) docstring))) -(defun ad-interactive-form (definition) - "Return the interactive form of DEFINITION." - (cond ((ad-compiled-p definition) - (and (commandp definition) - (list 'interactive (aref (ad-compiled-code definition) 5)))) - ((or (ad-advice-p definition) - (ad-lambda-p definition)) - (commandp (ad-lambda-expression definition))))) - (defun ad-body-forms (definition) "Return the list of body forms of DEFINITION." (cond ((ad-compiled-p definition) nil) ((consp definition) (nthcdr (+ (if (ad-docstring definition) 1 0) - (if (ad-interactive-form definition) 1 0)) + (if (interactive-form definition) 1 0)) (cdr (cdr (ad-lambda-expression definition))))))) ;; Matches the docstring of an advised definition. @@ -3037,7 +3024,7 @@ in any of these classes." (ad-get-enabled-advices function 'around) (ad-get-enabled-advices function 'after))) (let ((interactive-form - (ad-interactive-form (ad-advice-definition advice)))) + (interactive-form (ad-advice-definition advice)))) (if interactive-form ;; We found the first one, use it: (ad-do-return interactive-form))))) @@ -3051,7 +3038,7 @@ in any of these classes." (ad-has-redefining-advice function)) (let* ((origdef (ad-real-orig-definition function)) (origname (ad-get-advice-info-field function 'origname)) - (orig-interactive-p (ad-interactive-p origdef)) + (orig-interactive-p (commandp origdef)) (orig-subr-p (ad-subr-p origdef)) (orig-special-form-p (ad-special-form-p origdef)) (orig-macro-p (ad-macro-p origdef)) @@ -3063,15 +3050,11 @@ in any of these classes." (interactive-form (cond (orig-macro-p nil) (advised-interactive-form) - ((ad-interactive-form origdef) - (if (and (symbolp function) (get function 'elp-info)) - (interactive-form (aref (get function 'elp-info) 2)) - (ad-interactive-form origdef))) - ;; Otherwise we must have a subr: make it interactive if - ;; we have to and initialize required arguments in case - ;; it is called interactively: - (orig-interactive-p - (interactive-form origdef)))) + ((interactive-form origdef) + (interactive-form + (if (and (symbolp function) (get function 'elp-info)) + (aref (get function 'elp-info) 2) + origdef))))) (orig-form (cond ((or orig-special-form-p orig-macro-p) ;; Special forms and macros will be advised into macros. @@ -3294,8 +3277,8 @@ advised definition from scratch." t (ad-arglist original-definition function)) (if (eq (ad-definition-type original-definition) 'function) - (equal (ad-interactive-form original-definition) - (ad-interactive-form cached-definition)))))) + (equal (interactive-form original-definition) + (interactive-form cached-definition)))))) (defun ad-get-cache-class-id (function class) "Return the part of FUNCTION's cache id that identifies CLASS." @@ -3342,8 +3325,8 @@ advised definition from scratch." (ad-arglist cached-definition)) (setq code 'interactive-form-mismatch) (or (null (nth 5 cache-id)) - (equal (ad-interactive-form original-definition) - (ad-interactive-form cached-definition))) + (equal (interactive-form original-definition) + (interactive-form cached-definition))) (setq code 'verified)))) code)) -- 2.39.2