git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>
Subject: Re: [PATCH 2/2] pretty: support placeholders %C+ and %C-
Date: Thu, 20 Sep 2012 09:47:46 -0700	[thread overview]
Message-ID: <7vy5k4bpzh.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1348143976-4506-3-git-send-email-pclouds@gmail.com> ("Nguyễn	Thái Ngọc Duy"'s message of "Thu, 20 Sep 2012 19:26:16 +0700")

Nguyễn Thái Ngọc Duy <pclouds@gmail.com> writes:

> %C+ tells the next specifiers that color is preferred. %C- the
> opposite. So far only %H, %h and %d support coloring.
>
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
> ---
>  Documentation/pretty-formats.txt |  2 ++
>  pretty.c                         | 13 ++++++++++++-
>  2 files changed, 14 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/pretty-formats.txt b/Documentation/pretty-formats.txt
> index e3d8a83..6e287d6 100644
> --- a/Documentation/pretty-formats.txt
> +++ b/Documentation/pretty-formats.txt
> @@ -142,6 +142,8 @@ The placeholders are:
>  - '%Cblue': switch color to blue
>  - '%Creset': reset color
>  - '%C(...)': color specification, as described in color.branch.* config option
> +- '%C+': enable coloring on the following placeholders if supported
> +- '%C-': disable coloring on the following placeholders

OK, so typically you replace some format placeholder "%?" in your
format string with "%C+%?%C-", because you cannot get away with
replacing it with "%C+%? and other things in the format you do not
know if they support coloring%C-".

If that is the case, does it really make sense to have %C-?

It smells as if it makes more sense to make _all_ %? placeholder
reset the effect of %C+ after they are done (even the ones that they
themselves do not color their own output elements), so that you can
mechanically replace "%?" with "%C+%?".

I dunno.

  parent reply	other threads:[~2012-09-20 16:48 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-19 11:52 [PATCH] log --oneline: put decoration at the end of the line Nguyễn Thái Ngọc Duy
2012-09-19 18:20 ` Jeff King
2012-09-19 19:57   ` Junio C Hamano
2012-09-19 20:05     ` Jeff King
2012-09-19 23:34     ` Junio C Hamano
2012-09-19 23:42       ` Jeff King
2012-09-20  0:18         ` Junio C Hamano
2012-09-20 10:43         ` Nguyen Thai Ngoc Duy
2012-09-20 12:26           ` [PATCH 0/2] New pretty format color specifiers %C+ and %C- Nguyễn Thái Ngọc Duy
2012-09-20 12:26             ` [PATCH 1/2] pretty: share code between format_decoration and show_decorations Nguyễn Thái Ngọc Duy
2012-09-20 12:26             ` [PATCH 2/2] pretty: support placeholders %C+ and %C- Nguyễn Thái Ngọc Duy
2012-09-20 14:38               ` [PATCH 3/2] pretty: support right alignment Nguyen Thai Ngoc Duy
2012-09-20 16:40                 ` Junio C Hamano
2012-09-21  8:55                   ` Nguyen Thai Ngoc Duy
2012-09-21 17:46                     ` Junio C Hamano
2012-09-23  8:17                     ` Junio C Hamano
2012-09-25  0:27                       ` Jeff King
2012-09-21 13:03                   ` Nguyen Thai Ngoc Duy
2012-09-20 16:47               ` Junio C Hamano [this message]
2012-09-20 17:47                 ` [PATCH 2/2] pretty: support placeholders %C+ and %C- Junio C Hamano
2012-09-21  8:36                   ` Nguyen Thai Ngoc Duy

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

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

  git send-email \
    --in-reply-to=7vy5k4bpzh.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /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.
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).