aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1993-06-11 16:02:27 +0000
committerRichard M. Stallman1993-06-11 16:02:27 +0000
commit30c5ce9c1075e21a019fc696e868797ab1739110 (patch)
treef3f30a617b4d40eef351fb6dbc3032df894aff9f
parentfa462250f38a3d106c8621bfb09ce505eb19fe65 (diff)
downloademacs-30c5ce9c1075e21a019fc696e868797ab1739110.tar.gz
emacs-30c5ce9c1075e21a019fc696e868797ab1739110.zip
(cd): Use file-name-absolute-p.
(cd-absolute): No longer interactive.
-rw-r--r--lisp/files.el41
1 files changed, 19 insertions, 22 deletions
diff --git a/lisp/files.el b/lisp/files.el
index b907449edb3..c31b75e1ce6 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -254,8 +254,7 @@ Not actually set up until the first time you you use it.")
254 cd-list))) 254 cd-list)))
255 255
256(defun cd-absolute (dir) 256(defun cd-absolute (dir)
257 "Change current directory to given absolute path DIR." 257 "Change current directory to given absolute file name DIR."
258 (interactive "DChange default directory: ")
259 (setq dir (expand-file-name dir)) 258 (setq dir (expand-file-name dir))
260 (if (not (eq system-type 'vax-vms)) 259 (if (not (eq system-type 'vax-vms))
261 (setq dir (file-name-as-directory dir))) 260 (setq dir (file-name-as-directory dir)))
@@ -267,27 +266,25 @@ Not actually set up until the first time you you use it.")
267 266
268(defun cd (dir) 267(defun cd (dir)
269 "Make DIR become the current buffer's default directory. 268 "Make DIR become the current buffer's default directory.
270If your environment imcludes a $CDPATH variable, cd tries each one of that 269If your environment includes a `CDPATH' variable, try each one of that
271colon-separated list of directories when resolving a relative cd." 270colon-separated list of directories when resolving a relative directory name."
272 (interactive "FChange default directory: ") 271 (interactive "FChange default directory: ")
273 (let ((first (aref dir 0))) 272 (if (file-name-absolute-p dir)
274 (if (or (= first ?/) (= first ?~)) 273 (cd-absolute (expand-file-name dir))
275 (cd-absolute (expand-file-name dir)) 274 (if (null cd-path)
276 (if (null cd-path) 275 (let ((trypath (parse-colon-path (getenv "CDPATH"))))
277 (let ((trypath (parse-colon-path (getenv "CDPATH")))) 276 (setq cd-path (or trypath (list "./")))))
278 (setq cd-path (or trypath (list "./"))))) 277 (if (not (catch 'found
279 (if (not (catch 'found 278 (mapcar
280 (mapcar 279 (function (lambda (x)
281 (function (lambda (x) 280 (let ((f (expand-file-name (concat x dir))))
282 (let ((f (expand-file-name (concat x dir)))) 281 (if (file-directory-p f)
283 (if (file-directory-p f) 282 (progn
284 (progn 283 (cd-absolute f)
285 (cd-absolute f) 284 (throw 'found t))))))
286 (throw 'found t)))))) 285 cd-path)
287 cd-path) 286 nil))
288 nil)) 287 (error "No such directory found via CDPATH environment variable"))))
289 (error "No such directory on your cd path.")))
290 ))
291 288
292(defun load-file (file) 289(defun load-file (file)
293 "Load the Lisp file named FILE." 290 "Load the Lisp file named FILE."