aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/emacs-lisp/regexp-opt.el
diff options
context:
space:
mode:
authorStefan Monnier <[email protected]>2000-11-05 19:07:07 +0000
committerStefan Monnier <[email protected]>2000-11-05 19:07:07 +0000
commit7e1d6bdb408f48b3efe2168d52283af44087d481 (patch)
treeead44d33d5c16f1af2d4db288a1dff91a32d2e8f /lisp/emacs-lisp/regexp-opt.el
parent42121c23099e579c536fc74c959849023a30b0ce (diff)
(regexp-opt-group): Sort the strings when extracting a suffix.
Diffstat (limited to 'lisp/emacs-lisp/regexp-opt.el')
-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 de36f1d544..e849cd60b9 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."
(if (> (length xiffus) 0)
;; common suffix: take it and recurse on the prefixes.
(let* ((n (- (length xiffus)))
- (prefixes (mapcar (lambda (s) (substring s 0 n)) strings)))
+ (prefixes
+ ;; Sorting is necessary in cases such as ("ad" "d").
+ (sort (mapcar (lambda (s) (substring s 0 n)) strings)
+ 'string-lessp)))
(concat open-group
(regexp-opt-group prefixes t t)
(regexp-quote