# HG changeset patch # User Aidan Kehoe # Date 1198015201 -3600 # Node ID c32e4dca02960324bf912d7902d8d908d7b2b086 # Parent cdc2f70d43199e6f413f22bfb4484c18c8ef25f1 #'special-form-p; don't error (thank you Jerry James); flesh out docstring. 2007-12-18 Aidan Kehoe * 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 cdc2f70d4319 -r c32e4dca0296 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 + + * 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 * symbols.c (Fspecial_form_p): New. diff -r cdc2f70d4319 -r c32e4dca0296 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 @@ } 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, /*