openSUSE Forums > Programming/Scripting » Color Man Pages?

Go Back   openSUSE Forums > Programming/Scripting
Forums FAQ Members List Search Today's Posts Mark Forums Read


Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc.

Reply
Page 2 of 2 1 2
 
LinkBack Thread Tools Display Modes
  #11 (permalink)  
Old 23-May-2009, 02:18
Puzzled Penguin
 
Join Date: Jun 2008
Posts: 36
hro1 hasn't been rated much yet
Default Re: Color Man Pages?

This is a very nice addition. I tested it on OS 10.3 with KDE 3.5.10 and on SLED 10 SP2 with Gnome 2.12.2. Both are stock installations. Colors are totally different (different machines, displays and systems), but no worries.
Reply With Quote
  #12 (permalink)  
Old 23-May-2009, 03:34
Flux Capacitor Penguin
 
Join Date: Jun 2008
Location: GMT+10
Posts: 5,229
ken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud ofken_yap has a reputation to be proud of
Default Re: Color Man Pages?

Quote:
Originally Posted by cjcox View Post
It's there, been there for many, many years. It's just not documented.
Ok... and I suspect the reason it's not documented is because it is deprecated. Such settings would only work on one type of terminal and if you change to another type, the sequences would be wrong. Why not just set the terminal type and let less get the sequences from the termcap database? That's the way termcap is supposed to work.
Reply With Quote
  #13 (permalink)  
Old 26-May-2009, 10:08
cjcox's Avatar
Parent Penguin
 
Join Date: Jun 2008
Location: Frisco, TX
Posts: 778
cjcox hasn't been rated much yet
Default Re: Color Man Pages?

On Sat, 2009-05-23 at 08:36 +0000, ken yap wrote:
> cjcox;1990276 Wrote:
> > It's there, been there for many, many years. It's just not documented.

>
> Ok... and I suspect the reason it's not documented is because it is
> deprecated. Such settings would only work on one type of terminal and if
> you change to another type, the sequences would be wrong. Why not just
> set the terminal type and let less get the sequences from the termcap
> database? That's the way termcap is supposed to work.


I sort of agree. The naming is probably bad. You can always do the
direct tput queries to fill in the values.... and thus adhere to the
spirit of the way things are supposed to work.

But apart from that, I'm not exactly sure how you could make it
more like it's "supposed to work". Unless you make some assumptions...
and then it's your opinion vs. somebody else's opinion with regards
to color properties (and just coding the variations of color handling
is somewhat problematic... sometimes you have to initialize, sometimes
not...etc.... it may not be as simple as you think).


Reply With Quote
  #14 (permalink)  
Old 26-May-2009, 10:11
cjcox's Avatar
Parent Penguin
 
Join Date: Jun 2008
Location: Frisco, TX
Posts: 778
cjcox hasn't been rated much yet
Default Re: Color Man Pages?

On Sat, 2009-05-23 at 05:16 +0000, LewsTherinTelemon wrote:
....
> Would you mind sharing your complete /etc/profile, .bashrc and what
> versions of termap and less you are using?


Actually, I didn't want man color... so I simply pasted the variable
settings directly into my active shell to test.

I think I did it from an 11.0 box... TERM=xterm, I was using
a color capable terminal (konsole) and you do NOT need termcap,
just terminfo, I'm using terminfo-5.6


Reply With Quote
  #15 (permalink)  
Old 26-May-2009, 10:13
cjcox's Avatar
Parent Penguin
 
Join Date: Jun 2008
Location: Frisco, TX
Posts: 778
cjcox hasn't been rated much yet
Default Re: Color Man Pages?

On Tue, 2009-05-26 at 15:11 +0000, cjcox wrote:
> On Sat, 2009-05-23 at 05:16 +0000, LewsTherinTelemon wrote:
> ...
> > Would you mind sharing your complete /etc/profile, .bashrc and what
> > versions of termap and less you are using?

>
> Actually, I didn't want man color... so I simply pasted the variable
> settings directly into my active shell to test.
>
> I think I did it from an 11.0 box... TERM=xterm, I was using
> a color capable terminal (konsole) and you do NOT need termcap,
> just terminfo, I'm using terminfo-5.6


