unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Tobias Geerinckx-Rice <me@tobias.gr>
To: "Björn Höfling" <bjoern.hoefling@bjoernhoefling.de>
Cc: guix-devel <guix-devel@gnu.org>
Subject: (Ab?)using aliases to set ls' and others' colours
Date: Tue, 03 Jul 2018 13:38:34 +0200	[thread overview]
Message-ID: <87zhz8eeh1.fsf@lapdog.tobias.gr> (raw)
In-Reply-To: <8736x0fvbr.fsf@lapdog.tobias.gr>

Tobias Geerinckx-Rice wrote:
> Björn Höfling wrote:
>> ls has a colored output. Nice.
>> ls | less has ugly escape sequences. Only ls --color=no | less
>> works.
>
> I'd be surprised if ‘ls | less -R’ didn't (and that would be a 
> bug).
>
> Otherwise, this is standard behaviour for both ‘ls’ and ‘less’.

Apologies, I made a reado.

‘ls | $foo’ should indeed detect a missing tty and stop spewing 
colour automatically. At least if ‘ls’ is properly aliased to ‘ls 
--color=auto’.

Instead, it is aliased[0] to use ‘--color’ — short for ‘ls 
--color=always’ — for reasons I cannot understand. We do the same 
for ‘grep’.

Perhaps it was assumed that ‘--color’ on its own implies ‘auto’ 
instead of ‘always’ (I could see how that could happen)? Or 
‘--color=auto’ is too cautious, and disables colour in a situation 
where the author expects it? In that case I don't think the 
trade-off is worth it.

On the other hand, what I consider an obvious bug has been around 
since literal forever[1], so maybe I'm missing something obvious 
here. I've CC'd the original author. If everyone agrees or nobody 
responds, I'd like to change it to something less aggressive 
before 0.15.[2]

What? Not sure yet. I'm not even sure this should be handled by 
aliases at all. Our default ‘ls’ alias also adds a ‘-p’, which is 
probably valid [although I find it useless and annoying and 
disable it], but colours for both commands can also be controlled 
through the {LS,GREP}_COLORS variables which seems like a better 
fit for distro defaults like these. We can even change the 
colours! But let's not.

Oh, I don't know.

This is the kind of trivial bug that would've put me off a distro, 
I guess.

Kind regards,

T G-R

[0]: in gnu/system/shadow.scm
[1]: 2013, at least: 0b86a82dc7e649e4ae551edefba445690a315b83
[2]: I'm already doing so in my own .bashrc, which has drifted 
away from Guix's current upstream version, which is its own little 
annoying gotcha.

  reply	other threads:[~2018-07-03 11:38 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-03  8:15 Installation-Protocol for GuixSD x86_64 v0.15-preview Björn Höfling
2018-07-03 10:49 ` Tobias Geerinckx-Rice
2018-07-03 11:38   ` Tobias Geerinckx-Rice [this message]
2018-07-04 18:01     ` (Ab?)using aliases to set ls' and others' colours Björn Höfling
2018-07-04 22:17     ` Ludovic Courtès
2018-07-04 22:17     ` Ricardo Wurmus
2018-07-04 17:56   ` Installation-Protocol for GuixSD x86_64 v0.15-preview Björn Höfling
2018-07-03 13:20 ` Marius Bakke
2018-07-03 13:27 ` Danny Milosavljevic
2018-07-03 21:35   ` Ludovic Courtès
2018-07-04 14:10   ` KDFONTOP/PIO_UNIMAPCLR: Input/output error Ludovic Courtès
2018-07-04 14:29     ` Marius Bakke
2018-07-04 22:20     ` Ludovic Courtès
2018-07-03 21:42 ` Installation-Protocol for GuixSD x86_64 v0.15-preview Ludovic Courtès
2018-07-04 18:06   ` Björn Höfling

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zhz8eeh1.fsf@lapdog.tobias.gr \
    --to=me@tobias.gr \
    --cc=bjoern.hoefling@bjoernhoefling.de \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).