Pregunta

I'm playing with mmm-mode to combine markdown-mode and ESS for editing Rmarkdown files. I'm using gnu emacs 24.3 on Windows 7 and up-to-date version of the aforementioned modes. This is what I've got in my .emacs file:

(require 'mmm-mode)   ;;; possibly init with (require 'mmm-auto) instead
(mmm-add-classes
 '((rmarkdown
    :submode r-mode
    :face mmm-declaration-submode-face
    :front "^```[{]r.*[}] *$"   
    :back "^``` *$")))
(setq mmm-global-mode 'maybe)
(mmm-add-mode-ext-class 'markdown-mode "\\.rmd\\'" 'rmarkdown)

That works so far as within a buffer showing an rmarkdown file, R code blocks are recognized and I get proper syntactically aware font-locking within both R code blocks and markdown blocks. More, when I have the point in an R code block I get ESS and Imenu-R menus and when it's in a markdown region I get a markdown menu. So far so good.

Here are my issues. Within R code blocks electric left assignment doesn't work. I can't simply hit the underscore key to get '<-' and to toggle between that and '_'.

Also, I don't get syntactically aware auto indentation for R code.

Both of these things work when I'm using ESS to edit files containing pure R code.

Any thoughts on how to tune this up? I'm aware of this previous post from nearly a year ago: How can I use Emacs ESS mode with R markdown? and the pointer to polymode, but polymode seems to be advancing slowly. I've also seen other pointers to org-mode for similar functionality and while that's a plunge I may take at some point, today my questions are about getting the most out of the combination of mmm-mode, markdown-mode and ESS. Thanks for your help.

¿Fue útil?

Solución

Polymode is the way to go. Unfortunately still in development, but works for most of the things.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top