32.9 Unset PWD Before Using Emacs
I've seen a number of strange situations in which Emacs can't find
files unless you type a
complete ("absolute") pathname (
1.21
)
,
starting from
the root (
/
). When you try to "visit" a file, you'll get the
message In my experience, this usually means that the C shell's PWD environment variable ( 6.3 ) has gotten set incorrectly. There are a few (relatively pathological) ways of tricking the C shell into making a mistake. More commonly though, I've seen a few systems on which the C shell sticks an extra slash into PWD : that is, its value will be something like /home/mike//Mail rather than /home/mike/Mail . UNIX doesn't care; it lets you stack up extra slashes without trouble. But Emacs interprets // as the root directory - that is, it discards everything to the left of the double slash. So if you're trying to edit the file /home/mike//Mail/output.txt , Emacs will look for /Mail/output.txt . Even if this file exists, it's not what you want. [This also happens when Emacs is called from a (Bourne) shell script that has changed its current directory without changing PWD . - JP ]
This problem is particularly annoying because the shell will
automatically reset
PWD
every time you change directories - so the
obvious solution, sticking What will work is defining an alias ( 10.1 ) :
A better solution might be to switch to another shell that doesn't have this problem. The Bourne shell ( sh ) obviously doesn't, since it doesn't keep track of your current directory. - |
|