Gentoo Archives: gentoo-user

From: Willie Wong <wwong@×××××××××.EDU>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] less and colourisation
Date: Sat, 25 Nov 2006 14:34:14
Message-Id: 20061125143030.GA8641@princeton.edu
In Reply to: Re: [gentoo-user] less and colourisation by "Thomas Rösner"
1 On Sat, Nov 25, 2006 at 03:06:04AM +0100, Penguin Lover Thomas R?sner squawked:
2 > This is for programs having color output you want to pipe to less, not
3 > less showing a syntax highlighted file. This is done by the gentoo less
4 > filter that automagically unzips README.gz files when viewing them with
5 > less, fx. Does ls --color=auto produce colors in your xterm? Is your
6 > TERM envvar set to xterm (xterm should do this)? Do you have compared
7 > the current /etc/skel files to your user's home; when you create a new
8 > user with those files in his home, does xterm/less work for this account
9 > as intended?
10
11 Oh jeez, I completely misunderstood the original post (not to mention
12 that I didn't realize the colourisation is a gentoo specific filter).
13 I just took a look at the filter program 'lesspipe.sh', and boy is it
14 nice! Even extracts mp3info/ogginfo (not that I'd have thought about
15 running less against mp3 or ogg-vorbis files before)!
16
17 But I don't think the TERM envvar is the issue here (OP should check it
18 in any case). On my rxvt term, I run
19 TERM=<insertsomething> less <somesrcfile>
20 if I set the TERM to something that doesn't support color (dumb, or
21 some nonsense term), less (/usr/bin/less, not the lesspipe.sh) would
22 complain that it is not compatible with the -R option (which should be
23 set for all users in /etc/env.d/70less anyway), yet at the same time,
24 it would still send all the ANSI color codes produced by lesspipe.sh
25 as raw to the terminal, and the output still displays as colored.
26
27 Just checking, in the xterm that doesn't work, what does the following
28 envvars show?
29
30 LESS (should be -R -M --shift 5 by default)
31 LESSOPEN (|lesspipe.sh %s)
32 LESSCOLOR (should be empty by default)
33 LESSCOLORIZER (ditto)
34
35 HTH,
36
37 W
38 --
39 A grenade thrown into a kitchen in France would result in Linoleum Blownapart.
40 Sortir en Pantoufles: up 92 days, 7:43
41 --
42 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] less and colourisation Benno Schulenberg <benno.schulenberg@×××××.com>