aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric S. Raymond1993-04-26 05:01:41 +0000
committerEric S. Raymond1993-04-26 05:01:41 +0000
commita91b2e223a652004468aabfd7741467894d3e587 (patch)
treea8c5928a81822b4f69674e2a3052254481e63930
parent62f61df0e7986c2e73fea593145ba949a4768dfe (diff)
downloademacs-a91b2e223a652004468aabfd7741467894d3e587.tar.gz
emacs-a91b2e223a652004468aabfd7741467894d3e587.zip
(cd): Handle leading "~" like an absolute filename.
-rw-r--r--lisp/files.el35
1 files changed, 18 insertions, 17 deletions
diff --git a/lisp/files.el b/lisp/files.el
index 2820c235a07..b0f92ed0bb5 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -268,23 +268,24 @@ Not actually set up until the first time you you use it.")
268If your environment imcludes a $CDPATH variable, cd tries each one of that 268If your environment imcludes a $CDPATH variable, cd tries each one of that
269colon-separated list of directories when resolving a relative cd." 269colon-separated list of directories when resolving a relative cd."
270 (interactive "FChange default directory: ") 270 (interactive "FChange default directory: ")
271 (if (= (aref dir 0) ?/) 271 (let ((first (aref dir 0)))
272 (cd-absolute (expand-file-name dir)) 272 (if (or (= first ?/) (= first ?~))
273 (if (null cd-path) 273 (cd-absolute (expand-file-name dir))
274 (let ((trypath (parse-colon-path (getenv "CDPATH")))) 274 (if (null cd-path)
275 (setq cd-path (or trypath "./")))) 275 (let ((trypath (parse-colon-path (getenv "CDPATH"))))
276 (if (not (catch 'found 276 (setq cd-path (or trypath "./"))))
277 (mapcar 277 (if (not (catch 'found
278 (function (lambda (x) 278 (mapcar
279 (let ((f (expand-file-name (concat x dir)))) 279 (function (lambda (x)
280 (if (file-directory-p f) 280 (let ((f (expand-file-name (concat x dir))))
281 (progn 281 (if (file-directory-p f)
282 (cd-absolute f) 282 (progn
283 (throw 'found t)))))) 283 (cd-absolute f)
284 cd-path) 284 (throw 'found t))))))
285 nil)) 285 cd-path)
286 (error "No such directory on your cd path."))) 286 nil))
287 ) 287 (error "No such directory on your cd path.")))
288 ))
288 289
289(defun load-file (file) 290(defun load-file (file)
290 "Load the Lisp file named FILE." 291 "Load the Lisp file named FILE."