[PATCH] Fix confusing and incorrect docstring for regexp-opt

Stephen J. Turnbull stephen at xemacs.org
Mon Jan 7 19:01:51 EST 2008


APPROVE

but as usual I have my personal preferences. ;-)

Aidan Kehoe writes:
 > 
 > Yes, my version is a bit long-winded. I think it’s clearer than the old
 > version, though; in a strict sense the old version was incorrect, too,
 > because every string that doesn’t use regexp special characters is a regexp.
 > 
 > 2008-01-07  Aidan Kehoe  <kehoea at parhasard.net>
 > 
 > 	* regexp-opt.el (regexp-opt): 
 > 	Clarify the treatment of regexp special characters in STRINGS.
 > 
 > XEmacs Packages source patch:
 > Diff command:   cvs -q diff -u
 > Files affected: xemacs-packages/xemacs-base/regexp-opt.el
 > ===================================================================
 > RCS
 > 
 > Index: xemacs-packages/xemacs-base/regexp-opt.el
 > ===================================================================
 > RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xemacs-base/regexp-opt.el,v
 > retrieving revision 1.3
 > diff -u -r1.3 regexp-opt.el
 > --- xemacs-packages/xemacs-base/regexp-opt.el	2003/10/29 16:31:46	1.3
 > +++ xemacs-packages/xemacs-base/regexp-opt.el	2008/01/07 12:27:44
 > @@ -94,8 +94,12 @@
 >  ;;;###autoload
 >  (defun regexp-opt (strings &optional paren)
 >    "Return a regexp to match a string in STRINGS.
 > -Each string should be unique in STRINGS and should not contain any regexps,
 > -quoted or not.  If optional PAREN is non-nil, ensure that the returned regexp
 > +Each string should be unique in STRINGS.  Regexp special characters in the
 > +elements of STRINGS will not be treated as special characters; that is to
 > +say, `regexp-opt' will call `regexp-quote' on the elements of STRINGS before
 > +constructing the regexp.

I would write

    "Return a regexp which matches exactly those strings in STRINGS.

    Each string in STRINGS should be unique.  Regexp special characters in
    the elements of STRINGS will not be treated specially in matching;
    they will be escaped as necessary in constructing the regexp."




More information about the XEmacs-Patches mailing list