diff lisp/setup-paths.el @ 5003:6b6b0f8ab749

#'union doesn't preserve relative order; use #'delete-duplicates instead. 2010-02-07 Aidan Kehoe <kehoea@parhasard.net> * setup-paths.el (paths-find-emacs-roots) (paths-construct-info-path): * packages.el (packages-find-installation-package-directories): #'union doesn't guarantee that it will preserve the relative order of elements in its arguments; use #'delete-duplicates instead. Thank you for the bug reports, Robert Pluim, Stephen Turnbull.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 07 Feb 2010 14:37:35 +0000
parents 9c6ea1581159
children 54700d784be9
line wrap: on
line diff
--- a/lisp/setup-paths.el	Sun Feb 07 07:10:01 2010 -0600
+++ b/lisp/setup-paths.el	Sun Feb 07 14:37:35 2010 +0000
@@ -142,17 +142,19 @@
 				       invocation-name
 				       root-p))
 	 (potential-installation-roots
-	  (union
-	   (and configure-exec-prefix-directory
-		(list (file-name-as-directory
-		       configure-exec-prefix-directory)))
-	   (and configure-prefix-directory
-		(list (file-name-as-directory
-		       configure-prefix-directory)))
+	  (delete-duplicates
+           (append
+            (and configure-exec-prefix-directory
+                 (list (file-name-as-directory
+                        configure-exec-prefix-directory)))
+            (and configure-prefix-directory
+                 (list (file-name-as-directory
+                        configure-prefix-directory))))
            :test #'equal))
 	 (installation-roots
 	  (remove-if-not root-p potential-installation-roots)))
-    (union invocation-roots installation-roots :test #'equal)))
+    (delete-duplicates (nconc invocation-roots installation-roots)
+                       :test #'equal)))
 
 (defun paths-find-site-lisp-directory (roots)
   "Find the site Lisp directory of the XEmacs hierarchy.
@@ -260,24 +262,26 @@
 LAST-PACKAGE-HIERARCHIES are lists of package hierarchy roots,
 respectively."
   (let ((info-path-envval (getenv "INFOPATH")))
-    (union
-     (append
-      (let ((info-directory
-	     (paths-find-version-directory roots (list "info")
-					   nil nil
-					   configure-info-directory)))
-	(and info-directory
-	     (list info-directory)))
-      (packages-find-package-info-path early-package-hierarchies)
-      (packages-find-package-info-path late-package-hierarchies)
-      (packages-find-package-info-path last-package-hierarchies)
-      (and info-path-envval
-	   (paths-decode-directory-path info-path-envval 'drop-empties)))
-     (and (null info-path-envval)
-	  (union
-	   (paths-directories-which-exist configure-info-path)
-	   (paths-directories-which-exist paths-default-info-directories)
-           :test #'equal))
+    (delete-duplicates
+     (nconc
+      (append
+       (let ((info-directory
+              (paths-find-version-directory roots (list "info")
+                                            nil nil
+                                            configure-info-directory)))
+         (and info-directory
+              (list info-directory)))
+       (packages-find-package-info-path early-package-hierarchies)
+       (packages-find-package-info-path late-package-hierarchies)
+       (packages-find-package-info-path last-package-hierarchies)
+       (and info-path-envval
+            (paths-decode-directory-path info-path-envval 'drop-empties)))
+      (and (null info-path-envval)
+           (delete-duplicates
+            (nconc
+             (paths-directories-which-exist configure-info-path)
+             (paths-directories-which-exist paths-default-info-directories))
+           :test #'equal)))
      :test #'equal)))
 
 (defun paths-find-doc-directory (roots)