This is odd. I have defined the following prompt in zsh:
local user_host='%{$terminfo[bold]$fg[green]%}%n @ %m%{$reset_color%}'
local current_dir='%{$terminfo[bold]$fg[blue]%} %~%{$reset_color%}'
local git_branch='$(git_prompt_info)%{$reset_color%}'
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
PROMPT="╭─${user_host} %D{[%a, %b %d %I:%M:%S]} ${current_dir} ${git_branch}
╰─%B$%b "
RPS1="${return_code}"
It works great on gnome-terminal as well as in an ansi-term terminal in Emacs (M-x ansi-term) - see the example below:

However, it does not work well under multi-term in Emacs as you can see below:

I thought multi-term would be capable of interpreting the same set of escape characters that a terminal like gnome-terminal or ansi-term does. Why is it not interpreting the escape characters returned by git-prompt_info and others correctly?
I have also tried:
- M-x
set-terminal-coding-systemand setting it toutf-8-unix TERM=eterm-colorwithin the multi-term terminal, or before calling Emacs, etc.TERM=within the multi-term terminal, or before calling Emacs, etc.- Removing any
export TERMfrom my.zshrc
Update (January 29, 2014):
The best solution so far seems to be to do the following:
TERM=xterm-256color
but causes another problem that I have reported here: Passing escape sequences to shells within ansi-term in Emacs.
The answer is most likely that
multi-termjust isn't prepared to accept those escape sequences, in that format, for whatever reason. This may be a configuration issue, bug, or intentional. Setting the mode to accept colors, i.e.TERM=xterm-256color, improves the situation because it then accepts color escape sequences similar to the standard format used among terminal emulators, e.g.:code borrowed from here
the salient part is the
[0;31mfor color, which is referenced in the linked thread in "Update 2" of your other question, asking why lines are printed out that begin with4mwhich is part of this color escape sequence.Here is more info, with a relevant excerpt:
I suspect, in your other question, the reason that alt+b and alt+f aren't working in your other question is due to the terminal width count being off because of improper interpretation of these escape sequences which are supposed to be non-printing or zero-width. I haven't messed with
multi-terma lot but the solution may involve usingtputor similar to allow it to properly understand the escape sequences.Possible relevant troubleshooting info