comparison lisp/files.el @ 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 555e21a66d51
children f2a991ff6db0
comparison
equal deleted inserted replaced
4639:7757334005ae 4640:8cef85a39d2c
593 default-directory default-directory 593 default-directory default-directory
594 (and (member cd-path '(nil ("./"))) 594 (and (member cd-path '(nil ("./")))
595 (null (getenv "CDPATH")))))) 595 (null (getenv "CDPATH"))))))
596 (if (file-name-absolute-p dir) 596 (if (file-name-absolute-p dir)
597 (cd-absolute (expand-file-name dir)) 597 (cd-absolute (expand-file-name dir))
598 ;; XEmacs 598 ;; XEmacs change. I'm not sure respecting CDPATH is the right thing to
599 ;; do under Windows.
599 (unless (and cd-path (equal (getenv "CDPATH") cdpath-previous)) 600 (unless (and cd-path (equal (getenv "CDPATH") cdpath-previous))
600 ;;#### Unix-specific 601 (let ((trypath (split-path (setq cdpath-previous (getenv "CDPATH")))))
601 (let ((trypath (parse-colon-path 602 (setq cd-path (or (and trypath
602 (setq cdpath-previous (getenv "CDPATH"))))) 603 (mapcar #'file-name-as-directory trypath))
603 (setq cd-path (or trypath (list "./"))))) 604 (file-name-as-directory "")))))
604 (or (catch 'found 605 (or (catch 'found
605 (mapcar #'(lambda (x) 606 (mapcar #'(lambda (x)
606 (let ((f (expand-file-name (concat x dir)))) 607 (let ((f (expand-file-name (concat x dir))))
607 (if (file-directory-p f) 608 (if (file-directory-p f)
608 (progn 609 (progn