[ESS] Font-locking

Stephen Eglen S.J.Eglen at damtp.cam.ac.uk
Fri Apr 3 17:16:58 CEST 2009


S. McKay Curtis <smcurtis at stat.washington.edu> wrote:

> I'm still hoping somebody will show me a more elegant way, but the way
> above works for now.

Your recipe sounds as good as any.  One 'neat' way might to get emacs to
ask R dynamically for teh list of possible functions, but that might be
overkill as you probably start and stop emacs far more many times than
new versions of R are released (and hence the list changing).  What
might make sense is for ESS to include a text file with the output of:

base.obj <- objects("package:base",all.names=TRUE)
base.obj[-grep("(^[^.[:alpha:][:digit:]]|<-|__)",base.obj)]
write(base.obj, file='/tmp/r_names.txt')

(with that file being updated after every major release of R) and then,
upon loading ESS within Emacs, that file is consulted, and the functions
added to the keywords to be font locked.  (All customizable of course so
that users who don't want this behaviour won't get annoyed by everything
lighting up.)

Stephen




More information about the ESS-help mailing list