aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2000-11-05 19:07:07 +0000
committerStefan Monnier2000-11-05 19:07:07 +0000
commit7e1d6bdb408f48b3efe2168d52283af44087d481 (patch)
treeead44d33d5c16f1af2d4db288a1dff91a32d2e8f
parent42121c23099e579c536fc74c959849023a30b0ce (diff)
downloademacs-7e1d6bdb408f48b3efe2168d52283af44087d481.tar.gz
emacs-7e1d6bdb408f48b3efe2168d52283af44087d481.zip
(regexp-opt-group): Sort the strings when extracting a suffix.
-rw-r--r--lisp/emacs-lisp/regexp-opt.el5
1 files changed, 4 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index de36f1d5446..e849cd60b96 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -205,7 +205,10 @@ so we can use character sets rather than grouping parenthesis."
205 (if (> (length xiffus) 0) 205 (if (> (length xiffus) 0)
206 ;; common suffix: take it and recurse on the prefixes. 206 ;; common suffix: take it and recurse on the prefixes.
207 (let* ((n (- (length xiffus))) 207 (let* ((n (- (length xiffus)))
208 (prefixes (mapcar (lambda (s) (substring s 0 n)) strings))) 208 (prefixes
209 ;; Sorting is necessary in cases such as ("ad" "d").
210 (sort (mapcar (lambda (s) (substring s 0 n)) strings)
211 'string-lessp)))
209 (concat open-group 212 (concat open-group
210 (regexp-opt-group prefixes t t) 213 (regexp-opt-group prefixes t t)
211 (regexp-quote 214 (regexp-quote