When using R
code chunks in an .Rnw
document, the emacs buffer automatically detects that the cursor is within a code chunk (i.e. within <<>>
and @
), and switches to ESS-mode -- this is very valuable because one can get ESS-based code-formatting within the code-chunk, and more-usefully, one can send code lines/regions to the inferior *R*
process-buffer.
How do I get the same functionality in an org-mode file within R
code blocks (i.e. between #+begin_src R
and #+end_src
) -- I'd like emacs to automatically recognize it's within an R code code block, and turn on ESS-mode so I can send snippets of code to the *R*
process. I am aware that I can do Ctl-C '
and switch to a different ESS-mode buffer where I can edit the code and get all the other ESS-mode conveniences (including sending code to R
). However I'd like to not have to do this, i.e. I want to be able to send code-snippets from the R code block in the same org-mode buffer.