commit: fix so that CL docstrings (with &key, etc.) handled properly

Aidan Kehoe kehoea at parhasard.net
Wed Feb 24 01:48:39 EST 2010


 Ar an tríú lá is fiche de mí Feabhra, scríobh Ben Wing: 

 > diff -r 14f0dd1fabdb -r b0f4adffca7d lisp/help.el
 > --- a/lisp/help.el	Mon Feb 22 22:04:55 2010 -0600
 > +++ b/lisp/help.el	Tue Feb 23 01:12:13 2010 -0600
 > @@ -1217,20 +1211,31 @@
 >  	  ((stringp arglist)
 >  	   (format "(%s %s)" function arglist)))))
 >  
 > -(defun function-documentation (function &optional strip-arglist)
 > -  "Return a string giving the documentation for FUNCTION, if any.
 > -If the optional argument STRIP-ARGLIST is non-nil, remove the arglist
 > -part of the documentation of internal subroutines."
 > +;; 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
 > +;; out.  If STIRP-ARGLIST is false, the cons will be (FULL-DOC . nil),
 > +;; where FULL-DOC is the full documentation without the embedded arglist
 > +;; stripped out.
 > +(defun function-documentation-1 (function &optional strip-arglist)
 >    (let ((doc (condition-case nil
 >  		 (or (documentation function)
 >  		     (gettext "not documented"))
 >  	       (void-function "(alias for undefined function)")
 > -	       (error "(unexpected error from `documention')"))))
 > +	       (error "(unexpected error from `documentation')")))
 > +	args)
 >      (when (and strip-arglist
 > -               (string-match "[\n\t ]*\narguments: ?(\\([^)]*\\))\n?\\'" doc))
 > +               (string-match "[\n\t ]*\narguments: ?(\\(.*\\))\n?\\'" doc))

This new regexp fails when the arguments: list includes newlines, as is the
case with #'write-region-internal. You could fix make-docfile.c to delete
the newlines, or you could change the string-match call to, say:

(string-match "[\n\t ]*\narguments: ?(\\([^\x00]*\\))\n?\\'" doc)

If there are zero octets in the argument symbols (which is asking for
trouble to start with), they’ll be printed as ^@, and that won’t interfere
with that regexp.

-- 
“Apart from the nine-banded armadillo, man is the only natural host of
Mycobacterium leprae, although it can be grown in the footpads of mice.”
  -- Kumar & Clark, Clinical Medicine, summarising improbable leprosy research



More information about the XEmacs-Patches mailing list