Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 304359 - sys-apps/less: lesspipe.sh should color all file types
Summary: sys-apps/less: lesspipe.sh should color all file types
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Core system (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-10 18:22 UTC by Dror Levin (RETIRED)
Modified: 2010-02-14 17:11 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
quick patch to color everything (lesspipe-color-everything.patch,2.05 KB, patch)
2010-02-10 23:21 UTC, Dror Levin (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dror Levin (RETIRED) gentoo-dev 2010-02-10 18:22:52 UTC
Currently lesspipe.sh only attempts to color some file types based on their extension, and it's missing some file types which could be colored, like html.

Both code2color (the default), and pygmentize (with the -g flag) which I've tried, simply output uncolored text if they can't color the specific file, so there's no reason to limit the coloring to a specific set of file types.

It would be best, IMO, if lesspipe.sh always tries to color the text regardless of the file's extension (the only exceptions to this are files which aren't text, such as compressed files, mp3 files which lesspipe.sh currently handles, etc.), and let the colorizer do it's magic.
Comment 1 Dror Levin (RETIRED) gentoo-dev 2010-02-10 21:38:02 UTC
More examples of files which could get colorized but currently don't: makefiles, manpages, csv, css, …
Comment 2 Dror Levin (RETIRED) gentoo-dev 2010-02-10 23:21:25 UTC
Created attachment 219169 [details, diff]
quick patch to color everything

I quickly made this patch to color everything. Hopefully it doesn't make too many kittens suffer.
Comment 3 SpanKY gentoo-dev 2010-02-11 00:02:18 UTC
i would add a comment about the colorizer being required to simply pass through the file unmangled if it doesnt support it.  that way i dont need to deal with hacks with limited programs.
Comment 4 SpanKY gentoo-dev 2010-02-14 17:11:40 UTC
should be fixed now:
http://sources.gentoo.org/sys-apps/less/files/lesspipe.sh?r1=1.40&r2=1.39