Commit 7e1d6bdb authored by Stefan Monnier's avatar Stefan Monnier
Browse files

(regexp-opt-group): Sort the strings when extracting a suffix.

parent 42121c23
......@@ -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)))
;; Sorting is necessary in cases such as ("ad" "d").
(sort (mapcar (lambda (s) (substring s 0 n)) strings)
(concat open-group
(regexp-opt-group prefixes t t)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment