]> git.eshelyaron.com Git - emacs.git/commitdiff
(regexp-opt-group): Sort the strings when extracting a suffix.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 5 Nov 2000 19:07:07 +0000 (19:07 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 5 Nov 2000 19:07:07 +0000 (19:07 +0000)
lisp/emacs-lisp/regexp-opt.el

index de36f1d5446927614965cd90156b9837d2a0ae84..e849cd60b96095c70ff3a190bd33df677e32fef7 100644 (file)
@@ -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