mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
(cd): Handle leading "~" like an absolute filename.
This commit is contained in:
parent
62f61df0e7
commit
a91b2e223a
1 changed files with 18 additions and 17 deletions
|
|
@ -268,23 +268,24 @@ Not actually set up until the first time you you use it.")
|
|||
If your environment imcludes a $CDPATH variable, cd tries each one of that
|
||||
colon-separated list of directories when resolving a relative cd."
|
||||
(interactive "FChange default directory: ")
|
||||
(if (= (aref dir 0) ?/)
|
||||
(cd-absolute (expand-file-name dir))
|
||||
(if (null cd-path)
|
||||
(let ((trypath (parse-colon-path (getenv "CDPATH"))))
|
||||
(setq cd-path (or trypath "./"))))
|
||||
(if (not (catch 'found
|
||||
(mapcar
|
||||
(function (lambda (x)
|
||||
(let ((f (expand-file-name (concat x dir))))
|
||||
(if (file-directory-p f)
|
||||
(progn
|
||||
(cd-absolute f)
|
||||
(throw 'found t))))))
|
||||
cd-path)
|
||||
nil))
|
||||
(error "No such directory on your cd path.")))
|
||||
)
|
||||
(let ((first (aref dir 0)))
|
||||
(if (or (= first ?/) (= first ?~))
|
||||
(cd-absolute (expand-file-name dir))
|
||||
(if (null cd-path)
|
||||
(let ((trypath (parse-colon-path (getenv "CDPATH"))))
|
||||
(setq cd-path (or trypath "./"))))
|
||||
(if (not (catch 'found
|
||||
(mapcar
|
||||
(function (lambda (x)
|
||||
(let ((f (expand-file-name (concat x dir))))
|
||||
(if (file-directory-p f)
|
||||
(progn
|
||||
(cd-absolute f)
|
||||
(throw 'found t))))))
|
||||
cd-path)
|
||||
nil))
|
||||
(error "No such directory on your cd path.")))
|
||||
))
|
||||
|
||||
(defun load-file (file)
|
||||
"Load the Lisp file named FILE."
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue