diff lisp/cl-macs.el @ 5514:9d519ab9fd68

Be a little better about deciding when to add CL docstring argument info. 2011-05-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (cl-transform-lambda): Move the code to decide whether to add argument information to the docstring a little later, so the information about what the function's docstring ends up being is a little more exact.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 29 May 2011 18:17:09 +0100
parents 7b5254f6e0d5
children 544e6336d37c
line wrap: on
line diff
--- a/lisp/cl-macs.el	Fri May 27 14:31:56 2011 +0100
+++ b/lisp/cl-macs.el	Sun May 29 18:17:09 2011 +0100
@@ -380,15 +380,6 @@
 	(setq body (list (list* 'block bind-block body))))
     (setq simple-args (nreverse simple-args)
           header (nreverse header))
-    ;; Add CL lambda list to documentation, if the CL lambda list differs
-    ;; from the non-CL lambda list. npak@ispras.ru
-    (unless (equal complex-arglist
-                   (cl-function-arglist simple-args))
-      (and (stringp (car header)) (setq doc (pop header)))
-      ;; Stick the arguments onto the end of the doc string in a way that
-      ;; will be recognized specially by `function-arglist'.
-      (push (concat doc "\n\narguments: " complex-arglist "\n")
-	    header))
     (if (null args)
 	(list* nil simple-args (nconc header body))
       (if (memq '&optional simple-args) (push '&optional args))
@@ -398,7 +389,21 @@
       ;; This code originally needed to create the keywords itself, that
       ;; wasn't done by the Lisp reader; the first element of the result
       ;; list comprised code to do this. It's not used any more.
-      (list* nil (nconc simple-args (list '&rest (car (pop bind-lets))))
+      (list* nil (prog1
+                     (setq simple-args
+                           (nconc simple-args
+                                  (list '&rest (car (pop bind-lets)))))
+                   ;; Add CL lambda list to documentation, if the CL lambda
+                   ;; list differs from the non-CL lambda
+                   ;; list. npak@ispras.ru
+                   (unless (equal complex-arglist
+                                  (cl-function-arglist simple-args))
+                     (and (stringp (car header)) (setq doc (pop header)))
+                     ;; Stick the arguments onto the end of the doc string
+                     ;; in a way that will be recognized specially by
+                     ;; `function-arglist'.
+                     (push (concat doc "\n\narguments: " complex-arglist "\n")
+                           header)))
 	     ;; XEmacs change: we add usage information using Nickolay's
 	     ;; approach above
 	     (nconc header