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

Re: [PATCH v7] help: colorize man pages if man.color=true under less(1)

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 21, 2021, 10:28 UTC
Message-ID
<xmqqfsxbika3.fsf@gitster.g>
In-Reply-To
<patch-1.1-a950ef49e28-20210621T083254Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
Show 41 quoted lines
> So, in order for this change to have any effect:
>
>  1. color.man=true must be set in the config
>  2. The user must use less
>  3. Not have the same LESS_TERMCAP variables set (we call setenv(3) with overwrite=0)
>  4. Have color.ui enabled
>  5. Not have color.pager disabled
>  6. Not have git with stdout directed to a file
>
> 1. https://lore.kernel.org/git/87tun1qp91.fsf@evledraar.gmail.com/
> 2. https://unix.stackexchange.com/questions/119/colors-in-man-pages/147
>
> Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> ---
>
> On Tue, Jun 08 2021, Junio C Hamano wrote:
>
>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>>
>>> I've been running with this on my personal git build since May 26th. I
>>> haven't had any issues with it, and I like the new coloring.
>>> ...
>>> I think this is a good example of a change that we're better off just
>>> merging down and then reverting if the wider audience of git users hates
>>> it, rather than trying to come to some perfect consensus here
>>> on-list.
>>
>> My impression was tht we already had a rough consensus here on-list
>> that it may be good to educate users who like this "new coloring"
>> like you do to configure their "less", so that they consistently get
>> the "new coloring" they like whether they are doing "git help git",
>> "man git", or even "man ls", and the approach the posted patch takes
>> will not help (it only affects "git help git" among these).
>>
>> I'd rather not to take it.
>
> Fair enough, here's a version I think you and others will find
> acceptable then. It allows users like me who like this to explicitly
> opt-in via color.man=true.
Not really.

Since the implementation of the posted patch, as I understand it, does not aim to affect both "git help -m foo" and "man git-foo" identically, I think it would be easier to understand to end-users if this were exposed as a new "mode", like "git help --web" and "git help --info" are different modes from the "git help --man", something like "git help --fancy-man" (or whatever is easy to type and explain, and also add it to the variants help.format knows about to make it easy to set the default).

One advantage of doing so is that we do not have to worry about "ah, user has LESS_BLAH environment variable so we should disable this new mode here" etc. As long as the new mode is requested either via the command line option or help.format configuration, it can completely take it over. That simplifies the necessary explanation given to the users quite a lot, no?

Show 16 quoted lines
> 	----
> 	git-config - Get and set [...]
>
> 	SYNOPSIS
> 	--------
> 	[...]
> 	'git config' [<file-option>] [...]
> 	[...]
> 	The `--type=<type>` option instructs 'git config' to ensure [...]
>
> Will have "NAME" and "SECTION" shown as BOLD RED instead of BOLD, "git
> config" and other '-quoted parts in BLUE UNDERLINE instead of
> UNDERLINE, and `--type=<type>` and other `-quoted parts in RED BOLD
> instead of BOLD. The "Standout" setting is then used for the user's
> own search bar (invoked with "/") and prompt. See [2] for more
> examples
There are BOLD RED and READ BOLD; are they differently rendered?
Previous: Phillip WoodNext: Felipe Contreras
Message 9 of 22 in “help: colorize man pages”
  1. help: colorize man pagesFelipe Contreras, May 23, 2021
  2. Phillip WoodMay 24, 2021
  3. Felipe ContrerasMay 24, 2021
  4. Ævar Arnfjörð BjarmasonJun 8, 2021
  5. Junio C HamanoJun 8, 2021
  6. Felipe ContrerasJun 8, 2021
  7. help: colorize man pages if man.color=true under less(1)Ævar Arnfjörð Bjarmason, Jun 21, 2021
  8. Phillip WoodJun 21, 2021
  9. Junio C HamanoJun 21, 2021
  10. Felipe ContrerasJun 21, 2021
  11. Ævar Arnfjörð BjarmasonJun 21, 2021
  12. Jeff KingJun 23, 2021
  13. Felipe ContrerasJun 24, 2021
  14. Junio C HamanoJun 28, 2021
  15. Felipe ContrerasJun 28, 2021
  16. Felipe ContrerasJun 21, 2021
  17. Jeff KingJun 24, 2021
  18. Junio C HamanoJun 29, 2021
  19. Felipe ContrerasJun 29, 2021
  20. Felipe ContrerasJun 24, 2021
  21. help: add option to colorize man pages under lessFelipe Contreras, Jun 26, 2021
  22. Ævar Arnfjörð BjarmasonJun 26, 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.