changeset 5076:d555581e3cba

fix issues with display of argument docstrings -------------------- ChangeLog entries follow: -------------------- lib-src/ChangeLog addition: 2010-02-25 Ben Wing <ben@xemacs.org> * make-docfile.c: * make-docfile.c (write_c_args): Convert newlines to spaces so that argument lists are always on one line, because that's what function-documentation-1 expects. lisp/ChangeLog addition: c2010-02-25 Ben Wing <ben@xemacs.org> * autoload.el (make-autoload): Call cl-function-arglist with one arg. * cl-macs.el (cl-function-arglist): * cl-macs.el (cl-transform-lambda): Make cl-function-arglist take only one arg, the arglist; no function name passed. Also make sure to print () instead of nil when empty arglist, or function-documentation-1 won't recognize the arguments: line. * help.el (function-arglist): If empty arg, don't display extra space after function name.
author Ben Wing <ben@xemacs.org>
date Thu, 25 Feb 2010 04:10:52 -0600
parents cc74f60c150e
children d372b17f63ce
files lib-src/ChangeLog lib-src/make-docfile.c lisp/ChangeLog lisp/autoload.el lisp/cl-macs.el lisp/help.el
diffstat 6 files changed, 51 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/lib-src/ChangeLog	Tue Feb 23 05:11:15 2010 -0600
+++ b/lib-src/ChangeLog	Thu Feb 25 04:10:52 2010 -0600
@@ -1,3 +1,10 @@
+2010-02-25  Ben Wing  <ben@xemacs.org>
+
+	* make-docfile.c:
+	* make-docfile.c (write_c_args):
+	Convert newlines to spaces so that argument lists are always on one
+	line, because that's what function-documentation-1 expects.
+
 2010-02-11  Vin Shelton  <acs@xemacs.org>
  
  	* winclient.c: Bump connection retries to 20 because some people
--- a/lib-src/make-docfile.c	Tue Feb 23 05:11:15 2010 -0600
+++ b/lib-src/make-docfile.c	Thu Feb 25 04:10:52 2010 -0600
@@ -3,7 +3,7 @@
    Free Software Foundation, Inc.
    Copyright (C) 1995 Board of Trustees, University of Illinois.
    Copyright (C) 1998, 1999 J. Kean Johnston.
-   Copyright (C) 2001, 2002 Ben Wing.
+   Copyright (C) 2001, 2002, 2010 Ben Wing.
 
 This file is part of XEmacs.
 
@@ -651,11 +651,11 @@
 	}
 
       /* Print the C argument list as it would appear in lisp:
-	 print underscores as hyphens, and print commas and newlines
+	 print underscores as hyphens, and print commas, tabs and newlines
 	 as spaces.  Collapse adjacent spaces into one.  */
       if (c == '_')
 	c = '-';
-      else if (c == ',' /* || c == '\n' */)
+      else if (c == ',' || c == '\n' || c == '\t')
 	c = ' ';
       /* XEmacs change: handle \n below for readability */
 
@@ -682,18 +682,28 @@
 	  in_ident = 0;
 	  just_spaced = 0;
 	}
-      /* XEmacs change: if the character is carriage return or linefeed,
-	 escape it for the compiler */
+#if 0
+      /* [[ XEmacs change: if the character is carriage return or linefeed,
+	 escape it for the compiler ]] I doubt the clause with '\r' ever
+	 worked right, and outputting newlines now screws up the regexp
+	 in function-documentation-1, so don't do this; instead, we treat
+	 newlines like spaces. --ben */
       else if (c == '\n')
 	{
 	  putc('\\', out);
 	  putc('\n', out);
+	  c = ' ';
 	}
       else if (c == '\r')
 	{
 	  putc('\\', out);
 	  putc('\r', out);
 	}
