[ESS] BUGS mode

Rodney Sparapani rsparapa at mcw.edu
Mon Jun 18 21:12:16 CEST 2007


John P. Burkett wrote:
> The syntax highlighting problems I've noticed occur in .bug files but 
> not in .R files.  Consider, for example, the following line:
>  for (i in 1:n){
> In a .R file, on my machine, "for" and "in" are in red and everything 
> else is in white. That color scheme makes sense to me.  In a .bug 
> file, on my machine, the same line looks odd:  "for (" is in blue;  
> "in 1" is in red; and everything else in in white.  In my opinion, the 
> opening ( and closing ) should be in the same color.  Similarly, 1 and 
> n should be in the same color, preferably one that contrasts with that 
> used for "in".
> As a second example, consider this line:
> tau.y <- pow(sigma.y, -2)
> In a .R file, the <- is blue and everything else is white.  Again, 
> that makes sense to me.  In a .bug file, pow( is in blue and 
> everything else is white.  Again, the contrasting colors for the 
> opening ( and closing ) are a bit confusing.
>
> I don't mean to bash Emacs, ESS, or BUGS.  They're wonderfully useful. 
> I just wish I could put them together in a way that won't make my 
> students ask awkward questions about the significance of colors that 
> seem to have none.
>
> Best regards,
> John
>
Hi John:

Ah, as you expected, there is no bug then.  I don't know how they decided
what is what for R, but in BUGS it's pretty simple.  Things like model, in,
etc. are keywords, hence they are handled by font-lock-keyword-case.  
Functions
like for, logit, etc. by font-lock-function-face (note that they are 
only functions
if followed by a left parenthesis since you may have a variable of the 
same name). 
Comments (you guessed it) by font-lock-comment-face.  That leaves the 
odd man out,
font-lock-reference-face, for distributions.  So, I don't see a sensible 
way of
doing this differently.  YMMV

Rodney




More information about the ESS-help mailing list