Use Cygwin Bash automatically in Emacs

1

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.

Nifle

Posted 2010-01-27T17:20:49.280

Reputation: 31 337

Answers

2

This seems to have the information you're looking for: http://www.khngai.com/emacs/cygwin.php

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)

skarface

Posted 2010-01-27T17:20:49.280

Reputation: 1 088

I needed to add a bit more but the info was all there on the page you linked to. – Nifle – 2010-01-30T10:06:57.913

2

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)

user80418

Posted 2010-01-27T17:20:49.280

Reputation: 21