changeset 4795:084056f46755

#'functionp gives nil for special forms, as in CL and GNU Emacs 23. src/ChangeLog addition: 2009-12-31 Aidan Kehoe <kehoea@parhasard.net> * eval.c (Ffunctionp): Special forms no longer give t in this function, in accordance with recent GNU Emacs and with Common Lisp. tests/ChangeLog addition: 2010-01-01 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Test #'functionp, making sure it gives nil for special forms.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 01 Jan 2010 00:21:07 +0000
parents 8484c6c76837
children c45fdd4e1858
files src/ChangeLog src/eval.c tests/ChangeLog tests/automated/lisp-tests.el
diffstat 4 files changed, 35 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Thu Dec 31 15:47:03 2009 +0000
+++ b/src/ChangeLog	Fri Jan 01 00:21:07 2010 +0000
@@ -1,3 +1,9 @@
+2009-12-31  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* eval.c (Ffunctionp): 
+	Special forms no longer give t in this function, in accordance
+	with recent GNU Emacs and with Common Lisp.
+
 2009-12-21  Jerry James  <james@xemacs.org>
 
 	* config.h.in: Remove OffiX support.
--- a/src/eval.c	Thu Dec 31 15:47:03 2009 +0000
+++ b/src/eval.c	Fri Jan 01 00:21:07 2010 +0000
@@ -4144,7 +4144,9 @@
   if (SYMBOLP (object))
     object = indirect_function (object, 0);
 
-  if (COMPILED_FUNCTIONP (object) || SUBRP (object))
+  if (COMPILED_FUNCTIONP (object)
+      || (SUBRP (object)
+	  && (XSUBR (object)->max_args != UNEVALLED)))
     return Qt;
   if (CONSP (object))
     {
@@ -4152,7 +4154,8 @@
       if (EQ (car, Qlambda))
 	return Qt;
       if (EQ (car, Qautoload)
-	  && NILP (Fcar_safe (Fcdr_safe (Fcdr_safe (Fcdr_safe (XCDR (object)))))))
+	  && NILP (Fcar_safe (Fcdr_safe(Fcdr_safe
+					(Fcdr_safe (XCDR (object)))))))
 	return Qt;
     }
   return Qnil;
--- a/tests/ChangeLog	Thu Dec 31 15:47:03 2009 +0000
+++ b/tests/ChangeLog	Fri Jan 01 00:21:07 2010 +0000
@@ -1,3 +1,8 @@
+2010-01-01  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* automated/lisp-tests.el: 
+	Test #'functionp, making sure it gives nil for special forms.
+
 2009-12-31  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* automated/lisp-tests.el: 
--- a/tests/automated/lisp-tests.el	Thu Dec 31 15:47:03 2009 +0000
+++ b/tests/automated/lisp-tests.el	Fri Jan 01 00:21:07 2010 +0000
@@ -2162,4 +2162,23 @@
 ;; development on equalp should still run them, though. Aidan Kehoe, Thu Dec
 ;; 31 14:53:52 GMT 2009. 
 
+(loop
+  for special-form in '(multiple-value-call setq-default quote throw
+			save-current-buffer and or)
+  with not-special-form = nil
+  do
+  (Assert (special-form-p special-form)
+	  (format "checking %S is a special operator" special-form))
+  (setq not-special-form 
+	(intern (format "%s-gMAu" (symbol-name special-form))))
+  (Assert (not (special-form-p not-special-form))
+	  (format "checking %S is a special operator" special-form))
+  (Assert (not (functionp special-form))
+	  (format "checking %S is not a function" special-form)))
+
+(loop
+  for real-function in '(find-file quote-maybe + - find-file-read-only)
+  do (Assert (functionp real-function)
+	     (format "checking %S is a function" real-function)))
+
 ;;; end of lisp-tests.el