Emacs cygwin shell - output corrupted?

Here I saw the answer how to start the cygwin shell. However, the output of the cygwin shell is confused.

(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 shell

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

as you can see, the output is twisted. How to fix it?

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

+5
source share
4 answers

ok, i figured it out. in ~ / .bashrc, I added

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

this makes a red hint in one line (which is easy on the eyes against yellow in the original cygwin hint!)

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

, , end-end. dos unix, C-x RET f unix .emacs.

(set-buffer-file-coding-system 'unix)
+4

EmacsW32. .emacs

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

.

+2

In Emacs 24.2, I had to put the line export PS1=...from Seth's answer (2) in ~ / .emacs_bash instead of ~ / .bashrc.

+2
source

Using

export PS1="\e[0;32m\u@\h\e[m \e[0;33m\w\e[m\n\$ "

If you want to keep the original color and format.

+1
source

All Articles