views:

91

answers:

4

I run emacs on windows. I use cygwin and I have cygwin versions of ruby and rdebug installed as well. When I invoke M-x comint-run ENTER rdebug ENTER, I noticed that it is attempting to run rdebug.bat via the Microsoft Command prompt, instead of using bash to run rdebug (without the .bat). I'd like comint-run to use bash to invoke any process that it is asked to start. Any ideas on how I can do this?

If you are interested in why I'm doing this, see here for the long story: http://stackoverflow.com/questions/2261071/ideas-for-troubleshooting-emacs-error-apply-spawning-child-process-exec-forma

Minor progress

I did some digging around in the elisp code for comint-run and it looks like it finally calls into start-process - unfortunately, here I'm stuck since start-process is a function defined in C source code. And start-process, for some reason, seems to ignore the values of explicit-shell-file-name and shell-file-name.

+1  A: 

I have this in my .emacs

(setenv "SHELL" "C:/cygwin/bin/bash.exe")
(setq shell-file-name "C:/cygwin/bin/bash.exe")
(add-hook 'comint-output-filter-functions 'shell-strip-ctrl-m nil t)

I'm no elisp hacker and I copied and pasted this code from somewhere a long time ago. I don't know if it will help you. But at least it runs bash when I do "M-x shell".

Jörgen Lundberg
A: 

Jörgen Lundberg's answer will surely work, however Emacs first looks at the value of the variable explicit-shell-file-name to determine which shell to run for an interactive inferior shell (check the link for documentation). So, the sure-fire answer would be to set:

(setq explicit-shell-file-name "C:/cygwin/bin/bash.exe")
Trey Jackson
Doesn't work - I already have explicit-shell-file-name and shell-file-name set to bash (and indeed M-x shell invokes bash correctly). But comint-run seems to ignore these.
Rohith
You're right, I'm unsure the next step.
Trey Jackson
A: 

Check out this post on powershell in emacs. Maybe helpful.

Cheeso
A: 

In spite of a lot of elisp debugging, I couldn't figure out a way to customise the start-process to use cygwin bash. Now that I look back on this, it sort of makes sense to me: assuming that emacs uses start-process to start different processes that it needs internally as well, start-process would always need to invoke a shell which depends on the underlying operating system rather than any user customisations.

Rohith