[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: regexp font-lock highlighting
From: |
martin rudalics |
Subject: |
Re: regexp font-lock highlighting |
Date: |
Wed, 08 Jun 2005 17:13:34 +0200 |
User-agent: |
Mozilla Thunderbird 1.0 (Windows/20041206) |
> I fixed shy group handling in this regexp by allowing ?: to be only
> before `(' instead of before any of `(', `|' or `)'. You may need to
> adjust your code before submitting your final patch.
If you intend "after" instead of "before" here I have done that already.
> Also I tried to extend this regexp to highlight other special backslash
> constructs like `\<', `\_<', `\w', `\sC', but soon discovered that
> sometimes there are similar constructs in non-regexp strings that become
> inappropriately highlighted. Unless it's possible to detect whether
> a given string is a regexp or not,
... it hardly ever is ...
> I think the regexp highlighting
> code should be split into multi-level font-lock variables
> font-lock-regexp-keywords-1 and font-lock-regexp-keywords-2.
> The first variable would highlight only `\\(?:', `\\|' and `\\)' constructs,
> but the second - all other regexp constructs. Everyone agreed to see
> regexp constructs sometimes highlighted in wrong places could use
> the second level variable.
I tried to implement variants of that but it did not turn out well.
Highlighting backslashes only is more distracting than useful. Having
`<' or `w' stand out with bold face makes groupings much less readable.
> I see everyone tends to change the default color of `font-lock-string-face'
> (which is barely visible on light backgrounds) to a green color.
> Currently on tty strings are fontified in green, so maybe this is one
> of the reasons why people prefer green strings. This indicates that
> we should change the current "RosyBrown" default to one of the shades
> of green.
... but leave alone font-lock's statement "... character strings might
be brown, because, err, strings are brown ..."
> I added two new faces: for a backslash and regexp constructs after
> a backslash. The former inherits from escape-glyph to be highlighted
> like a backslash in escape sequences, the latter is bold by default.
> I think there is no need for a face for shy groups. It is fontified
> now in the same face as other regexp constructs (bold).
... splendid