commit: #'special-form-p; don't error (thank you Jerry James); flesh out docstring.

Aidan Kehoe aidan-guest at alioth.debian.org
Tue Dec 18 17:00:38 EST 2007


changeset:   4335:c32e4dca02960324bf912d7902d8d908d7b2b086
tag:         tip
user:        Aidan Kehoe <kehoea at parhasard.net>
date:        Tue Dec 18 23:00:01 2007 +0100
files:       src/ChangeLog src/symbols.c
description:
#'special-form-p; don't error (thank you Jerry James); flesh out docstring.

2007-12-18  Aidan Kehoe  <kehoea at parhasard.net>

	* symbols.c (Fspecial_form_p):
	Following commentary from Jerry James, don't error if not passed a
	subr.

	Flesh out the docstring; give details of what a subr is, what a
	special form is, and why one should probably not write special
	forms oneself.


diff -r cdc2f70d43199e6f413f22bfb4484c18c8ef25f1 -r c32e4dca02960324bf912d7902d8d908d7b2b086 src/ChangeLog
--- a/src/ChangeLog	Tue Dec 18 21:47:27 2007 +0100
+++ b/src/ChangeLog	Tue Dec 18 23:00:01 2007 +0100
@@ -1,3 +1,13 @@ 2007-12-18  Aidan Kehoe  <kehoea at parhasa
+2007-12-18  Aidan Kehoe  <kehoea at parhasard.net>
+
+	* symbols.c (Fspecial_form_p):
+	Following commentary from Jerry James, don't error if not passed a
+	subr. 
+
+	Flesh out the docstring; give details of what a subr is, what a
+	special form is, and why one should probably not write special
+	forms oneself. 
+
 2007-12-18  Aidan Kehoe  <kehoea at parhasard.net>
 
 	* symbols.c (Fspecial_form_p): New.
diff -r cdc2f70d43199e6f413f22bfb4484c18c8ef25f1 -r c32e4dca02960324bf912d7902d8d908d7b2b086 src/symbols.c
--- a/src/symbols.c	Tue Dec 18 21:47:27 2007 +0100
+++ b/src/symbols.c	Tue Dec 18 23:00:01 2007 +0100
@@ -733,14 +733,23 @@ SUBR must be a built-in function.
 }
 
 DEFUN ("special-form-p", Fspecial_form_p, 1, 1, 0, /*
-Return whether SUBR is a special form.  SUBR must be built-in.
+Return whether SUBR is a special form.
+
+A special form is a built-in function (a subr, that is a function
+implemented in C, not Lisp) which does not necessarily evaluate all its
+arguments.  Much of the basic XEmacs Lisp syntax is implemented by means of
+special forms; examples are `let', `condition-case', `defun', `setq' and so
+on.
+
+If you intend to write a Lisp function that does not necessarily evaluate
+all its arguments, the portable (across emacs variants, and across Lisp
+implementations) way to go about it is to write a macro instead.  See
+`defmacro' and `backquote'.
 */
        (subr))
 {
-  subr = indirect_function (subr, 1);
-  CHECK_SUBR (subr);
-
-  return XSUBR (subr)->max_args == UNEVALLED ? Qt : Qnil;
+  subr = indirect_function (subr, 0);
+  return (SUBRP (subr) && XSUBR (subr)->max_args == UNEVALLED) ? Qt : Qnil;
 }
 
 DEFUN ("setplist", Fsetplist, 2, 2, 0, /*





More information about the XEmacs-Patches mailing list