Mercurial > hg > xemacs-beta
comparison lisp/files.el @ 4645:f2a991ff6db0
Do not #'split-path on nil #'getenv result. <877hz7lzrt.fsf@yahoo.com.cn>
author | Jerry James <james@xemacs.org> |
---|---|
date | Mon, 29 Jun 2009 08:20:47 -0600 |
parents | 8cef85a39d2c |
children | 907697569a49 |
comparison
equal
deleted
inserted
replaced
4644:b0ae008bf1a0 | 4645:f2a991ff6db0 |
---|---|
591 ;; XEmacs change? (read-file-name => read-directory-name) | 591 ;; XEmacs change? (read-file-name => read-directory-name) |
592 (list (read-directory-name "Change default directory: " | 592 (list (read-directory-name "Change default directory: " |
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 |
597 (cd-absolute (expand-file-name dir)) | 597 (let* ((cdpath-current (getenv "CDPATH")) |
598 ;; XEmacs change. I'm not sure respecting CDPATH is the right thing to | 598 (trypath (if cdpath-current |
599 ;; do under Windows. | 599 (split-path (setq cdpath-previous cdpath-current)) |
600 (unless (and cd-path (equal (getenv "CDPATH") cdpath-previous)) | 600 nil))) ; null list |
601 (let ((trypath (split-path (setq cdpath-previous (getenv "CDPATH"))))) | 601 (if (file-name-absolute-p dir) |
602 (setq cd-path (or (and trypath | 602 (cd-absolute (expand-file-name dir)) |
603 ;; XEmacs change. I'm not sure respecting CDPATH is the right thing to | |
604 ;; do under Windows. | |
605 (unless (and cd-path (equal cdpath-current cdpath-previous)) | |
606 (setq cd-path (or (and trypath | |
603 (mapcar #'file-name-as-directory trypath)) | 607 (mapcar #'file-name-as-directory trypath)) |
604 (file-name-as-directory ""))))) | 608 (list (file-name-as-directory ""))))) |
605 (or (catch 'found | 609 (or (catch 'found |
606 (mapcar #'(lambda (x) | 610 (mapcar #'(lambda (x) |
607 (let ((f (expand-file-name (concat x dir)))) | 611 (let ((f (expand-file-name (concat x dir)))) |
608 (if (file-directory-p f) | 612 (if (file-directory-p f) |
609 (progn | 613 (progn |
610 (cd-absolute f) | 614 (cd-absolute f) |
611 (throw 'found t))))) | 615 (throw 'found t))))) |
612 cd-path) | 616 cd-path) |
613 nil) | 617 nil) |
614 ;; jwz: give a better error message to those of us with the | 618 ;; jwz: give a better error message to those of us with the |
615 ;; good taste not to use a kludge like $CDPATH. | 619 ;; good taste not to use a kludge like $CDPATH. |
616 (if (equal cd-path '("./")) | 620 (if (equal cd-path '("./")) |
617 (error "No such directory: %s" (expand-file-name dir)) | 621 (error "No such directory: %s" (expand-file-name dir)) |
618 (error "Directory not found in $CDPATH: %s" dir))))) | 622 (error "Directory not found in $CDPATH: %s" dir)))))) |
619 | 623 |
620 (defun load-file (file) | 624 (defun load-file (file) |
621 "Load the Lisp file named FILE." | 625 "Load the Lisp file named FILE." |
622 ;; This is a case where .elc makes a lot of sense. | 626 ;; This is a case where .elc makes a lot of sense. |
623 (interactive (list (let ((completion-ignored-extensions | 627 (interactive (list (let ((completion-ignored-extensions |