git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <johannes.schindelin@gmx.de>,
	Stefan Beller <sbeller@google.com>
Subject: Re: [RFC PATCH 4/4] color.ui config: add "isatty" setting
Date: Fri, 1 Jun 2018 01:30:44 -0400	[thread overview]
Message-ID: <20180601053044.GA8292@sigill.intra.peff.net> (raw)
In-Reply-To: <874liofgv6.fsf@evledraar.gmail.com>

On Thu, May 31, 2018 at 09:01:49AM +0200, Ævar Arnfjörð Bjarmason wrote:

> > Is there some case where a pager can only handle color if _it's_ output
> > is going to a tty, and otherwise not?
> 
> Maybe I'm missing something but how is that something we can deal with?
> We just:
> 
>  1. use isatty() to see if we're attached to a terminal
>  2a. If yes and no pager is invoked (e.g. git status) and "auto" we use colors
>  2b. If yes and we're invoking a pager (e.g. git log) and "auto" we use colors
>      3b. At this point we're writing to the pager so isatty() is false,
>          but we set our own GIT_PAGER_IN_USE and turn on colors if "auto"
> 
> I suppose we can imagine a pager that sometimes emits to a terminal and
> sometimes e.g. opens a browser with the output, and we could ourselves
> somehow detect this...

I was imagining something where we remembered the original isatty()
value (from before the pager) and then reacted to that. But no, I don't
actually have a use case there. I was trying to think through possible
reasons to want this "isatty" version of color.ui.

> As noted in the cover letter I started writing this whole thing before
> understanding some of the subtleties, and now I think this "isatty"
> thing is probably pretty useless, and was wondering if others wanted it.

OK, I agree that it doesn't seem all that useful.

> Reasons to take it are:
> 
>  1) To make user intent clearer. I.e. we could just also make it a
>     synonym for color.ui=auto & color.pager=false and those used to
>     isatty semantics skimming the docs would more easily find the right
>     thing.

I'd much prefer just having a documentation patch that uses the word
"isatty", if that's something we think a user might search for (which
seems plausible to me).

>  2) If there are any cases where isatty() is true, but we can detect via
>     other means (e.g. inspecting other env variables) that non-pager
>     output can't handle colors some of the time. Of course if we find
>     such cases isatty() would suck more, but that's presumably what
>     isatty() purists want :)

Yeah, I think we can punt on that until such an "other means" comes
along.

-Peff

      reply	other threads:[~2018-06-01  5:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-30 21:06 [PATCH 0/4] color.ui docs & add color.ui=isatty Ævar Arnfjörð Bjarmason
2018-05-30 21:06 ` [PATCH 1/4] config doc: move color.ui documentation to one place Ævar Arnfjörð Bjarmason
2018-05-31  5:25   ` Jeff King
2018-05-31  7:09     ` Ævar Arnfjörð Bjarmason
2018-06-01  5:31       ` Jeff King
2018-05-30 21:06 ` [PATCH 2/4] config doc: clarify "to a terminal" in color.ui Ævar Arnfjörð Bjarmason
2018-05-31  5:27   ` Jeff King
2018-05-30 21:06 ` [RFC PATCH 3/4] color.ui config: don't die on unknown values Ævar Arnfjörð Bjarmason
2018-05-30 22:32   ` Stefan Beller
2018-05-30 23:05   ` Junio C Hamano
2018-05-31  7:17     ` Ævar Arnfjörð Bjarmason
2018-06-01  5:53       ` Jeff King
2018-05-30 21:06 ` [RFC PATCH 4/4] color.ui config: add "isatty" setting Ævar Arnfjörð Bjarmason
2018-05-30 22:57   ` Junio C Hamano
2018-05-31  7:07     ` Ævar Arnfjörð Bjarmason
2018-05-31  5:38   ` Jeff King
2018-05-31  7:01     ` Ævar Arnfjörð Bjarmason
2018-06-01  5:30       ` Jeff King [this message]

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: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=20180601053044.GA8292@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    --cc=sbeller@google.com \
    /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://80x24.org/mirrors/git.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).