You could make the argument that you don't even need terminfo...
but that could be a big assumption.
(so let's be safe)


Reply With Quote
  #16 (permalink)  
Old 27-May-2009, 21:09
Explorer Penguin
 
Join Date: Oct 2008
Posts: 156
LewsTherinTelemon hasn't been rated much yet
Send a message via AIM to LewsTherinTelemon
Default Re: Color Man Pages?

Still think we are missing part of the puzzle on 11.1:

paracelsus@Callandor:~> echo $TERM $PAGER
xterm less

paracelsus@Callandor:~> sudo rpm -qa | grep term
termcap-2.0.8-980.45
terminfo-base-5.6-89.10
xterm-236-1.50.1
xtermset-0.5.2-255.9
terminfo-5.6-89.10

Still do not have color man pages in 11.1 despite the above (and obviously exporting the termcap settings in /etc/profile or .bashrc)

Something else has obviously changed in 11.1 but I can't quite narrow down what it is.

Cheers,
Pete
Reply With Quote
  #17 (permalink)  
Old 28-May-2009, 11:14
cjcox's Avatar
Parent Penguin
 
Join Date: Jun 2008
Location: Frisco, TX
Posts: 778
cjcox hasn't been rated much yet
Default Re: Color Man Pages?

Solution!!

I tested in 11.1 and indeed, things don't work right.

The difference... try this on 11.1...

export GROFF_NO_SGR=yes

Then see if things work (provided you have the LESS_TERMCAP_ entries set).
__________________
Linux is free. Life is good.
Reply With Quote
  #18 (permalink)  
Old 29-May-2009, 22:05
Explorer Penguin
 
Join Date: Oct 2008
Posts: 156
LewsTherinTelemon hasn't been rated much yet
Send a message via AIM to LewsTherinTelemon
Smile Re: Color Man Pages?

Nice find cjcox! I have never researched into the roff, troff, groff text formatting systems - pretty interesting. I also found the you can enable SGR in when using the less pager by just exporting it with the -R option - which I think should achieve the same as export GROFF_NO_SGR=yes however this fails in practice

From the grotty man page:

" For SGR support, it is necessary to use the -R option of less(1) to disable the interpretation of grotty's old output format.
Consequently, all programs which use less as the pager program have to pass this option to it. For man(1) in particular,
either add -R to the $PAGER environment variable, e.g.

PAGER="/usr/bin/less -R"
export PAGER

or use the -P option of man to set the pager executable and its options, or modify the configuration file of man in a similar
fashion."

And later:

"ENVIRONMENT
GROFF_NO_SGR
If set, the old drawing scheme for bold and underline (using the backspace character) is active. Colors are disabled."

(It is interesting to note how to color codes in the grotty man page are themselves displayed between exporting GROFF_NO_SGR=yes and PAGER=less -r Both show color, but interpret the ANSI color codes differently.)

Problem indeed solved, export GROFF_NO_SGR=yes works very well - thanks for your input.

Cheers,
Pete
Reply With Quote
  #19 (permalink)  
Old 01-Jun-2009, 16:36
cjcox's Avatar
Parent Penguin
 
Join Date: Jun 2008
Location: Frisco, TX
Posts: 778
cjcox hasn't been rated much yet
Default Re: Color Man Pages?

On Sat, 2009-05-30 at 03:06 +0000, LewsTherinTelemon wrote:
> Nice find cjcox! I have never researched into the roff, troff, groff
> text formatting systems - pretty interesting. I also found the you can
> enable SGR in when using the less pager by just exporting it with the -R
> option - which I think should achieve the same as export
> GROFF_NO_SGR=yes however this fails in practice
>

....snippy...
>
> Problem indeed solved, export GROFF_NO_SGR=yes works very well - thanks
> for your input.


It's a mess.... for fun also try changing your TERM

TERM=xterm-pcolor
man ls


You can uncompile using, TERM=xterm-pcolor infocmp

and then create your own terminal def with the colors you like... of
course it's universal at this point if you change your TERM... use
tic to compile it (need ncurses-devel for that).



Reply With Quote
Reply
Page 2 of 2 1 2

Bookmarks


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




 

Search Engine Friendly URLs by vBSEO 3.3.0 RC2