Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I run EmacsW32 on Windows XP.

I would like to know how to tell Emacs to start a Cygwin shell when I do M-x shell. Right now it starts a Windows cmd shell and I have to start the Cygwin shell manually.

I know it can be done because I had it working before reinstalling Windows. But now I can't find the instructions.

share|improve this question
up vote 2 down vote accepted

This seems to have the information you're looking for:

Specifically add the following to the .emacs file:

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

(add-hook 'comint-output-filter-functions
'comint-watch-for-password-prompt nil t)

(setq explicit-shell-file-name "bash.exe")

;; For subprocesses invoked via the shell
;; (e.g., "shell -c command")
(setq shell-file-name explicit-shell-file-name)
share|improve this answer
I needed to add a bit more but the info was all there on the page you linked to. – Nifle Jan 30 '10 at 10:06

An alternative that I find easier is to set an environment variable like this:

variable ESHELL, value c:\ProgramFiles\cygwin\bin\bash.exe

(or wherever you've installed Cygwin, of course)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .