Mercurial > hg > xemacs-beta
changeset 4337:c32e4dca0296
#'special-form-p; don't error (thank you Jerry James); flesh out docstring.
2007-12-18 Aidan Kehoe <kehoea@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.
author | Aidan Kehoe <kehoea@parhasard.net> |
---|---|
date | Tue, 18 Dec 2007 23:00:01 +0100 |
parents | cdc2f70d4319 |
children | 528c4d906843 2834fcbd1a92 |
files | src/ChangeLog src/symbols.c |
diffstat | 2 files changed, 24 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- 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@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@parhasard.net> * symbols.c (Fspecial_form_p): New.
--- 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, /*