changeset 4642:48b45a606961

Support #'function-arglist with built-in special forms. Also fix a couple of bugs in lisp/help.el. lisp/ChangeLog addition: 2009-06-14 Aidan Kehoe <kehoea@parhasard.net> * help.el (describe-function-1): Check macro-p, not macrop, when describing whether a symbol has an associated macro or an associated function. Relevant with autoloaded macros. (function-arglist): Accept multi-line arglists in built-in functions, as found in #'write-region-internal. #'dontusethis-set-symbol-value-handler is still broken for other reasons. src/ChangeLog addition: 2009-06-14 Aidan Kehoe <kehoea@parhasard.net> * eval.c (For): * eval.c (Fand): * eval.c (Fif): * eval.c (Fwhen): * eval.c (Fcond): * eval.c (Fprogn): * eval.c (Fprog1): * eval.c (Fprog2): * eval.c (FletX): * eval.c (Flet): * eval.c (Fwhile): * eval.c (Fdefvar): * eval.c (Fdefconst): * eval.c (Frun_hooks): * eval.c (Frun_hooks_with_args): * eval.c (Frun_hooks_with_args_until_success): * eval.c (Frun_hooks_with_args_until_failure): Add arguments information, understood by #'function-arglist, to all these special forms, functions and macros. Remove the argument information that was already there that was not understood by #'function-arglist.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 14 Jun 2009 15:07:13 +0100
parents a90b63846dc4
children e9ccbc62f7e7
files lisp/ChangeLog lisp/help.el src/ChangeLog src/eval.c src/symbols.c
diffstat 5 files changed, 98 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Jun 07 16:47:04 2009 +0100
+++ b/lisp/ChangeLog	Sun Jun 14 15:07:13 2009 +0100
@@ -1,3 +1,14 @@
+2009-06-14  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* help.el (describe-function-1): 
+	Check macro-p, not macrop, when describing whether a symbol has an
+	associated macro or an associated function. Relevant with
+	autoloaded macros. 
+	(function-arglist): 
+	Accept multi-line arglists in built-in functions, as found in
+	#'write-region-internal. #'dontusethis-set-symbol-value-handler
+	is still broken for other reasons. 
+
 2009-06-07  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* code-files.el (insert-file-contents): 
