configuration for R with ESS + XEmacs

A.J. Rossini rossini at
Thu Nov 7 14:54:42 CET 2002

>>>>> "john" == John Gavin <John.Gavin at> writes:

    john> Hi,
    john> I would like to use Xemacs with John Fox's 
    john> configuration files as per 
    john> I believe that I have followed the instructions in
    john> but I need help with a Xemacs Warning that occurs when
    john> I load a file with the extension *.Rnw or *.nw into Xemacs.
    john> e.g. if I load the sample Rnw file in 
    john> ...\R\rw1061\library\tools\Sweave\Sweave-test-1.Rnw

    john> The warning is
    john> "(1) (local-variables/warning) File local-variables error: 
    john> Symbol's value as variable is void: noweb-font-lock-mode"

This is somewhat harmless; you might M-x noweb-font-lock-mode when you
enter Noweb.  

However, I'm noticing that font-lock-mode doesn't stay activated the
way it used to (3 years ago when we wrote the noweb support), so
that's a bug to fix.

    john> Apart from the warning, everything seems to work
    john> as per the doucmentation except that the ESS 
    john> menu option is not visible when in a *.Rnw buffer
    john> and the usual command dont work 
    john> e.g. pressing the R toolbar buttons works
    john> but C-c C-n to send a line into R is 'not defined'.

For this to work, you have 2 options.  

1. If you are only using R within the file for code (which might be
the "usual" case if you are working only with R), you should use the
menus, Noweb -> Modes -> Set Default Code mode , and answer the prompt
with "R-mode" ("r-mode" should work as well).

2. If you are using other languages in the same file, set the mode
using Emacs local variables at the top of the chunk, in a comment in
the first line, i.e.:

<<my chunk to fit linear model>>=
# -*- mode: R -*-
fit1 <- lm(y~x)
fit2 <- lm(this ~ is + a + silly, data=example)
@ %def fit1 fit2

so that if you have C code, you would do something like:

<<my c code function>>=
/* -*- mode: C -*-   */
int adder(int x) {
@ %def adder

It's your choice.  I've been meaning to write a short function to
prompt for code mode if a default isn't set, but havn't gotten to it


A.J. Rossini				Rsrch. Asst. Prof. of Biostatistics
U. of Washington Biostatistics		rossini at	
FHCRC/SCHARP/HIV Vaccine Trials Net	rossini at
-------------- ----------------
FHCRC: M: 206-667-7025 (fax=4812)|Voicemail is pretty sketchy/use Email
UW:   Th: 206-543-1044 (fax=3286)|Change last 4 digits of phone to FAX
(my tuesday/wednesday/friday locations are completely unpredictable.)

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