[ESS] Interaction with Sweave, knitr, pandoc, polymode et al.

Vincent Goulet vincent.goulet at me.com
Mon Apr 4 05:50:40 CEST 2016

Please bear with me, I have many related issues to address.

I had been paying little attention to the process of sweaving with ESS for some time as I didn't have much to do and when I did, it was mostly for large projects on which I rely on makefiles.

I find myself looking into all this more closely these days and also investigating how knitting with rmarkdown works in Emacs.

First, I realize that the mechanisms now in place in ESS to sweave and compile to PDF a .Rnw file perfectly fit my workflow, especially when ess-swv-plug-into-auctex-p is true. One can start compilation with C-c C-c as usual and choose either to only sweave the file or to sweave and then compile to PDF with LaTeX. The TeX engine chosen on the AUCTeX side is honoured as seen to be the encoding of the file. Nice work ESS people!

However, when .Rnw files are associated with poly-noweb+r-mode (from polymode) as is the case in my distribution, the whole ESS and AUCTeX integration seems to be disabled. I think this is unfortunate. Enough to strongly consider removing the default association in my distribution. If one wants to use the whole polymode approach for what I'd consider "pure" Sweave files, one would need to opt-in via ~/.emacs.

What do you people think of that?

Second, polymode appears to be the best choice to work with rmarkdown on Emacs. In order to have my Emacs distribution R Markdown-ready as much as possible, I'd keep at least the following association enabled by default:

(add-to-list 'auto-mode-alist '("\\.Rmd" . poly-markdown+r-mode))

Third, pandoc. I discovered that RStudio ships with a version. [And also that rmarkdown has special bindings to find the RStudio version of pandoc, but otherwise lets you on your own. Not impressed.] I thought that doing the same for Emacs could be nice to have a distribution fully markdown and rmarkdown ready. I can tell markdown-mode where to find a parser by setting 'markdown-command'. However, rmarkdown::render() does look at this variable and relies on pandoc being on the shell's path.

If I don't want to install anything outside of the Emacs distribution tree both on Windows and on OS X, do I have any way to configure rmardown or polymode to use a version of pandoc that would be bundled with Emacs?

Thanks in advance for any pointers and ideas.


More information about the ESS-help mailing list