git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] doc: explain the use of color.pager

From
Jonathan Nieder <jrnieder@gmail.com>
Date
May 19, 2021, 19:53 UTC
Message-ID
<YKVsw3uqb66ifzvd@google.com>
In-Reply-To
<YKTXlTjwOUi4W+R8@coredump.intra.peff.net>
Jeff King wrote:
Show 7 quoted lines
> The current documentation for color.pager is technically correct, but
> slightly misleading and doesn't really clarify the purpose of the
> variable. As explained in the original thread which added it:
>
>   https://lore.kernel.org/git/E1G6zPH-00062L-Je@moooo.ath.cx/
>
> the point is deal with pagers that don't understand colors.

Missing "to" before "deal". More importantly, I think I'd find a reference to the commit or a quotation from the affected user more helpful than a reference to the mailing list archive, since that would make this a bit more self-contained. (Especially since I think this is un-subtle enough that chasing through the mailing list thread doesn't add much to my life. :))

[...]
Show 11 quoted lines
> --- a/Documentation/config/color.txt
> +++ b/Documentation/config/color.txt
> @@ -127,8 +127,9 @@ color.interactive.<slot>::
>  	interactive commands.
>  
>  color.pager::
> -	A boolean to enable/disable colored output when the pager is in
> -	use (default is true).
> +	A boolean to specify whether `auto` color modes should colorize
> +	output going to the pager. Defaults to true; set this to false
> +	if your pager does not understand ANSI color codes.

I quite like the "set this to false if your pager does not understand ANSI color codes" part --- short and to the point.

The sentence before takes me long enough to understand that I don't think we've gotten the wording right yet. Before I suggest some wording, let's make sure I understand the behavior correctly:

- unlike other color.* settings, this can only be "true" or "false".
  It cannot be "auto".
- in other color.* settings, "auto" means "colors are used only when
  stderr goes to a terminal".  A pager typically ultimately writes to
  a terminal, but (1) it's not guaranteed to (e.g., xless writes to
  its own window instead) and (2) more importantly for us, it's not
  guaranteed to write terminal escapes as is.
- so this setting can be used to answer "for the sake of evaluating
  color settings, should we treat output that is going to a pager as
  going to a terminal?"
If I understood correctly, how about some text like the following?
	A boolean to specify whether `auto` color modes should colorize
	output going to a pager, in addition to their behavior of
	colorizing output going to a terminal. Defaults to true; [etc]

Side note, not about this patch: we treat pager.color as a synonym for color.pager. Is that something we want to document, or is that an instance of being extra friendly when the user makes a typo?

Thanks, Jonathan

Previous: Felipe ContrerasNext: Felipe Contreras
Message 3 of 8 in “doc: explain the use of color.pager”
  1. doc: explain the use of color.pagerJeff King, May 19, 2021
  2. Felipe ContrerasMay 19, 2021
  3. Jonathan NiederMay 19, 2021
  4. Felipe ContrerasMay 19, 2021
  5. Junio C HamanoMay 19, 2021
  6. Junio C HamanoMay 20, 2021
  7. Jeff KingMay 20, 2021
  8. Jonathan NiederMay 20, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.