Function: cd-absolute

cd-absolute is a byte-compiled function defined in files.el.gz.

Signature

(cd-absolute DIR)

Documentation

Change current directory to given absolute file name DIR.

Source Code

;; Defined in /usr/src/emacs/lisp/files.el.gz
(defun cd-absolute (dir)
  "Change current directory to given absolute file name DIR."
  ;; Put the name into directory syntax now,
  ;; because otherwise expand-file-name may give some bad results.
  (setq dir (file-name-as-directory dir))
  ;; We used to additionally call abbreviate-file-name here, for an
  ;; unknown reason.  Problem is that most buffers are setup
  ;; without going through cd-absolute and don't call
  ;; abbreviate-file-name on their default-directory, so the few that
  ;; do end up using a superficially different directory.
  (setq dir (expand-file-name dir))
  (if (not (file-directory-p dir))
      (error (if (file-exists-p dir)
                 "%s is not a directory"
               "%s: no such directory")
             dir)
    (unless (file-accessible-directory-p dir)
      (error "Cannot cd to %s:  Permission denied" dir))
    (setq default-directory dir)
    (setq list-buffers-directory dir)))