emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Problems with ANSI colors in shell mode in Emacs 21.2.95.


From: Lute Kamstra
Subject: Problems with ANSI colors in shell mode in Emacs 21.2.95.
Date: Fri, 07 Feb 2003 18:17:40 +0100
User-agent: Gnus/5.090014 (Oort Gnus v0.14) Emacs/21.2.95 (i686-pc-linux-gnu)

Dear people,

I experience some problems with a colored prompt in shell mode.

I've defined a prompt for bash like this.

,----[ .bashrc ]
|     
PS1="\[\033[1;34m\][\[\033[1;31m\]\s-\v\[\033[1;34m\]|\[\033[1;31m\]\h\[\033[1;34m\]|\[\033[1;31m\]\W\[\033[1;34m\]]>\[\033[0m\]
 "
`----

As you can see, it's filled with escape sequences to get colored text.
The idea is to get a prompt like this:

[bash-2.04|occarina|lute]> 

The `[', `|', `|', `]' and `>' should be blue, the other text red.

I configured Emacs like this.
,----[ .emacs ]
| ;;;-------------------------------------------------------------------
| ;;; Shell mode.
| ;;;-------------------------------------------------------------------
| 
| ;; We sure want to use bash.
| (setq explicit-shell-file-name "/bin/bash")
| 
| ;; If you can't stop ANSI escape sequences, use them.
| (autoload 'ansi-color-for-comint-mode-on "ansi-color" nil t)
| (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on)
| 
| ;; This is what my shell prompt looks like.
| (setq shell-prompt-pattern "\\[[^|]+|[^|]+|[^|]+\\]> ")
`----

With Emacs 21.2 this setup works like a charm: I get the expected text
and colors in shell mode.  However, when I use Emacs 21.2.95, the
prompt looks like this:

^A^B[^A^Bbash-2.04^A^B|^A^Boccarina^A^B|^A^Blute^A^B]>^A^B

There are lots of control A and control B characters interspersed that
should not be there.  (To be able to send this mail, I replaced the
single control characters by double character lookalikes.)  The is
color right, though, in the sense that all text that is supposed to be
there has the right color.  The surplus control A and control B
characters have the same color of the normal text they directly
precede or succeed.

For comparison, in Emacs 21.2.95 and Emacs 21.2, doing a M-x
ansi-color-for-comint-mode-off results in an uncolored prompt that
look like this:

^A^[[1;34m^B[^A^[[1;31m^Bbash-2.04^A^[[1;34m^B|^A^[[1;31m^Boccarina^A^[[1;34m^B|^A^[[1;31m^Blute^A^[[1;34m^B]>^A^[[0m^B
 

and like this:

^[[1;34m[^[[1;31mbash-2.04^[[1;34m|^[[1;31moccarina^[[1;34m|^[[1;31mlute^[[1;34m]>^[[0m
 

respectively.

When I change the bash prompt and use:

PS1="[\s-\v|\h|\W]> "

I get a normal, uncolored prompt in both Emacs 21.2.95 and Emacs 21.2.

To be complete, here is the usual M-x report-emacs-bug information:

In GNU Emacs 21.2.95.1 (i686-pc-linux-gnu, Motif Version 2.1.30)
 of 2003-02-07 on occarina.pna.cwi.nl
configured using `configure  --prefix=/export/scratch1/lute/emacs-pretest 
--exec-prefix=/export/scratch1/lute/emacs-pretest --with-x-toolkit=motif 
--with-xpm --with-jpeg --with-tiff --with-gif --with-png --with-x'
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US
  locale-coding-system: iso-latin-1
  default-enable-multibyte-characters: t

I'll try to find out what is causing this problem.


Regards,

  Lute Kamstra.

-- 
Lute Kamstra  <address@hidden>
CWI  department PNA4
Room M233  phone (+31) 20 592 4214
[Echelon material: Vince Foster bluebird Sundevil]




reply via email to

[Prev in Thread] Current Thread [Next in Thread]