Emacs R режим ESS

1530
CodeKingPlusPlus

Я могу запустить интерпретатор R через Emacs. Тем не менее, я ищу режим R для написания сценариев, которые будут выполнять подсветку синтаксиса, автозаполнение и т. Д. (Дайте мне знать, если есть другие функции, которые вы бы порекомендовали также).

Например, я открыл R-скрипт (с расширением файла .R), но режим говорит fundamental, как бы я мог R modeиспользовать его при открытии R-скриптов?

Я использую Ubuntu 12.04 LTS и emacs 24.3, дайте мне знать, если вам нужна дополнительная информация, и спасибо заранее!

3
В вашем файле `.emacs` есть строка` (setq-default ess-dialect "R") `? SlowLearner 10 лет назад 0

1 ответ на вопрос

4
Aaron Miller

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.

Похожие вопросы