]> git.eshelyaron.com Git - emacs.git/commitdiff
* files.el (parse-colon-path): Use split-string.
authorChong Yidong <cyd@gnu.org>
Sun, 16 Sep 2012 15:57:28 +0000 (23:57 +0800)
committerChong Yidong <cyd@gnu.org>
Sun, 16 Sep 2012 15:57:28 +0000 (23:57 +0800)
Fixes: debbugs:12351
lisp/ChangeLog
lisp/files.el

index a7538e50d82078e7a99ecfed0b8f68c0bf07dcf7..b444761e55cd635564337ffb9c51f6229cff8b3c 100644 (file)
@@ -1,5 +1,7 @@
 2012-09-16  Chong Yidong  <cyd@gnu.org>
 
+       * files.el (parse-colon-path): Use split-string (Bug#12351).
+
        * window.el (special-display-popup-frame): Doc fix (Bug#8853).
        (display-buffer-function): Mark as obsolete.
 
index 4acdb5420896c5f9c5aab8ec949507fa596227e3..289f5c6b0b6b770f7347e09a58ce21d5b816898b 100644 (file)
@@ -658,22 +658,13 @@ Not actually set up until the first time you use it.")
 
 (defun parse-colon-path (search-path)
   "Explode a search path into a list of directory names.
-Directories are separated by occurrences of `path-separator'
-\(which is colon in GNU and GNU-like systems)."
-  ;; We could use split-string here.
-  (and search-path
-       (let (cd-list (cd-start 0) cd-colon)
-        (setq search-path (concat search-path path-separator))
-        (while (setq cd-colon (string-match path-separator search-path cd-start))
-          (setq cd-list
-                (nconc cd-list
-                       (list (if (= cd-start cd-colon)
-                                  nil
-                               (substitute-in-file-name
-                                (file-name-as-directory
-                                 (substring search-path cd-start cd-colon)))))))
-          (setq cd-start (+ cd-colon 1)))
-        cd-list)))
+Directories are separated by `path-separator' (which is colon in
+GNU and Unix systems).  Substitute environment variables into the
+resulting list of directory names."
+  (when (stringp search-path)
+    (mapcar (lambda (f)
+             (substitute-in-file-name (file-name-as-directory f)))
+           (split-string search-path path-separator t))))
 
 (defun cd-absolute (dir)
   "Change current directory to given absolute file name DIR."