changeset 4640:8cef85a39d2c

Make CDPATH handling portable, accept entries not matching "/$". 2009-06-06 Aidan Kehoe <kehoea@parhasard.net> * files.el (cd): Make CDPATH handling portable, accept entries without trailing slashes within it. Some style corrections from Stephen Turnbull, thank you Stephen.
author Aidan Kehoe <kehoea@parhasard.net>
date Sat, 06 Jun 2009 17:20:21 +0100
parents 7757334005ae
children a90b63846dc4
files lisp/ChangeLog lisp/files.el
diffstat 2 files changed, 13 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sat Jun 06 12:59:31 2009 +0100
+++ b/lisp/ChangeLog	Sat Jun 06 17:20:21 2009 +0100
@@ -1,3 +1,10 @@
+2009-06-06  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* files.el (cd): 
+	Make CDPATH handling portable, accept entries without trailing
+	slashes within it. Some style corrections from Stephen Turnbull,
+	thank you Stephen. 
+
 2009-05-29  Aidan Kehoe  <kehoea@parhasard.net>
 
 	* bytecomp.el (byte-compile-lambda): 
--- a/lisp/files.el	Sat Jun 06 12:59:31 2009 +0100
+++ b/lisp/files.el	Sat Jun 06 17:20:21 2009 +0100
@@ -595,12 +595,13 @@
 				   (null (getenv "CDPATH"))))))
   (if (file-name-absolute-p dir)
       (cd-absolute (expand-file-name dir))
-    ;; XEmacs
+    ;; XEmacs change. I'm not sure respecting CDPATH is the right thing to
+    ;; do under Windows.
     (unless (and cd-path (equal (getenv "CDPATH") cdpath-previous))
-      ;;#### Unix-specific
-      (let ((trypath (parse-colon-path
-		      (setq cdpath-previous (getenv "CDPATH")))))
-	(setq cd-path (or trypath (list "./")))))
+      (let ((trypath (split-path (setq cdpath-previous (getenv "CDPATH")))))
+	(setq cd-path (or (and trypath 
+			       (mapcar #'file-name-as-directory trypath))
+                          (file-name-as-directory "")))))
     (or (catch 'found
 	  (mapcar #'(lambda (x)
 		        (let ((f (expand-file-name (concat x dir))))