> However, the problem I'm having seems to be caused by the cd <makedir>
> command having no effect, as with the person you previously responded
> to. I was able to cut and paste that command (from the build's
> compilation buffer) into a regular emacs shell, and see it not work
> there either:
>
> e.g.
> cd c:/src/depot/JavaBrowser/Current/build
> does not work in a regular emacs shell using a w2k cmd prompt, but
> cd c:\src\depot\JavaBrowser\Current\build
> and
> cd "c:/src/depot/JavaBrowser/Current/build"
> both work...
>
> I figure this is the reason that it's not working for the build, it's
> all a bit puzzling to me...
Righto. I've done a bit of research. No real fixes, but this is
about as much time as I should spend on it today. Acutally, I've
spent more than I should, but this was interesting.
The problem is due to an evil and unfortunate interaction between the
function jde-normalize-path (defined in jde.el) and the compilation
buffer when cmd.exe or command.exe is your shell; this would probably
be the default situation for a lot of Win32 users, despite the web
site recommendation that Cygwin and bash be installed and used.
jde-normalize-path calls a couple of standard emacs functions:
substitute-in-file-name
expand-file-name
These functions do the bulk of processing by substituting environment
varibles, (which works very nicely, and I might start using), and
expanding ~ to be the current home directory. The majority of extra
work done by jde-normalize-path is to convert relative paths based on
locations of prj.el, and then call jde-convert-cygwin-path, which may
or may not make further conversions.
jde-normalize-path is not an interactive function, but you can
experiment with its behaviour interactively using ielm. '[M-x]ielm'
should do it. Here some example output.
*** Welcome to IELM *** Type (describe-mode) for help.
ELISP> (jde-normalize-path "d:\\home\\craig")
"d:/home/craig"
ELISP>
This mode has tab completion of currently defined elisp functions and
variables, and external file names, so is very nice to use.
Emacs strings require \ to be quoted with \, hence the \\ in the
string that I pass to jde-normalize-path. Note that jde-normalize-
path returns a string with / as the path separator. This is because
internally, jde-normalize-path forces the varible directory-sep-char
to / (?/ in emacs representation if you want to look at the source)
before calling the standard emacs functions I mentioned earlier.
Setting directory-sep-char changes the behaviour of those functions,
and they return the path with /.
This is what is happening. Why it is like this, I don't know.
Next, try opening a standard windows command shell. I use NT4.0, so
I have cmd.exe as my example. Use the path string that jde-normalize-
path is returning in a cd command.
D:\cygwin>cd d:/home/craig
D:\cygwin
D:\cygwin>
And there is the exact behaviour that is mystifying everyone. cmd's
internal cd implementation (for cd is an 'internal command' in
Microsoft parlance) is ignoring 'd:/home/craig' because it doesn't
recognise it, and is performing its standard behaviour when given no
arguments; it is reporting the current directory.
If you set bash as your shell for emacs, then it will cope with the
forward slashes.
I'm too lazy to actually try and think of a reliable and robust fix
(actually I have no idea what all of the possible combinations are,
and am frightened of touching anything in case I break what is
already working), but there is a reliable work around. Install
Cygwin, and set bash as the default shell. Here are the relevant
entries from my .emacs, which I think I copied off of the JDE site
somewhere.
(setq binary-process-input t)
(setq w32-quote-process-args ?\")
(setq shell-file-name "bash")
(setenv "SHELL" shell-file-name)
(setq explicit-shell-file-name shell-file-name)
(setq explicit-sh-args '("-login" "-i"))
-----------------+---------------------------------------------------
Craig McGeachie | #include <cheesy_tag.h>
+61 (410) 774902 | while (!inebriated) c2h5oh = (++bottle)->contents;
-----------------+---------------------------------------------------