archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <>
To: Felipe Contreras <>
Cc:, "Jeff King" <>,
	"Ævar Arnfjörð Bjarmason" <>,
	"Randall S. Becker" <>
Subject: Re: [PATCH v2] help: colorize man pages
Date: Tue, 18 May 2021 23:50:50 +0900	[thread overview]
Message-ID: <xmqqa6os2j05.fsf@gitster.g> (raw)
In-Reply-To: <> (Felipe Contreras's message of "Tue, 18 May 2021 08:20:56 -0500")

Felipe Contreras <> writes:

> +	When set to `always`, always colorize the man pages. When `false`
> +	(or `never`), never.  When set to `true` or `auto`, use color only
> +	when the output is written to the terminal. If unset, then the
> +	value of `color.ui` is used (`auto` by default).

Makes sense and is more in line with the rest of the system to have
subcommand specific color.* variable.

There are two things that make me wonder in the above description,

> +static void colorize_man(void)
> +{
> +	if (!want_color(man_color) || !pager_use_color)
> +		return;
> +
> +	/* Disable groff colors */
> +	setenv("GROFF_NO_SGR", "1", 0);
> +
> +	/* Bold */
> +	setenv("LESS_TERMCAP_md", GIT_COLOR_BOLD_RED, 0);
> +	setenv("LESS_TERMCAP_me", GIT_COLOR_RESET, 0);
> +
> +	/* Underline */
> +	setenv("LESS_TERMCAP_ue", GIT_COLOR_RESET, 0);
> +
> +	/* Standout */
> +	setenv("LESS_TERMCAP_se", GIT_COLOR_RESET, 0);
> +}

This seems very specific to use of "less" and hopefully does not do
anything (bad) when a different pager is used by "man".

 - Would it help readers to somehow tell that does not
   apply at all to those whose "man" does not "less" in the

 - What does it mean to set this variable to "always"?  For commands
   that we control how the various pieces of output are colored (or
   not), e.g.

   $ git -c color.ui=always log -1 -p >git-log-output.txt

   it is obvious what "always" means, but given the implementation
   that tweaks how "less" should behave, a similar command (below)
   would not colorize its output like the "git log" example above
   does, would it?

   $ git -c help -m git >git-help-text.txt

I am just wondering if we are better off not to mention "always" in
the documentation patch above.  It seems more like that the
configuration variable is to answer this question and nothing else:

    when 'git help' shows manual pages and internally uses 'less' as
    its pager, do we tell it to colorize the output?

for which sensible answers are 'true' or 'false'.  For that matter,
it is not clear what "auto" ought to mean, either.


  reply	other threads:[~2021-05-18 14:50 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 13:20 [PATCH v2] help: colorize man pages Felipe Contreras
2021-05-18 14:50 ` Junio C Hamano [this message]
2021-05-18 20:53   ` Felipe Contreras

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:

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

  git send-email \
    --in-reply-to=xmqqa6os2j05.fsf@gitster.g \ \ \ \ \ \ \

* 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.
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 NNTP newsgroup(s).