5

Post title: Unwanted escape sequences in shell mode that are NOT due to colorizing-attempts (see update below)

Any idea what can cause (unwanted) escape sequences to continue showing up in the Emacs shell prompt (i.e., M-x shell) despite:

(i) removing all color-related sequences from prompt definitions in the appropriate config files and

(ii) including the following in my init.el file:

(autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
(add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)

For example, this is what my shell prompt looks like (in Emacs)...

^[[J% 

...but this is how I've defined the prompt in my .zshrc file (I could be wrong but I suspect the issue is shell agnostic, i.e., I don't think it's specific to zsh).

PROMPT='%% '

Similarly, this is what my GHCi interpreter prompt (i.e., Haskell REPL) looks like:

^[[?1h^[=λ: 

...when this is the definition I've included in the ghci.conf file:

:set prompt "λ: "

Running Emacs 24.4 on Lubuntu 14.04 with zsh as default shell. (All zsh features are working correctly in Emacs; this seems like a cosmetic issue.)

UPDATE: Solved
Shoddy attention to detail on my part; the following line in my .zshrc profile was responsible:

export TERM=xterm-256color
  • There are more ANSI escape sequences than the ones that color your output. You just don't get to see them in other terminal emulators since they actually interpret them while M-x shell prints them out if it can't deal with them correctly. – wasamasa Dec 18 '14 at 10:36
  • 2
    Consider posting your update as an answer and accepting it. (This will make sure that this question does not show up in the list of unanswered questions.) – Constantine Dec 18 '14 at 18:04
  • okay, will do, thx (it says I have to wait two days before accepting my answer, so I'll do so at that time) – iceman Dec 18 '14 at 18:07
0

Actually, it was shoddy attention to detail on my part; the following line in my .zshrc profile was responsible:

export TERM=xterm-256color

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.