As I understand it from this primer, the mode in question is R-mode
. You can confirm this by visiting a file of R code and doing M-x R-mode
; if your buffer is fontified (i.e., syntax-highlighted), you know this is the mode you want to use for your R files.
To automatically set this major mode when visiting files of R code, add the following to your Emacs init file (~/.emacs
, /.emacs.el
, ~/.emacs.d/init.el
, &c.):
(add-to-list 'auto-mode-alist '("\\.R$" . R-mode))
Please note that I haven't actually had cause to use ESS myself, so may be mistaken in the mode name for R source. That said, the pattern will hold true for whatever mode you need to invoke; if you can find out the name of the mode you need, substituting it for R-mode
in the (add-to-list)
call will produce the desired effect.