[ESS] Font lock bug?

Rodney Sparapani rsparapa at mcw.edu
Tue Jun 13 20:56:02 CEST 2006

Kevin Wright wrote:
> My setup: Windows 2000, R 2.3.1, ESS 5.3.1
> If you start R and type sqrt("a"), is "Error in" fontified in the output?
> For me, neither "Error in" nor "Warning in" are properly fontified.
> Only the "in" part is fontified as a keyword (in the usual face for
> "in").
> If I change ess-R-message-prefixes from:
> (defvar ess-R-message-prefixes
>   '("Error:" "Error in"
>     "Warning:" "Warning in"
>     "Warning messages"))
> to
> (defvar ess-R-message-prefixes
>   '("Error" "Warning"))
> then I do get fontification of "Error" in the output (and "in" has a
> different display face). Interestingly enough, using
>   '("Error" "Error:" "Error in"
> doesn't seem to work for me.
> Naive speculation:  I wonder if the fontification of "in" as a keyword
> is interfering with fontification of "Error in".  Font-lock patterns
> are scary things and since I have a working hack, I'm not going to dig
> further.
> Best,
> Kevin Wright

Hi Kevin:

It's not a bug per se.  There are two layers.  The font-locking which 
operates on keywords and the "grammar" which is related to 
"punctuation".  And, that is a simplification since they each have 
precedence rules and interact with each other.  It can be very tricky to 
get right.  And no matter what you do, it always seems like there are 
exceptions like these.  Tony has been working on newer, more advanced 
features that create a parser of an ESS supported language like R. 
Until that is complete, these kind of nuisance cases are likely to be a 
part of the ESS experience.


More information about the ESS-help mailing list