Integrating extensions into core?

Steve Borho steve at
Fri Aug 14 10:34:35 CDT 2009

On Fri, Aug 14, 2009 at 3:57 AM, Dan Villiom Podlaski
Christiansen<danchr at> wrote:
> On 13/08/2009, at 19.03, Brodie Rao wrote:
>> I think moving color into ui is the most obvious choice. I think Dan's
>> idea of augmenting ui.write() to emit colors is good.
> I'm glad you think so!
>> I haven't had a chance to look into it deeply, but I imagine you'd
>> need to do the following things:
>> 1. Take color's smart terminal detection and make sure ui can do the
>> same.
> I'd say there's more to it than that: ‘color’ doesn't try to do anything
> other than output to a terminal. Furthermore, it does so in an awkward way;
> either by parsing the output of wrapped commands or duplicating their
> functionality. This is both error-prone and cumbersome to maintain, and may
> even corrupt the output as experienced by Giorgos Keramidas.
> However, if we wish to add proper, integrated support for rich text output,
> some issues arise:
> 1) What to do when pushing and popping buffers?
> 2) Should it be possible to override the setting? Permanently? Temporarily?
> Only using derived UI instances?
> 3) Should the UI offer all possible fundamental text formats, or should
> clients be allowed to add new? (By ‘fundamental text formats’ I mean ‘bold’,
> ‘italics’, ‘normal’ and so on.)
> 4) Should the UI enforce such a decision, or perhaps require that a
> specified style is actually defined?
>> 2. Make --color and --no-color global options. (I'd really like to get
>> rid of --no-color, though.)
> Perhaps this would be a good occasion for implementing negation of boolean
> options? :)
>> 3. Implement something like ui.write(..., color=True).
> I know I'm nitpicking, but I don't believe “color” is a good name for this
> argument. (Regardless of whether beige is a colour, bold most certainly
> isn't :P) I'd say ‘style’ should be used for referring to a concrete
> style[1] and perhaps ‘rich’ and ‘plain’ for whether formatting should be
> applied or not.

My 2c.

I would prefer some sort of markup that would also allow GUI apps to
wrap color/font tags around the marked up text.

Steve Borho

More information about the Mercurial-devel mailing list