Getting started with R, Emacs, & ESS

Rich Heiberger rmh at
Mon Jul 15 02:01:35 CEST 2002

thank you for writing.

1.  don't touch ess-mode-font-lock-keywords.  That's where we tell
emacs about the syntax of the language, for example, that the symbol
"<-" is to appear in the font-lock-reference-face.

What you do wish to modify is the color associated with the various faces.
ESS defaults to the emacs default color associations.
Look at lisp/ess-font-lock.el where we defined several alternate schemes.
If you just want to redefine colors, look at ess-font-lock-rmh for a model.
I you want to play games with fonts as well as colors then look at

You can play with this dynamically  by executing the lines in
ess-font-lock-bw one at a time with C-x C-e

2.  You wouldn't want to use Rgui.  The alternate choices that we
recommend are so that you can write a program that can be aware of
which environment it is operating in.  When you start R with M-x R,
we define the options("STERM") for you.  If you start R any other way
then you are responsible for defining options("STERM").  With this option
you can write program statements like this:
   if (options()$STERM == "iESS") "do something interesting that requires ESS"

3. You want gnuclient.
With dired,
/anonymous at
then copy and gnuserv.readme.nt

gnuserv and gnuclient allow commuication between programs, for example,
from R, the command edit(functionname) will open Notepad with the contents
of the function.  Much more useful is edit(functionname, editor="gnuclient")
then the file opens in a new emacs buffer.  This example is a bit silly
(in my opinion) because you should be living in the myfunctions.r buffer
in emacs and sending individual lines over to *R* with the C-c C-n and
related commands.

A much better example is the pager.  Try page(date).  With your pager
set to gnuclientw the definition of the date function appears in an emacs
buffer (its own emacs buffer, not the *R* buffer).
This is critical when you are trying to understand how a function works.
This is particularly useful when you are working in the Rgui window.

You would almost surely prefer the definition in an emacs window so
you can search and page with familiar keystrokes.

ess-help mailing list -- To (un)subscribe, send
subscribe	or	unsubscribe
(in the "body", not the subject !)  To: ess-help-request at

More information about the ESS-help mailing list