changeset 33209:f94f82069336

(regexp-opt-group): Sort the strings when extracting a suffix.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 05 Nov 2000 19:07:07 +0000
parents 4360c704c17f
children 19d92160ddac
files lisp/emacs-lisp/regexp-opt.el
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/regexp-opt.el	Sun Nov 05 03:49:38 2000 +0000
+++ b/lisp/emacs-lisp/regexp-opt.el	Sun Nov 05 19:07:07 2000 +0000
@@ -205,7 +205,10 @@
 	    (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