In my emacs shell, I see this output:

^[[J~% echo $PS1
echo $PS1

On my other machine, this stuff doesn't show up at all. Can anyone suggest a reason why and how to fix it?

  • I'd test the shells, do echo $0 in both windows, make sure the shells are the same. – Rich Homolka Jun 27 '12 at 17:46

Your shell startup script is configuring the PS1 variable to output escape sequences as part of the prompt (perhaps to do colorized text or reverse video). An Emacs buffer can't do those things (at least not with escape sequences), so instead you see the raw escape sequence. You should be able to test the value of environment variable TERM in your shell startup code that is setting PS1. If the value of variable TERM is emacs, then don't insert the escape sequences into PS1.


You might also try going to the shell buffer and doing M-x ansi-color-for-comint-mode-on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.