+#else
+      else if (c == '\r') /* Just eat it, since we expect a newline to
+			     follow */
+	;
+#endif /* (not) 0 */
       else if (c != ' ' || !just_spaced)
 	{
 	  if (c >= 'a' && c <= 'z')
--- a/lisp/ChangeLog	Tue Feb 23 05:11:15 2010 -0600
+++ b/lisp/ChangeLog	Thu Feb 25 04:10:52 2010 -0600
@@ -1,3 +1,17 @@
+c2010-02-25  Ben Wing  <ben@xemacs.org>
+
+	* autoload.el (make-autoload):
+	Call cl-function-arglist with one arg.
+	
+	* cl-macs.el (cl-function-arglist):
+	* cl-macs.el (cl-transform-lambda):
+	Make cl-function-arglist take only one arg, the arglist; no
+	function name passed.  Also make sure to print () instead of nil
+	when empty arglist, or function-documentation-1 won't recognize
+	the arguments: line.
+	* help.el (function-arglist): If empty arg, don't display extra
+	space after function name.
+
 2010-02-23  Ben Wing  <ben@xemacs.org>
 
 	* help.el: fux typo in comment. (oops)
--- a/lisp/autoload.el	Tue Feb 23 05:11:15 2010 -0600
+++ b/lisp/autoload.el	Thu Feb 25 04:10:52 2010 -0600
@@ -286,11 +286,10 @@
 	     (body (nthcdr (get car 'doc-string-elt) form))
 	     (doc (if (stringp (car body)) (pop body))))
 	(if (memq car '(defmacro defmacro* defun defun*))
-	    (let ((arglist (nth 2 form))
-		  (placeholder (eval-when-compile (gensym))))
+	    (let ((arglist (nth 2 form)))
 	      (setq doc (concat (or doc "")
 				"\n\narguments: "
-				(cl-function-arglist placeholder arglist t)
+				(cl-function-arglist arglist)
 				"\n"))))
 	;; `define-generic-mode' quotes the name, so take care of that
 	(list 'autoload (if (listp name) name (list 'quote name)) file doc
--- a/lisp/cl-macs.el	Tue Feb 23 05:11:15 2010 -0600
+++ b/lisp/cl-macs.el	Thu Feb 25 04:10:52 2010 -0600
@@ -297,27 +297,22 @@
 	   (mapcar 'cl-upcase-arg arg)))
 	(t arg)))                         ; Maybe we are in initializer
 
-;; npak@ispras.ru
+;; npak@ispras.ru, modified by ben@666.com
 ;;;###autoload
-(defun cl-function-arglist (name arglist &optional omit-name)
+(defun cl-function-arglist (arglist)
   "Returns string with printed representation of arguments list.
 Supports Common Lisp lambda lists."
-  ;; #### I would just change this so that OMIT-NAME is always true and
-  ;; eliminate the argument, but this function is autoloaded, which means
-  ;; someone might be using it somewhere.
   (if (not (or (listp arglist) (symbolp arglist)))
       "Not available"
     (check-argument-type #'true-list-p arglist)
     (let ((print-gensym nil))
       (condition-case nil
-          (prin1-to-string
-	   (let ((args (cond ((null arglist) nil)
-			     ((listp arglist) (cl-upcase-arg arglist))
-			     ((symbolp arglist)
-			      (cl-upcase-arg (list '&rest arglist)))
-			     (t (wrong-type-argument 'listp arglist)))))
-	     (if omit-name args
-	       (cons (if (eq name 'cl-none) 'lambda name) args))))
+	  (let ((args (cond ((null arglist) nil)
+			    ((listp arglist) (cl-upcase-arg arglist))
+			    ((symbolp arglist)
+			     (cl-upcase-arg (list '&rest arglist)))
+			    (t (wrong-type-argument 'listp arglist)))))
+	    (if args (prin1-to-string args) "()"))
 	(t "Not available")))))
 
 (defun cl-transform-lambda (form bind-block)
@@ -325,7 +320,7 @@
 	 (bind-defs nil) (bind-enquote nil)
 	 (bind-inits nil) (bind-lets nil) (bind-forms nil)
 	 (header nil) (simple-args nil)
-         (complex-arglist (cl-function-arglist bind-block args t))
+         (complex-arglist (cl-function-arglist args))
          (doc ""))
     (while (or (stringp (car body)) (eq (car-safe (car body)) 'interactive))
       (push (pop body) header))
@@ -352,7 +347,7 @@
     ;; 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 bind-block simple-args t))
+                   (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'.
--- a/lisp/help.el	Tue Feb 23 05:11:15 2010 -0600
+++ b/lisp/help.el	Thu Feb 25 04:10:52 2010 -0600
@@ -1209,7 +1209,9 @@
 
 	    t))
 	  ((stringp arglist)
-	   (format "(%s %s)" function arglist)))))
+	   (if (> (length arglist) 0)
+	       (format "(%s %s)" function arglist)
+	     (format "(%s)" function))))))
 
 ;; If STRIP-ARGLIST is true, return a cons (DOC . ARGS) of the documentation
 ;; with any embedded arglist stripped out, and the arglist that was stripped