git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: "Randall S. Becker" <rsbecker@nexbridge.com>,
	"'Felipe Contreras'" <felipe.contreras@gmail.com>,
	"'Junio C Hamano'" <gitster@pobox.com>,
	"'Ævar Arnfjörð Bjarmason'" <avarab@gmail.com>
Cc: git@vger.kernel.org
Subject: RE: Man pages have colors? A deep dive into groff
Date: Mon, 17 May 2021 18:33:49 -0500	[thread overview]
Message-ID: <60a2fd5d52740_1461a92083d@natae.notmuch> (raw)
In-Reply-To: <00b701d74b6f$aa295ed0$fe7c1c70$@nexbridge.com>

Randall S. Becker wrote:
> On May 17, 2021 6:44 PM, Felipe Contreras wrote:
> >Junio C Hamano wrote:
> >> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
> >>
> >> > This looks much better.
> >> >
> >> > I wonder a good follow-up (hint, hint! :) would be to have
> >> > exec_man_man() and exec_man_cmd() in builtin/help.c set this
> >> > depending on color.ui (so we'd do it by default with "auto").
> >> >
> >> > Then e.g. "git help git" would look prettier than "man git".
> >>
> >> As long as color.man.ui can be used to override the blanket color.ui,
> >> I think it is a good idea.
> >
> >Why not use color.pager?
> 
> I think there is a lesson to be learned from git checkout;
> specifically not to overload semantics.

> Manual representation is a presentation world unto itself that has
> should not be blended with programs like less.

Huh? man is basically a grapper for `groff | less`:

From man(1): "man is the system's manual pager".

You could use it for other purposes, like generating DVI files, but
that's not how git uses it. We it in the normal mode, which uses
the environment variable MANPAGER.

This has absolutely nothing to do with man:

  export GROFF_NO_SGR=1
  export LESS_TERMCAP_md=$'\e[1;31m'
  export LESS_TERMCAP_me=$'\e[m'
  zcat /usr/share/man/man1/git.1.gz | groff -T utf8 -m man | less -R

> More than that, being someone who loves automated
> documentation generation, manual representation has a broader semantic
> that should not be dismissed.

But what does that have to do with `git help`?

> There are probably a whole class of colours that ultimately might be
> requested - might be me - so I'd rather not blend these into
> color.pager.

But it's 100% pager-dependent. Not only do you need a pager for this to
work, but you need specifically the `less` pager.

This:

  MANPAGER=more git -c color.man=always help git

Would not work, because `more` doesn't read use the LESS_TERMCAP variables.

So why call it color.man, if it's not really a man thing?

Cheers.

-- 
Felipe Contreras

  reply	other threads:[~2021-05-17 23:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-15 22:10 Felipe Contreras
2021-05-17 16:48 ` Ævar Arnfjörð Bjarmason
2021-05-17 19:28   ` Junio C Hamano
2021-05-17 22:44     ` Felipe Contreras
2021-05-17 22:54       ` Randall S. Becker
2021-05-17 23:33         ` Felipe Contreras [this message]
2021-05-18  1:27       ` Junio C Hamano
2021-05-18  4:27         ` Felipe Contreras
2021-05-18  7:16           ` Jeff King
2021-05-18 13:21             ` Felipe Contreras
2021-05-18 14:27             ` Junio C Hamano
2021-05-18  1:28   ` brian m. carlson
2021-05-18  2:12     ` Junio C Hamano
2021-05-18  4:35       ` Felipe Contreras
2021-05-18  4:31     ` 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:
  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=60a2fd5d52740_1461a92083d@natae.notmuch \
    --to=felipe.contreras@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rsbecker@nexbridge.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 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).