--- a/lisp/help.el	Sun Jun 07 16:47:04 2009 +0100
+++ b/lisp/help.el	Sun Jun 14 15:07:13 2009 +0100
@@ -1192,9 +1192,12 @@
 		 (let* ((doc (documentation function))
 			(args (and doc
 				   (string-match
-				    "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'"
+				    "[\n\t ]*\narguments: ?(\\([^)]*\\))\n?\\'"
 				    doc)
-				   (match-string 1 doc))))
+				   (match-string 1 doc)))
+                        (args (and args (replace-in-string args
+                                                           "[ ]*\\\\\n[ ]*"
+                                                           " " t))))
 		   ;; If there are no arguments documented for the
 		   ;; subr, rather don't print anything.
 		   (cond ((null args) t)
@@ -1402,7 +1405,7 @@
                                      (cond
                                       ((eq 'neither macro-p)
                                        "")
-                                      (macrop " macro")
+                                      (macro-p " macro")
                                       (t " function"))))
 			   string)))))
       (cond ((or (stringp def) (vectorp def))
--- a/src/ChangeLog	Sun Jun 07 16:47:04 2009 +0100
+++ b/src/ChangeLog	Sun Jun 14 15:07:13 2009 +0100
@@ -1,3 +1,27 @@
+2009-06-14  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* eval.c (For): 
+	* eval.c (Fand): 
+	* eval.c (Fif): 
+	* eval.c (Fwhen): 
+	* eval.c (Fcond):
+	* eval.c (Fprogn): 
+	* eval.c (Fprog1):
+	* eval.c (Fprog2): 
+	* eval.c (FletX): 
+	* eval.c (Flet): 
+	* eval.c (Fwhile): 
+	* eval.c (Fdefvar): 
+	* eval.c (Fdefconst): 
+	* eval.c (Frun_hooks): 
+	* eval.c (Frun_hooks_with_args): 
+	* eval.c (Frun_hooks_with_args_until_success):
+	* eval.c (Frun_hooks_with_args_until_failure):
+	Add arguments information, understood by #'function-arglist, to
+	all these special forms, functions and macros. Remove the 
+	argument information that was already there that was not
+	understood by #'function-arglist. 
+
 2009-06-02  Ron Isaacson  <Ron.Isaacson@morganstanley.com>
 
 	* nt.c (mswindows_link): Fix off-by-one bug in mswindows_link:
--- a/src/eval.c	Sun Jun 07 16:47:04 2009 +0100
+++ b/src/eval.c	Sun Jun 14 15:07:13 2009 +0100
@@ -816,9 +816,11 @@
    from interpreted code.  The byte compiler turns them into bytecodes. */
 
 DEFUN ("or", For, 0, UNEVALLED, 0, /*
-Eval args until one of them yields non-nil, then return that value.
-The remaining args are not evalled at all.
+Eval ARGS until one of them yields non-nil, then return that value.
+The remaining ARGS are not evalled at all.
 If all args return nil, return nil.
+
+arguments: (&rest ARGS)
 */
        (args))
 {
@@ -835,9 +837,11 @@
 }
 
 DEFUN ("and", Fand, 0, UNEVALLED, 0, /*
-Eval args until one of them yields nil, then return nil.
-The remaining args are not evalled at all.
+Eval ARGS until one of them yields nil, then return nil.
+The remaining ARGS are not evalled at all.
 If no arg yields nil, return the last arg's value.
+
+arguments: (&rest ARGS)
 */
        (args))
 {
@@ -854,10 +858,12 @@
 }
 
 DEFUN ("if", Fif, 2, UNEVALLED, 0, /*
-\(if COND THEN ELSE...): if COND yields non-nil, do THEN, else do ELSE...
+If COND yields non-nil, do THEN, else do ELSE.
 Returns the value of THEN or the value of the last of the ELSE's.
 THEN must be one expression, but ELSE... can be zero or more expressions.
 If COND yields nil, and there are no ELSE's, the value is nil.
+
+arguments: (COND THEN &rest ELSE)
 */
        (args))
 {
@@ -876,8 +882,10 @@
    but it helps for bootstrapping to have them ALWAYS defined. */
 
 DEFUN ("when", Fwhen, 1, MANY, 0, /*
-\(when COND BODY...): if COND yields non-nil, do BODY, else return nil.
+If COND yields non-nil, do BODY, else return nil.
 BODY can be zero or more expressions.  If BODY is nil, return nil.
+
+arguments: (COND &rest BODY)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -895,8 +903,10 @@
 }
 
 DEFUN ("unless", Funless, 1, MANY, 0, /*
-\(unless COND BODY...): if COND yields nil, do BODY, else return nil.
+If COND yields nil, do BODY, else return nil.
 BODY can be zero or more expressions.  If BODY is nil, return nil.
+
+arguments: (COND &rest BODY)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -906,7 +916,7 @@
 }
 
 DEFUN ("cond", Fcond, 0, UNEVALLED, 0, /*
-\(cond CLAUSES...): try each clause until one succeeds.
+Try each clause until one succeeds.
 Each clause looks like (CONDITION BODY...).  CONDITION is evaluated
 and, if the value is non-nil, this clause succeeds:
 then the expressions in BODY are evaluated and the last one's
@@ -914,6 +924,8 @@
 If no clause succeeds, cond returns nil.
 If a clause has one element, as in (CONDITION),
 CONDITION's value if non-nil is returned from the cond-form.
+
+arguments: (&rest CLAUSES)
 */
        (args))
 {
@@ -938,7 +950,9 @@
 }
 
 DEFUN ("progn", Fprogn, 0, UNEVALLED, 0, /*
-\(progn BODY...): eval BODY forms sequentially and return value of last one.
+Eval BODY forms sequentially and return value of last one.
+
+arguments: (&rest BODY)
 */
        (args))
 {
@@ -963,13 +977,14 @@
 
 DEFUN ("prog1", Fprog1, 1, UNEVALLED, 0, /*
 Similar to `progn', but the value of the first form is returned.
-\(prog1 FIRST BODY...): All the arguments are evaluated sequentially.
-The value of FIRST is saved during evaluation of the remaining args,
-whose values are discarded.
+
+All the arguments are evaluated sequentially.  The value of FIRST is saved
+during evaluation of the remaining args, whose values are discarded.
+
+arguments: (FIRST &rest BODY)
 */
        (args))
 {
-  /* This function can GC */
   Lisp_Object val;
   struct gcpro gcpro1;
 
@@ -988,9 +1003,11 @@
 
 DEFUN ("prog2", Fprog2, 2, UNEVALLED, 0, /*
 Similar to `progn', but the value of the second form is returned.
-\(prog2 FIRST SECOND BODY...): All the arguments are evaluated sequentially.
-The value of SECOND is saved during evaluation of the remaining args,
-whose values are discarded.
+
+All the arguments are evaluated sequentially.  The value of SECOND is saved
+during evaluation of the remaining args, whose values are discarded.
+
+arguments: (FIRST SECOND &rest BODY)
 */
        (args))
 {
@@ -1015,11 +1032,13 @@
 }
 
 DEFUN ("let*", FletX, 1, UNEVALLED, 0, /*
-\(let* VARLIST BODY...): bind variables according to VARLIST then eval BODY.
+Bind variables according to VARLIST then eval BODY.
 The value of the last form in BODY is returned.
 Each element of VARLIST is a symbol (which is bound to nil)
 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).
 Each VALUEFORM can refer to the symbols already bound by this VARLIST.
+
+arguments: (VARLIST &rest BODY)
 */
        (args))
 {
@@ -1055,11 +1074,13 @@
 }
 
 DEFUN ("let", Flet, 1, UNEVALLED, 0, /*
-\(let VARLIST BODY...): bind variables according to VARLIST then eval BODY.
+Bind variables according to VARLIST then eval BODY.
 The value of the last form in BODY is returned.
 Each element of VARLIST is a symbol (which is bound to nil)
 or a list (SYMBOL VALUEFORM) (which binds SYMBOL to the value of VALUEFORM).
 All the VALUEFORMs are evalled before any symbols are bound.
+
+arguments: (VARLIST &rest BODY)
 */
        (args))
 {
@@ -1124,9 +1145,11 @@
 }
 
 DEFUN ("while", Fwhile, 1, UNEVALLED, 0, /*
-\(while TEST BODY...): if TEST yields non-nil, eval BODY... and repeat.
+If TEST yields non-nil, eval BODY... and repeat.
 The order of execution is thus TEST, BODY, TEST, BODY and so on
 until TEST returns nil.
+
+arguments: (TEST &rest BODY)
 */
        (args))
 {
@@ -1255,7 +1278,7 @@
 }
 
 DEFUN ("defvar", Fdefvar, 1, UNEVALLED, 0, /*
-\(defvar SYMBOL INITVALUE DOCSTRING): define SYMBOL as a variable.
+Define SYMBOL as a variable.
 You are not required to define a variable in order to use it,
  but the definition can supply documentation and an initial value
  in a way that tags can recognize.
@@ -1272,6 +1295,8 @@
 If INITVALUE is missing, SYMBOL's value is not set.
 
 In lisp-interaction-mode defvar is treated as defconst.
+
+arguments: (SYMBOL &optional INITVALUE DOCSTRING)
 */
        (args))
 {
@@ -1310,8 +1335,7 @@
 }
 
 DEFUN ("defconst", Fdefconst, 2, UNEVALLED, 0, /*
-\(defconst SYMBOL INITVALUE DOCSTRING): define SYMBOL as a constant
-variable.
+Define SYMBOL as a constant variable.
 The intent is that programs do not change this value, but users may.
 Always sets the value of SYMBOL to the result of evalling INITVALUE.
 If SYMBOL is buffer-local, its default value is what is set;
@@ -1325,6 +1349,8 @@
  their own values for such variables before loading the library.
 Since `defconst' unconditionally assigns the variable,
  it would override the user's choice.
+
+arguments: (SYMBOL &optional INITVALUE DOCSTRING)
 */
        (args))
 {
@@ -4285,6 +4311,8 @@
 
 To make a hook variable buffer-local, use `make-local-hook',
 not `make-local-variable'.
+
+arguments: (&rest HOOKS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -4309,6 +4337,8 @@
 
 To make a hook variable buffer-local, use `make-local-hook',
 not `make-local-variable'.
+
+arguments: (HOOK &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -4325,6 +4355,8 @@
 
 To make a hook variable buffer-local, use `make-local-hook',
 not `make-local-variable'.
+
+arguments: (HOOK &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
@@ -4341,6 +4373,8 @@
 
 To make a hook variable buffer-local, use `make-local-hook',
 not `make-local-variable'.
+
+arguments: (HOOK &rest ARGS)
 */
        (int nargs, Lisp_Object *args))
 {
--- a/src/symbols.c	Sun Jun 07 16:47:04 2009 +0100
+++ b/src/symbols.c	Sun Jun 14 15:07:13 2009 +0100
@@ -3104,7 +3104,7 @@
 pity, thereby invalidating your code.
 */
        (variable, handler_type, handler, harg,
-	UNUSED (keep_existing)))
+	UNUSED (keep_existing )))
 {
   Lisp_Object valcontents;
   struct symbol_value_lisp_magic *bfwd;