I have followed instructions from How can I run Cygwin Bash Shell from within Emacs? this question and I have gone further and added the (setq explicit-bash-args '("--login" "-i")) command, however emacs continues to only display the dos prompt when I type M-x shell. In summery my .emacs file looks like this:
(defun cygwin-shell ()
"Run cygwin bash in shell mode."
(interactive)
(let ((explicit-shell-file-name "C:/cygwin/bin/bash"))
(call-interactively 'shell)))
(setq explicit-bash-args '("--login" "-i"))`
Please be gentle with the answers as I am right at the bottom of the famous vertical emacs learning curve!
If you implemented the answer from that question, note that you have to do
M-x cygwin-shellto start bash. If you want to use it for everyM-x shellyou need to callSince you stated that you are learning, here’s a few tips when trying this out.
C-x C-f ~/.emacsto open your .emacs file in your user path.M-x load-file [RET] .emacs: loads the buffer (no need to restart emacs)C-h a: If you are interested in some specific action, you can look it upC-h v [RET] variable: can inspect the variable, check the value ofexplicit-bash-argsfor instanceAnd, btw, I’m not sure what the “–login -i” does, but someone stated in a comment that you should have that so “ls” would work. If you have your cygwin bin path in your PATH environment variable, bash will find ls anyway. No need to escape the path variable either, this is handled by bash (do an
echo $PATHin bash when you get it working and you’ll see).