[ESS] Integration of pandoc using polymode+knitr
xie at yihui.name
Wed Mar 12 03:04:56 CET 2014
I'm glad that your problem was solved. Just as Ahmadou mentioned, we
are heading towards rmarkdown (http://rmarkdown.rstudio.com), which is
a nice alternative to knitr::pandoc().
Yihui Xie <xieyihui at gmail.com>
On Mon, Mar 10, 2014 at 8:59 PM, Mathieu Basille
<basille.web at ase-research.org> wrote:
> Le 03/10/2014 09:16 PM, Ed Kademan a écrit :
>> When you define a function you need to include an argument list. Your code
>> should probably start out looking something like this
>> (defun ess-swv-pandoc ()
>> "Run Pandoc on the associated .md file."
> Ah, that's perfect! Just what I was missing. Well, this shows how bad I am
> regarding Lisp! Thanks Ed!
> Here is my working function, definitely not a clean approach, and totally
> dependent on my system, but it should get those people interested started,
> and it's working at least for me:
> (defun ess-swv-pandoc ()
> "Run Pandoc on the associated .md file."
> (let* ((rmd-buf (current-buffer)))
> (let* ((sprocess (ess-get-process ess-current-process-name))
> (sbuffer (process-buffer sprocess))
> (md-filename (file-name-sans-extension (buffer-file-name)))
> (buf-coding (symbol-name buffer-file-coding-system))
> (format "require(knitr); pandoc(\"%s.md\", format =
> \"html\", config =
> (message "Running pandoc on %s.md" md-filename)
> (ess-execute pandoc-cmd 'buffer nil nil)
> (switch-to-buffer rmd-buf)
> (ess-show-buffer (buffer-name sbuffer) nil)))))
> (define-key polymode-mode-map [(control f5)] 'ess-swv-pandoc)
> Since I associated (f5) to 'ess-swv-weave, I can first weave the .Rmd file
> using knitr (f5) and then render as HTML the resulting file using the
> knitr::pandoc (C-f5). All Pandoc options are then tuned in
> /home/mathieu/.emacs.d/config/config.pandoc, see  for more details.
> Now, this does exactly what I wanted, thanks a lot!
>  http://yihui.name/knitr/demo/pandoc/
> ~$ whoami
> Mathieu Basille, PhD
> ~$ locate --details
> University of Florida \\
> Fort Lauderdale Research and Education Center
> (+1) 954-577-6314
More information about the ESS-help