Subject: bug#1279 closed by Chong Yidong <[email-masked]> (Re: color output from external programs not working by default in eshell)

From: [email-masked] (Emacs bug Tracking System)
Date: Thu, 22 Jan 2009 04:55:04 +0000

This is an automatic notification regarding your bug report
which was filed against the emacs package:

#1279: color output from external programs not working by default in eshell

It has been closed by Chong Yidong <[email-masked]>.

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact Chong Yidong <[email-masked]> by
replying to this email.

-- 
1279: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=1279
Emacs Bug Tracking System
Contact [email-masked] with problems

Subject: Re: color output from external programs not working by default in eshell
From: Chong Yidong <[email-masked]>
To: [email-masked]
Date: Wed, 21 Jan 2009 23:46:53 -0500

The 2009-01-21 checkin by John Wiegley fixes this.

>From [email-masked] Thu Oct 30 09:40:03 2008
To: [email-masked], [email-masked]
Subject: color output from external programs not working by default in eshell
Date: Fri, 31 Oct 2008 02:39:44 +1000
From: David Miani <[email-masked]>

--Boundary-00=_QNeCJjkcm/rkCQF
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit

When running eshell, using an external program that outputs in color results 
in the raw terminal escape codes being displayed. For example,
~ $ yaourt -Ss emacs
^[[3m^[[1;32mextra/^[[0m^[[0m^[[1memacs ^[[1;32m22.3-1 
^[[7m^[[1;33m[installed]^[[0m ^[[1;34m^[[0m
^[[3m     The Emacs Editor^[[0m
^[[3m^[[1;32mextra/^[[0m^[[0m^[[1msnd ^[[1;32m10.1-1^[[0m ^[[1;34m^[[0m
^[[3m     Snd is the emacs of sound editor^[[0m
^[[3m^[[1;32mextra/^[[0m^[[0m^[[1mtexmacs ^[[1;32m1.0.6.14-1^[[0m 
^[[1;34m^[[0m
^[[3m     GNU TeXmacs is a free scientific text editor, which was both 
inspired by TeX^[[0m
...

However, if the following code is used in ~/.emacs (code found at 
http://www.emacswiki.org/emacs/EshellColor):
    (require 'ansi-color)
    (require 'eshell)
    (defun eshell-handle-ansi-color ()
      (ansi-color-apply-on-region eshell-last-output-start
                                  eshell-last-output-end))
    (add-to-list 'eshell-output-filter-functions 'eshell-handle-ansi-color)

the output is correctly displayed in color as:
$ yaourt -Ss emacs
extra/emacs 22.3-1 [installed] 
     The Emacs Editor
extra/snd 10.1-1 
     Snd is the emacs of sound editor
extra/texmacs 1.0.6.14-1 
     GNU TeXmacs is a free scientific text editor, which was both inspired by 
TeX
...

I think that this should be included and enabled by default with eshell, as it 
doesn't change existing behaviour for non-color output, it only makes color 
output readable. I have a fair few programs that output in color, and the 
default behaviour made eshell unusable for me.

In GNU Emacs 22.3.1 (i686-pc-linux-gnu, GTK+ Version 2.12.11)
 of 2008-09-09 on p15200770.pureserver.info
Windowing system distributor `The X.Org Foundation', version 11.0.10402000
configured using `configure  '--prefix=/usr' '--sysconfdir=/etc' '--
libexecdir=/usr/lib' '--localstatedir=/var' '--mandir=/usr/share/man' '--
without-sound' '-with-x-toolkit=gtk' 'CFLAGS=-march=i686 -mtune=generic -O2 -
pipe''

--Boundary-00=_QNeCJjkcm/rkCQF
Content-Type: text/html;
  charset="utf-8"
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
p, li { white-space: pre-wrap; }
</style></head><body style=" font-family:'Sans Serif'; font-size:10pt; font-weight:400; font-style:normal;">
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">When running eshell, using an external program that outputs in color results in the raw terminal escape codes being displayed. For example,</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">~ $ yaourt -Ss emacs</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">^[[3m^[[1;32mextra/^[[0m^[[0m^[[1memacs ^[[1;32m22.3-1 ^[[7m^[[1;33m[installed]^[[0m ^[[1;34m^[[0m</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">^[[3m     The Emacs Editor^[[0m</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">^[[3m^[[1;32mextra/^[[0m^[[0m^[[1msnd ^[[1;32m10.1-1^[[0m ^[[1;34m^[[0m</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">^[[3m     Snd is the emacs of sound editor^[[0m</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">^[[3m^[[1;32mextra/^[[0m^[[0m^[[1mtexmacs ^[[1;32m1.0.6.14-1^[[0m ^[[1;34m^[[0m</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">^[[3m     GNU TeXmacs is a free scientific text editor, which was both inspired by TeX^[[0m</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">...</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">However, if the following code is used in ~/.emacs (code found at http://www.emacswiki.org/emacs/EshellColor):</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    (require 'ansi-color)</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    (require 'eshell)</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    (defun eshell-handle-ansi-color ()</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">      (ansi-color-apply-on-region eshell-last-output-start</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">                                  eshell-last-output-end))</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">    (add-to-list 'eshell-output-filter-functions 'eshell-handle-ansi-color)</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">the output is correctly displayed in color as:</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">$ yaourt -Ss emacs</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">extra/emacs 22.3-1 [installed] </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">     The Emacs Editor</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">extra/snd 10.1-1 </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">     Snd is the emacs of sound editor</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">extra/texmacs 1.0.6.14-1 </p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">     GNU TeXmacs is a free scientific text editor, which was both inspired by TeX</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">...</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">I think that this should be included and enabled by default with eshell, as it doesn't change existing behaviour for non-color output, it only makes color output readable. I have a fair few programs that output in color, and the default behaviour made eshell unusable for me.</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">In GNU Emacs 22.3.1 (i686-pc-linux-gnu, GTK+ Version 2.12.11)</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"> of 2008-09-09 on p15200770.pureserver.info</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">Windowing system distributor `The X.Org Foundation', version 11.0.10402000</p>
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;">configured using `configure  '--prefix=/usr' '--sysconfdir=/etc' '--libexecdir=/usr/lib' '--localstatedir=/var' '--mandir=/usr/share/man' '--without-sound' '-with-x-toolkit=gtk' 'CFLAGS=-march=i686 -mtune=generic -O2 -pipe''</p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p>
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; -qt-user-state:0;"></p></body></html>
--Boundary-00=_QNeCJjkcm/rkCQF--