Subject: Re: [PATCH take 3 0/4] color-words improvements

From: Junio C Hamano <[email-masked]>
Date: Thu, 15 Jan 2009 17:37:50 -0800

Santi Béjar <[email-masked]> writes:

> It may be ok and logical, but for me it is not what I want. Mmaybe I
> don't really undestand what I want or is a crazy idea but here it is
> anyway:
>
> Take a simple case with this two lines :
>
> matrix[a,b,c]
> matrix{d,b,c}
>
> there is no space so the standard color-words does not help to
> visualize that matrix, the b and c are not changed.
>
> What I currently do is to add some spaces:
>
> matrix[ a, b, c ]
> matrix{ d, b, c }
>
> then the color-words at least says that "b, c" is unchanged.
>
> What I would like is that --color-words would act as adding this
> spaces automatically (and even one after "matrix").
>
> Or another way to think it could be:
>
> a) primary words are those with alphanumerics (or a regex)
> b) secondary "words" are the other non-whitespaces characters (in this
> case "[]{} and ,"
> c) whitespaces are cruft.

Dscho and Thomas discussed and designed a way to mark "words look like
this" (and anything that are not words are crufts), and Dscho further
argues that it is Ok to discard crufts (which I think is fine).

What you seem to want in this example is "there is no cruft other than
whitespace, but there are different kinds of words".  I do not think it is
incompatible with the way crufts are discarded, but it may be incompatible
with the way how words are identified.

I would expect something like:

	[a-zA-Z0-9]+|[^ a-zA-Z0-9]+

should define your "two kinds of words".  That is, a run of alnums is a
word, and a run of non-alnums is a word, but "matrix[a" is not a word (it
is a sequence of three words "matrix", "[" and "a").