Is your PS1 variable set to be bold, with white text on red background? Change it to contain no colors (control codes) at all.
Main Topics
Browse All TopicsI am using Emacs 23, puttying (with Xming) through SSH to a Ubuntu 8.10 VMWare machine from Windows Vista.
All display characters look fine, both in Emacs and in the native Bash shell. When, however, I enter M-x shell within Emacs in the Putty/Xming connection, my PS1 prompt is:
^[[1m^[[41m^[[37mSat May 30 user ~ ^[[0m
(A similar thing happens when I run a Python interpreter session within the same Emacs configuration.)
Have looked all around for Putty, Emacs 23 encoding, etc. help, but am stuck.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I have pasted in my env below. I understand now that the codes are color escape codes and, yes, my prompt is white on red. Removing the color does indeed remove the escape codes from the Emacs shell window.
If you are saying I cannot have a colorized prompt without having the escape codes appear in an Emacs shell window, I can remove the color permanently, but I am unclear as to why the Emacs shell window would not understand and handle it like my BASH shell does.
Many thanks,
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=3b72570
SSH_CLIENT=192.168.1.102 4495 22
SSH_TTY=/dev/pts/2
USER=user
LS_COLORS=no=00:fi=00:di=0
MAIL=/var/mail/user
PATH=/usr/local/sbin:/usr/
PWD=/home/user
LANG=en_US.UTF-8
HISTCONTROL=ignoreboth
SHLVL=1
HOME=/home/user
LOGNAME=user
SSH_CONNECTION=192.168.1.1
LESSOPEN=| /usr/bin/lesspipe %s
DISPLAY=localhost:11.0
LESSCLOSE=/usr/bin/lesspip
_=/usr/bin/env
OLDPWD=/usr/lib/python2.5/
Hi,
The reason is simple. You have created the red on white backgroud effect using the Escape sequences for a terminal type. But Xterm and Vi have different databases to query the terminal capabilties and they don't match.
You would either set your terminal type to xterm-color (export TERM=xtaer-color)
or
you would prevent vi to use escape sequences. (export LESS="-X" in tyour .bash_profile)
Cheers,
K.
It's not actually bash that understands the colours. The interpretation of these colours is done by the actual program that is writing to the terminal - putty in your case. This seems to work OK for you in bash - perhaps putty does an xterm emulation or maybe xterm is near enough to whatever actual terminal putty does emulate - vt320 or whatever.
The escape sequence is usually set by your .bashrc when it defines PS1 (the prompt string). In doing so, .bashrc may take some cognizance of the setting of TERM or it may not. On the other hand, putty may change its emulation behaviour as TERM changes (I really don't know if it does, but technically it could).
Now to your question : "I am unclear as to why the Emacs shell window would not understand and handle it like my BASH shell does". So am I - we need to do some more digging to find out what's happening here. When in a mis-behaving shell, can you please try the following an post results:
echo $TERM
echo $PS1
echo $0
stty -a
(PS1 didn't show up iwith the env command because it's not in the environment. Bash sets it per session. You can see such variables from the "set" command (which also re-displays env)).
Also your prompt may not work if emacs starts some shell other than bash. That's why I asked to see $0.
Business Accounts
Answer for Membership
by: Let_Me_BePosted on 2009-05-31 at 02:54:55ID: 24512013
Those are collor escape codes. For some reason Emacs does not seem to understand them. Switching to a black and white prompt would solve your problem.