should default $LESS enable on-terminal color?
by gus3 from LinuxQuestions.org on (#5FMBB)
(Inspired by this brief thread, and the pre-beta status of Slackware 15.0.)
Enabling color in "less", on a system-wide basis, might be useful or practical for some users/sites. And maybe not.
For Bourne-type shells and zsh, LESS is set in /etc/profile to "-M". The C shell equivalent is in /etc/csh.login. This makes it a system-wide default, and of course users may override that in their personal shell startup scripts, via something like LESS="$LESS -R".
From the above thread, it would make sense to add -R to $LESS by default, in order to get "git log" to show colorization properly. But it might also result in someone asking "if 'git log | less' shows color correctly, why isn't 'dmesg | less' showing it too?" And that's perfectly valid; dmesg writes color codes to a terminal, but not to a pipe.
Yes, it's possible to edit /etc/profile et al., but what happens during an upgrade of Bash or Tcsh? It's up to the admin to remember "oh yeah, LESS was customized" and even if that was the only customization, it blocks a new profile/csh.login from getting installed. That new script might include a security fix. Installing the new script, with a customized $LESS, makes just one more customization that has to get carried over.
Am I over-thinking this? Of course I am. But I want to present some pro/con points.
Another reason I'm bringing up this question now, is that we're gearing up for the 15.0 release, and that's the best time to make such a tweak to default settings.
So, what are your thoughts out there? Would you like our BDFL to add automatic color-handling to "less"?
Side note to our BDFL: your ruling is final, and a pox on anyone who says otherwise.


Enabling color in "less", on a system-wide basis, might be useful or practical for some users/sites. And maybe not.
For Bourne-type shells and zsh, LESS is set in /etc/profile to "-M". The C shell equivalent is in /etc/csh.login. This makes it a system-wide default, and of course users may override that in their personal shell startup scripts, via something like LESS="$LESS -R".
From the above thread, it would make sense to add -R to $LESS by default, in order to get "git log" to show colorization properly. But it might also result in someone asking "if 'git log | less' shows color correctly, why isn't 'dmesg | less' showing it too?" And that's perfectly valid; dmesg writes color codes to a terminal, but not to a pipe.
Yes, it's possible to edit /etc/profile et al., but what happens during an upgrade of Bash or Tcsh? It's up to the admin to remember "oh yeah, LESS was customized" and even if that was the only customization, it blocks a new profile/csh.login from getting installed. That new script might include a security fix. Installing the new script, with a customized $LESS, makes just one more customization that has to get carried over.
Am I over-thinking this? Of course I am. But I want to present some pro/con points.
Another reason I'm bringing up this question now, is that we're gearing up for the 15.0 release, and that's the best time to make such a tweak to default settings.
So, what are your thoughts out there? Would you like our BDFL to add automatic color-handling to "less"?
Side note to our BDFL: your ruling is final, and a pox on anyone who says otherwise.