tags:

views:

34

answers:

2

I saw an answer here how to start the cygwin shell. However, the cygwin shell output is messed up.

(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"))

and here is a sample output of the shell

]0;~
seth@seth ~
$ cd ~
]0;~
seth@seth ~
$ dir
]0;~
seth@seth ~

as one can see, output is screwed up. How do i fix this?

edit: i just noticed that ^[]0 always appears at the end of each command \ otherwise output text works fine. Anyway to get rid of this ending?

+1  A: 

alright, i figured this out. in ~/.bashrc, i added

export PS1="\e[0;31m[\u@\h \W]\$ \e[m "

this makes prompt red in single line (which is easy on eyes vs the yellow in original cygwin prompt!)

see http://www.cyberciti.biz/faq/bash-shell-change-the-color-of-my-shell-prompt-under-linux-or-unix/

In addition, you have to make sure you do not use dos endings. To convert dos endings to unix, type C-x RET f unix and save or place in .emacs file

(set-buffer-file-coding-system 'unix)
Seth
A: 

Look into EmacsW32. With it, your .emacs configuration becomes

  (setq w32shell-cygwin-bin "c:\\cygwin\\bin")
  (require 'w32shell)
  (w32shell-add-emacs)
  (w32shell-set-shell "cygwin")

and everything works.

Laurynas Biveinis