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

Marc Schwartz marc_schwartz at me.com
Sat Aug 29 15:56:58 CEST 2009


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:

  '(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



More information about the ESS-help mailing list