[ESS] Syntax highlighting with R

Kasper Daniel Hansen khansen at stat.berkeley.edu
Sun Dec 7 01:38:08 CET 2008


As others have said, if you are using a reasonably new version of ESS  
and Emacs, high-lightning should be done automatically. You are aware  
that when you open a .R file it does not automatically gets "colored",  
you can make sure this happens by
M-x font-lock-fontify-buffer

Next step is to make sure you are operating on a clean .emacs - I  
would move the one you have temporarily and only keep the two lines  
that loads ESS as well as turns font-locking on.

Now you want to check whether you have font-locking in for other file  
formats eg. C or Perl. The color scheme you are using could be a  
colour scheme where all font-types have the same color (possible, but  
unlikely). If you do get coloring in C or Perl but not for R files, it  
sounds pretty strange.

If that is the case we probably need to know your Emacs and ESS versions
C-h v ess-version
C-h v emacs-version
(TAB completion works here). You might also want to tell us how you  
are running Emacs - in an X11 window on your local machine, on windows  
or...

Kasper



On Dec 6, 2008, at 14:06 , Graham Smith wrote:

> Stephen,
>
> Thanks,
>
>> Those last three lines starting with ' do not need to be in .emacs;  
>> the
>> ' just means to quote the following list, so that code is not  
>> evaluated
>> by emacs.
>
> Ah, I see,  I wasn't sure how the code should be added.
>
>> Do you have ESS loaded?  (e.g. somewhere else in your .emacs you load
>> 'ess-site.el' somehow.)  Does M-x R get you an R session?
>
> Loading a .R file opens ESS and M-x R loads R, and the assign symbol
> is in blue-green and executed commands in are bold, but that seems to
> be the only syntax highlighting I get. I was expecting to see more.
> But I don't have a line in emacs explicitly loading it (I have
> installed  ESS via synaptic on Ubuntu)
>
> Graham
>
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help




More information about the ESS-help mailing list