Request: no color on dumb terminals

10 views
Skip to first unread message

Ken

unread,
Jul 21, 2008, 7:24:44 PM7/21/08
to ack dev/users
Hi again,

My last feature request went over so well, I'm back for more!

I wish ack would assume I want --nocolor when the env TERM is "dumb".

(Whenever I run ack from inside emacs, I see a bunch of garbage
characters; all my other programs are apparently clever enough to
avoid this.)

I could come up with a patch, if it would help, but I suspect it's
trivial.

Thanks again!


- Ken

Andy Lester

unread,
Jul 21, 2008, 7:31:58 PM7/21/08
to ack-...@googlegroups.com

On Jul 21, 2008, at 4:24 PM, Ken wrote:

> I wish ack would assume I want --nocolor when the env TERM is "dumb".


I'd rather not have ack figuring out terminal types. How about if you
set ACK_OPTIONS based on your term type?

xoa

--
Andy Lester => an...@petdance.com => www.petdance.com => AIM:petdance


Bill Ricker

unread,
Jul 21, 2008, 10:23:12 PM7/21/08
to ack-...@googlegroups.com
>> I wish ack would assume I want --nocolor when the env TERM is "dumb".

> I'd rather not have ack figuring out terminal types. How about if you
> set ACK_OPTIONS based on your term type?

That's fine answer for people talking about strange terminals in general.
But reading on ...

>> (Whenever I run ack from inside emacs, I see a bunch of garbage
>> characters; all my other programs are apparently clever enough to
>> avoid this.)

Emacs is using his real $TERM and resetting $TERM=dumb on sub-shells
-- which would inherit his shell's $ACK_OPTIONS set according to his
real $TERM, where he may want color.

$ENV{TERM} eq q{dumb} ==> --nocolor is a reasonable special case to
support without opening the whole can of worms of $TERM arcana. Any
program that uses ^[[ codes when TERM:=dumb is broken, same as any
program emitting color ^[[ codes by default when STDOUT is a pipe is
broken. If we ignore $ENV{TERM} eq q{dumb}, we should require users of
less to enable color in .lessrc or disable color always in .ackrc to
be consistent, right?

Emacs is an important environment to support nicely in general and for
a grep-replacement in particular, and testing for 'dumb' (or undef ?)
is not a precedent for full evaluation and use of
termcap/curses/Acme::Term::Tektronix.


--
Bill
n1...@arrl.net bill....@gmail.com

cnk

unread,
Aug 29, 2008, 7:42:49 PM8/29/08
to ack dev/users
> Any program that uses ^[[ codes when TERM:=dumb is broken, same as any
> program emitting color ^[[ codes by default when STDOUT is a pipe is
> broken.

Hear! hear! But given that some do, is there a way to filter them out?
Specifically the Rails logger includes colorizing codes - but I
usually want to tail it from an emacs shell so it is 1) just another
buffer and 2) searchable. I don't really want to dive around to take
that out of Rails, so is there a way to pipe through a 'decolorizer'?
Reply all
Reply to author
Forward
0 new messages