changeset 1558:a7e915481db1

* 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.
author Jim Blandy <jimb@redhat.com>
date Sat, 07 Nov 1992 06:20:15 +0000
parents 816bfa185671
children b941e08deb56
files lisp/startup.el
diffstat 1 files changed, 14 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/startup.el	Sat Nov 07 06:17:04 1992 +0000
+++ b/lisp/startup.el	Sat Nov 07 06:20:15 1992 +0000
@@ -126,18 +126,21 @@
   (if command-line-processed
       (message "Back to top level.")
     (setq command-line-processed t)
-    ;; In presence of symlinks, switch to cleaner form of default directory.
     (if (not (eq system-type 'vax-vms))
-	(mapcar (function
-		 (lambda (var)
-		   (let ((value (getenv var)))
-		     (if (and value
-			      (< (length value) (length default-directory))
-			      (equal (file-attributes default-directory)
-				     (file-attributes value)))
-			 (setq default-directory
-			       (file-name-as-directory value))))))
-		'("PWD" "HOME")))
+	(progn
+	  ;; If the PWD environment variable isn't accurate, delete it.
+	  (let ((pwd (getenv "PWD")))
+	    (and (stringp pwd)
+		 ;; Use FOO/., so that if FOO is a symlink, file-attributes
+		 ;; describes the directory linked to, not FOO itself.
+		 (or (equal (file-attributes
+			     (concat (file-name-as-directory pwd) "."))
+			    (file-attributes
+			     (concat (file-name-as-directory default-directory)
+				     ".")))
+		     (setq process-environment
+			   (delete (concat "PWD=" pwd)
+				   process-environment)))))))
     (setq default-directory (abbreviate-file-name default-directory))
     (unwind-protect
 	(command-line)