From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tobias Geerinckx-Rice Subject: (Ab?)using aliases to set ls' and others' colours Date: Tue, 03 Jul 2018 13:38:34 +0200 Message-ID: <87zhz8eeh1.fsf@lapdog.tobias.gr> References: <20180703101553.702b0b00@alma-ubu> <8736x0fvbr.fsf@lapdog.tobias.gr> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35324) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1faJdp-0003uD-A9 for guix-devel@gnu.org; Tue, 03 Jul 2018 07:38:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1faJdo-0006CP-5s for guix-devel@gnu.org; Tue, 03 Jul 2018 07:38:41 -0400 Received: from tobias.gr ([2001:470:cc92::1]:45364) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1faJdn-0006Bk-Mx for guix-devel@gnu.org; Tue, 03 Jul 2018 07:38:40 -0400 In-reply-to: <8736x0fvbr.fsf@lapdog.tobias.gr> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: =?utf-8?Q?Bj=C3=B6rn_H=C3=B6fling?= Cc: guix-devel Tobias Geerinckx-Rice wrote: > Bj=C3=B6rn H=C3=B6fling wrote: >> ls has a colored output. Nice. >> ls | less has ugly escape sequences. Only ls --color=3Dno | less >> works. > > I'd be surprised if =E2=80=98ls | less -R=E2=80=99 didn't (and that would= be a=20 > bug). > > Otherwise, this is standard behaviour for both =E2=80=98ls=E2=80=99 and = =E2=80=98less=E2=80=99. Apologies, I made a reado. =E2=80=98ls | $foo=E2=80=99 should indeed detect a missing tty and stop spe= wing=20 colour automatically. At least if =E2=80=98ls=E2=80=99 is properly aliased = to =E2=80=98ls=20 --color=3Dauto=E2=80=99. Instead, it is aliased[0] to use =E2=80=98--color=E2=80=99 =E2=80=94 short = for =E2=80=98ls=20 --color=3Dalways=E2=80=99 =E2=80=94 for reasons I cannot understand. We do = the same=20 for =E2=80=98grep=E2=80=99. Perhaps it was assumed that =E2=80=98--color=E2=80=99 on its own implies = =E2=80=98auto=E2=80=99=20 instead of =E2=80=98always=E2=80=99 (I could see how that could happen)? Or= =20 =E2=80=98--color=3Dauto=E2=80=99 is too cautious, and disables colour in a = situation=20 where the author expects it? In that case I don't think the=20 trade-off is worth it. On the other hand, what I consider an obvious bug has been around=20 since literal forever[1], so maybe I'm missing something obvious=20 here. I've CC'd the original author. If everyone agrees or nobody=20 responds, I'd like to change it to something less aggressive=20 before 0.15.[2] What? Not sure yet. I'm not even sure this should be handled by=20 aliases at all. Our default =E2=80=98ls=E2=80=99 alias also adds a =E2=80= =98-p=E2=80=99, which is=20 probably valid [although I find it useless and annoying and=20 disable it], but colours for both commands can also be controlled=20 through the {LS,GREP}_COLORS variables which seems like a better=20 fit for distro defaults like these. We can even change the=20 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,=20 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=20 away from Guix's current upstream version, which is its own little=20 annoying gotcha.