changeset 80879:cdee0fbb5943

(ad-special-forms): Remove. (ad-special-form-p): Use subr-arity.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 08 May 2007 16:05:02 +0000
parents 98ca0b616c89
children dba96e4a8a94
files lisp/ChangeLog lisp/emacs-lisp/advice.el
diffstat 2 files changed, 8 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue May 08 16:02:14 2007 +0000
+++ b/lisp/ChangeLog	Tue May 08 16:05:02 2007 +0000
@@ -1,5 +1,8 @@
 2007-05-08  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* emacs-lisp/advice.el (ad-special-forms): Remove.
+	(ad-special-form-p): Use subr-arity.
+
 	* newcomment.el (comment-search-forward): Make sure we search forward.
 	(comment-enter-backward): Try and distinguish the non-matching case at
 	EOB from the non-matching case with a missing comment-end-skip for
--- a/lisp/emacs-lisp/advice.el	Tue May 08 16:02:14 2007 +0000
+++ b/lisp/emacs-lisp/advice.el	Tue May 08 16:05:02 2007 +0000
@@ -2467,23 +2467,11 @@
   "Take a macro function DEFINITION and make a lambda out of it."
   `(cdr ,definition))
 
-;; There is no way to determine whether some subr is a special form or not,
-;; hence we need this list (which is probably out of date):
-(defvar ad-special-forms
-  (let ((tem '(and catch cond condition-case defconst defmacro
-		   defun defvar function if interactive let let*
-		   or prog1 prog2 progn quote save-current-buffer
-		   save-excursion save-restriction save-window-excursion
-		   setq setq-default unwind-protect while
-		   with-output-to-temp-buffer)))
-    ;; track-mouse could be void in some configurations.
-    (if (fboundp 'track-mouse)
-	(push 'track-mouse tem))
-    (mapcar 'symbol-function tem)))
-
-(defmacro ad-special-form-p (definition)
-  ;;"non-nil if DEFINITION is a special form."
-  (list 'memq definition 'ad-special-forms))
+(defun ad-special-form-p (definition)
+  "Non-nil iff DEFINITION is a special form."
+  (if (and (symbolp definition) (fboundp definition))
+      (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."