bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#14481: 24.3.50; Highlighting escape sequences


From: Dmitry Gutov
Subject: bug#14481: 24.3.50; Highlighting escape sequences
Date: Mon, 27 May 2013 18:39:38 +0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6

On 27.05.2013 18:16, Drew Adams wrote:
But consider separating out the escape syntax for the various regexp
parts - e.g., the parts that match more than a single escape char (for
octal etc.).  Using separate regexps (which can still be combined) for
the various parts lets you choose whether to highlight each char group
(e.g., highlight only hex escapes).

I can't imagine why someone would want to highlight hex escapes, yet keep octals and others unhighlighted. If we're going to support some languages that only support a few escape sequences, then modifying this regexp might be the way to go, yes, although writing separate, smaller specialized regexp(s) might be better.

FWIW, library highlight-chars.el lets you selectively highlight sets of
chars.  This works together with font-lock: you can choose whether
other font-lock highlighting overrides, is overridden by, or is merged
with this highlighting (applied after or before it).

You can specify chars to highlight in various ways: (1) individually
(any in a given string), (2) using ranges, (3) using character classes
(e.g. [:digit:]), and (4) using character sets (e.g. `iso-8859-1' or
`lao').  You can also specify sets of chars to be excluded from such
highlighting - IOW, specify a set by subtraction as well as by
addition.

That's nice, but we really need regexp here. And there's no point relying on third-party library, the code is small as it is.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]