thanks Chuck this sounds very interesting! i installed polymode from melpa and added this config #+BEGIN_SRC emacs-lisp :results none (use-package polymode :ensure t :config (require 'poly-R) (require 'poly-org) (add-to-list 'auto-mode-alist '("\\.org" . poly-org-mode)) ) #+END_SRC i then loaded a .org file with R code and entered C-c C-n in the R code block yet nothing happens and the point moves to the end of the block are there additional config needed (keybinds, etc?), what am i missing? best z On Wed, Nov 11, 2015 at 7:43 PM, Charles C. Berry wrote: > On Wed, 11 Nov 2015, Ista Zahn wrote: > > I recommend using polymode[1] as a more general solution to the need to >> interact with code blocks without pulling up a separate edit buffer. It >> seamlessly switches major modes when point is inside a code block. >> >> Best, >> Ista >> >> [1] https://github.com/vspinu/polymode >> > > Ista, > > Thanks for this pointer. I've been meaning to check out polymode for > some time, and your posting gave me the push to try it out. > > For anyone who wants to try it, after cloning into ~/elisp/polymode I > only needed to add this in my init (ESS was already in my init). > > #+BEGIN_SRC emacs-lisp > (setq load-path > (append '("~/elisp/polymode" "~/elisp/polymode/modes") > load-path)) > (require 'poly-org) > (add-to-list 'auto-mode-alist '("\\.org" . poly-org-mode)) > #+END_SRC > > When point is inside a src-block the local mode prevails. So, C-c C-n > inside an R src block sends the line point is on to the R process. C-c > C-c sends the region (or function or paragraph) to the process when > point is in the body. To execute `org-ctrl-c-ctrl-c' on the src block > with the C-c C-c keying, it is necessary to move point to before or > after the body. > > --- > > Now that I have tried this, I agree that it is better to let polymode > handle this kind of interaction than to try to build it into Org mode. > > Best, > > Chuck > >