[ESS] Modify highlighting colours for character strings in R buffers

Gavin Simpson gavin.simpson at ucl.ac.uk
Sat Aug 29 17:11:35 CEST 2009


On Sat, 2009-08-29 at 08:56 -0500, Marc Schwartz wrote:
> On Aug 29, 2009, at 7:16 AM, Gavin Simpson wrote:
> 
> > Dear list,
> >
> > With the new version of Emacs with the nice font support now released,
> > I'm finding it a bit more difficult to read strings in R buffers due  
> > to
> > them having a light purple/pink colour. I find this colour blends into
> > the background a bit too much for my personal taste.
> >
> > Is there a way to customise the colours used for character strings  
> > in an
> > R buffer?
> >
> > Thanks in advance.
> 
> Gavin,
> 
> You can modify the colors for defined faces in the.emacs file. For  
> example, I have the following within the (custom-set-faces ...) section:

Cheers Marc. I thought that this was perhaps something specific to ESS
and it didn't occur to me to look into Emacs customisation.

I'm now happy with ForestGreen for strings.

All the best,

G

> 
>   '(font-lock-comment-face ((((class color) (background light))  
> (:foreground "Blue" :italic nil))))
>   '(font-lock-constant-face ((((class color) (background light))  
> (:foreground "Red"))))
>   '(font-lock-doc-string-face ((((class color) (background light))  
> (:foreground "ForestGreen"))))
>   '(font-lock-string-face ((((class color) (background light))  
> (:foreground "ForestGreen"))))
>   '(font-lock-type-face ((((class color) (background light))  
> (:foreground "Red"))))
> 
> 
> Beware any line wrap of the above. These colors, etc. work for me, but  
> may not be pleasing for others. I should also note, that I have the  
> buffer background set to white, which I prefer, but I know others have  
> differing colors in use.
> 
> If you use:
> 
>     M-x customize-group <RET> font-lock-faces <RET>
> 
> that will get you to the appropriate settings for the highlighting  
> colors, etc. If you adjust the settings there and use 'Save for future  
> sessions', the updates will be saved in .emacs. If you use the 'Set  
> for current session', the changes should be made to your current  
> working session, without having to exit and restart emacs. If you just  
> want to play around for the current session, without affecting new  
> sessions, just use the latter until you get things the way you want.
> 
> HTH,
> 
> Marc Schwartz
> 
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the ESS-help mailing list