help-emacs-windows
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[h-e-w] Some thoughts on using bash and cmd shells under emacs on Win2k


From: Underwood, Jonathan
Subject: [h-e-w] Some thoughts on using bash and cmd shells under emacs on Win2k e tc.
Date: Thu, 11 Oct 2001 13:42:29 -0400

Hi

I've been playing about trying to find some way of using both cygwins bash
and cmd.exe as shells under emacs, and the following points have arises. In
an ideal world, it would be nice to have two functions, one to set the shell
to cmd, the other to set it to bash. My motivation for doing this is that I
use cygwin for programming, but also use MikTex for latex, and i find that
if i set the shell to bash, then latex fails to function properly. Anyway,
i'm going around in circles with it somewhat, so i thought i'd air what
occurs to me here, and hope for any helpful comments :)

Here's what seems to be a fairly conventional way of setting bash as the
shell:

        (setq exec-path (append (list "c:/usr/cygwin/bin") exec-path))
        (setenv "PATH" (concat "C:/usr/cygwin/bin;" (getenv "PATH")))
        (setq process-coding-system-alist '(("bash" . undecided-unix)))
        (setq w32-quote-process-args ?\")

        (setq shell-file-name "bash")
        (setenv "SHELL" shell-file-name) 
        (setq explicit-shell-file-name shell-file-name) 

        (add-hook 'comint-output-filter-functions
                  'comint-strip-ctrl-m)

Now, this seems to me to be problematic in several ways:
1) Emacs, by invoking bash using bash.exe -c, runs a non-interactive shell.
That means, as stated in man bash, that the PATH variable is ignored. I'm
not sure why, but in reality this means that the PATH as set by windows
isn't in fact ignored, but any settings in the startup file, and this is why
the (setenv "PATH"..) line above is required. However, adding the cygwin/bin
directory to the PATH in this fashion then causes problems if you don't want
to have bash set as the shell (eg. if you swtich explicit-shell-name back to
"cmd") - for instance, it seems to be the adding of cygwin/bin to the path
which screws up latex.

2) far nicer would be to be able to provide the arguments "-i --login" to
bash to start bash interactively, such that the PATH variable would be set
and used correctly within bash. I've seen lines like
        (setq explicit-bash.exe-args '("-login" "-i"))  
in peoples .emacs files on the web, but this variable seems to be completely
undefined and so this doesn;t do anything (sadly). Unless i'm missing a
package?

3)In some ways it would be nice to have shell-file-name set to one shell and
explicit-shell-file-name set to another shell. This, i imagine opens up a
world of pain though.

Anyway, any thoughts greatfully received.

jonathan.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]