🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #670

Re: Sometimes emacs starts up in the wrong directory

#670
From: Rob Austein
Date: Fri, 11 Sep 1992 19:02
38 lines
2254 bytes
   Date: 11 Sep 92 01:39:44 GMT
   From: lipp@ashland.sierra.COM (Damon Lipparelli)

   You probably have the environment variable PWD set to your home directory.
   Trying adding a line like "unsetenv PWD" in your ".cshrc" file (or
   whatever) and then re-start emacs.  For some reason, emacs assumes that
   whatever is in PWD is where you wan't emacs to start up.

This is done by the following code in the function normal-top-level,
file startup.el (emacs 18.58):

    ;; In presence of symlinks, switch to cleaner form of default directory.
    (if (and (not (eq system-type 'vax-vms))
	     (getenv "PWD"))
	(setq default-directory (file-name-as-directory (getenv "PWD"))))

This seems weird to me.

1) Why is normal-top-level mucking with default directory at all?
It's not at all obvious from any of the documentation that executing
the function top-level will change the default directory.  If this is
really supposed to be a one-time startup action, it should be written
so that it only happens once.  Maybe there really need to be two
different top-level functions, initial-top-level and normal-top-level,
where initial-top-level does one-time setup operations then changes
the top-level function to normal-top-level and calls it.  If I recall
correctly this was essentially the startup architecture used by ITS
EMACS, modulo a few random Q-register names.

2) With what version of unix is this code believed to do something
useful?  It's a no-op under Mach386 for both /bin/sh and /bin/csh
unless I manually set the environment variable "PWD", in which case it
has the same effect described in the original bug report.  This seems
less than useful.

In short, the cited code looks like a kludge and should be flushed.

--Rob Austein <sra@epilogue.com>
Technical Details
Message-ID: <9209111502.aa10829@quern.epilogue.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!epilogue.com!sra
References: sra@epilogue.com (Rob Austein)

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!epilogue.com!sra
From: sra@epilogue.com (Rob Austein)
Subject: Re: Sometimes emacs starts up in the wrong directory
Message-ID: <9209111502.aa10829@quern.epilogue.com>
Sender: gnulists@ai.mit.edu
Organization: Gnus Not Usenet
References: sra@epilogue.com (Rob Austein)
Distribution: gnu
Date: Fri, 11 Sep 1992 19:02:44 GMT
Approved: bug-gnu-emacs@prep.ai.mit.edu
Lines: 39