aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1992-11-07 06:20:15 +0000
committerJim Blandy1992-11-07 06:20:15 +0000
commita4b33896457b89601be5bc3d2a580cdfe3034270 (patch)
tree7839583dbbc390d0b9bd7681f4416aa56c3cde06
parent1a3a6707240ac01920c578693969d4d96c0d1059 (diff)
downloademacs-a4b33896457b89601be5bc3d2a580cdfe3034270.tar.gz
emacs-a4b33896457b89601be5bc3d2a580cdfe3034270.zip
* startup.el (normal-top-level): Don't worry about setting
default-directory to PWD if PWD is shorter. And, if PWD isn't accurate, delete it.
-rw-r--r--lisp/startup.el25
1 files changed, 14 insertions, 11 deletions
diff --git a/lisp/startup.el b/lisp/startup.el
index f13aefec1a4..44b71681dda 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -126,18 +126,21 @@ directory name of the directory where the `.emacs' file was looked for.")
126 (if command-line-processed 126 (if command-line-processed
127 (message "Back to top level.") 127 (message "Back to top level.")
128 (setq command-line-processed t) 128 (setq command-line-processed t)
129 ;; In presence of symlinks, switch to cleaner form of default directory.
130 (if (not (eq system-type 'vax-vms)) 129 (if (not (eq system-type 'vax-vms))
131 (mapcar (function 130 (progn
132 (lambda (var) 131 ;; If the PWD environment variable isn't accurate, delete it.
133 (let ((value (getenv var))) 132 (let ((pwd (getenv "PWD")))
134 (if (and value 133 (and (stringp pwd)
135 (< (length value) (length default-directory)) 134 ;; Use FOO/., so that if FOO is a symlink, file-attributes
136 (equal (file-attributes default-directory) 135 ;; describes the directory linked to, not FOO itself.
137 (file-attributes value))) 136 (or (equal (file-attributes
138 (setq default-directory 137 (concat (file-name-as-directory pwd) "."))
139 (file-name-as-directory value)))))) 138 (file-attributes
140 '("PWD" "HOME"))) 139 (concat (file-name-as-directory default-directory)
140 ".")))
141 (setq process-environment
142 (delete (concat "PWD=" pwd)
143 process-environment)))))))
141 (setq default-directory (abbreviate-file-name default-directory)) 144 (setq default-directory (abbreviate-file-name default-directory))
142 (unwind-protect 145 (unwind-protect
143 (command-line) 146 (command-line)