CVS update by aidan packages/xemacs-packages/xemacs-base ...
xemacs-cvs at xemacs.org
xemacs-cvs at xemacs.org
Sat Jan 12 12:55:57 EST 2008
User: aidan
Date: 08/01/12 18:55:57
Modified: packages/xemacs-packages/xemacs-base ChangeLog regexp-opt.el
Log:
Fix confusing and incorrect docstring for regexp-opt.
Revision Changes Path
1.207 +6 -0 XEmacs/packages/xemacs-packages/xemacs-base/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xemacs-base/ChangeLog,v
retrieving revision 1.206
retrieving revision 1.207
diff -u -p -r1.206 -r1.207
--- ChangeLog 2008/01/11 23:12:50 1.206
+++ ChangeLog 2008/01/12 17:55:56 1.207
@@ -1,3 +1,9 @@
+2008-01-12 Aidan Kehoe <kehoea at parhasard.net>
+
+ * regexp-opt.el (regexp-opt):
+ Clarify the treatment of regexp special characters in STRINGS,
+ taking on board input from Stephen. Thank you Stephen!
+
2008-01-11 Aidan Kehoe <kehoea at parhasard.net>
* regexp-opt.el: Merge revision 1.34 from GNU, of
1.5 +12 -6 XEmacs/packages/xemacs-packages/xemacs-base/regexp-opt.el
Index: regexp-opt.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/xemacs-base/regexp-opt.el,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -p -r1.4 -r1.5
--- regexp-opt.el 2008/01/11 23:12:50 1.4
+++ regexp-opt.el 2008/01/12 17:55:56 1.5
@@ -88,14 +88,19 @@
;;; Code:
+;; XEmacs; correct the docstring, make it clearer.
;;;###autoload
(defun regexp-opt (strings &optional paren)
- "Return a regexp to match a string in the list 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
-is enclosed by at least one regexp grouping construct.
-The returned regexp is typically more efficient than the equivalent regexp:
+ "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.
+
+If optional PAREN is non-nil, ensure that the returned regexp is enclosed by
+at least one regexp grouping construct. The returned regexp is typically
+more efficient than the equivalent regexp:
+
(let ((open (if PAREN \"\\\\(\" \"\")) (close (if PAREN \"\\\\)\" \"\")))
(concat open (mapconcat 'regexp-quote STRINGS \"\\\\|\") close))
@@ -117,7 +122,8 @@ by \\=\\< and \\>."
(re (regexp-opt-group sorted-strings open)))
(if words (concat "\\<" re "\\>") re))))
-;; XEmacs; added here. This is in subr.el in GNU.
+;; XEmacs; added here. This is in subr.el in GNU; this implementation is
+;; from their revision 1.541 of 2007-01-04, under GPL 2.
(defun-when-void subregexp-context-p (regexp pos &optional start)
"Return non-nil if POS is in a normal subregexp context in REGEXP.
A subregexp context is one where a sub-regexp can appear.
More information about the XEmacs-CVS
mailing list