Subject: Re: bug#12792: 24.2.50; shell-mode renders all its output in a yellow face

From: Dima Kogan <[email-masked]>
Date: Sun, 4 Nov 2012 19:23:43 -0800

> On Mon, 05 Nov 2012 00:39:46 +0100
> Wolfgang Jenkner <[email-masked]> wrote:
>
> On Sun, Nov 04 2012, Dima Kogan wrote:
> 
> > zsh is the main shell I use that looks to be problematic. I can consistently
> > observe the issues if I delete all ~/.zsh* files, then add just the following to
> > the .zshrc:
> >
> > export PS1="%F{red}%n@%m%f:%F{yellow}%~%f%(!.#.$) "
> 
> Could you please do
> 
> M-x ansi-color-for-comint-mode-off 
> 
> so that we may see the raw escape sequences generated by that PS1?

To clarify the test even more, I set my .zshrc to

unsetopt zle
unsetopt prompt_cr
unsetopt prompt_subst
export PS1="%F{red}%n@%m%f:%F{yellow}%~%f%(!.#.$) "

This is the complete .zshrc file. The unsetopt stuff turns off zsh's keyboard
processing. Probably doesn't matter, but i'm mentioning this for completeness.

In the shell I pressed enter a few times to see the prompt sequences; then I ran
a command that produces some output without ANSI codes. Then I ran a command
that does produce some ansi codes in its output. Then I ran the plain-output
command again.

The output (with all the 'escape' characters replaced with '\e' to make sure the
email handlers don't get confused):

\e[31mdima@shorty\e[39m:\e[33m~\e[39m$ 
\e[31mdima@shorty\e[39m:\e[33m~\e[39m$ 
\e[31mdima@shorty\e[39m:\e[33m~\e[39m$ seq 5
1
2
3
4
5
\e[31mdima@shorty\e[39m:\e[33m~\e[39m$ ls --color=auto -ld .emacs.d
drwxr-xr-x 6 dima dima 4096 Nov  3 15:31 \e[0m\e[01;34m.emacs.d\e[0m
\e[31mdima@shorty\e[39m:\e[33m~\e[39m$ seq 5
1
2
3
4
5
\e[31mdima@shorty\e[39m:\e[33m~\e[39m$ 

If I run the exact same sequence of commands with ansi-color-for-comint-mode-on
and the latest ansi-color.el, I see everything yellow (nil face), except for
".emacs.d", which is blue and the last prompt, which is all blue also. This
prompt would change to all yellow also if I press enter again. Not that the
prompt shouldn't be all blue.

If I evaluate your defun also, I get everything red (nil face also) until the
".emacs.d". The ".emacs.d" is blue, as it should be. From that point on, all the
plain output is black and all the prompts are blue. This is correct, except the
prompts still shouldn't be all blue.

Sorry for all the confusion.

dima