# HG changeset patch # User Eric S. Raymond # Date 735800501 0 # Node ID d22e01f5ab0ca3b6912efc9b8fde398ac8dd8ea8 # Parent 55e18ce6e98a487468ece899c87d91c8d6d54b9a (cd): Handle leading "~" like an absolute filename. diff -r 55e18ce6e98a -r d22e01f5ab0c lisp/files.el --- a/lisp/files.el Mon Apr 26 04:19:48 1993 +0000 +++ b/lisp/files.el Mon Apr 26 05:01:41 1993 +0000 @@ -268,23 +268,24 @@ 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."