changeset 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 0cd784a6ec44
children 788c38f20376
files lisp/ChangeLog lisp/packages.el lisp/setup-paths.el
diffstat 3 files changed, 44 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Feb 07 07:10:01 2010 -0600
+++ b/lisp/ChangeLog	Sun Feb 07 14:37:35 2010 +0000
@@ -1,3 +1,13 @@
+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.
+
 2010-02-06  Ben Wing  <ben@xemacs.org>
 
 	* unicode.el:
--- a/lisp/packages.el	Sun Feb 07 07:10:01 2010 -0600
+++ b/lisp/packages.el	Sun Feb 07 14:37:35 2010 +0000
@@ -385,8 +385,10 @@
 (defun packages-find-installation-package-directories (roots)
   "Find the package directories in the XEmacs installation.
 ROOTS is a list of installation roots."
-  (union (paths-find-version-directories roots (list "") nil nil nil t)
-         (paths-find-site-directories roots (list "") nil) :test #'equal))
+  (delete-duplicates
+   (nconc (paths-find-version-directories roots (list "") nil nil nil t)
+          (paths-find-site-directories roots (list "") nil))
+   :test #'equal))
 
 (defun packages-find-package-hierarchies (package-directories &optional envvar default)
   "Find package hierarchies in a list of package directories.
--- 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)