From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Charles C. Berry" Subject: Re: [PATCH] org-babel-execute-src-block-region Date: Wed, 11 Nov 2015 09:43:34 -0800 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:39823) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwZRD-0006uz-Bt for emacs-orgmode@gnu.org; Wed, 11 Nov 2015 12:44:23 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwZQn-0001W8-LQ for emacs-orgmode@gnu.org; Wed, 11 Nov 2015 12:44:03 -0500 Received: from outbound.ucsd.edu ([132.239.0.13]:17575 helo=iport-acv6-out.ucsd.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwZQn-0001Vv-CW for emacs-orgmode@gnu.org; Wed, 11 Nov 2015 12:43:37 -0500 In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Ista Zahn Cc: Xebar Saram , Carlos Henrique Machado S Esteves , emacs-orgmode Mailinglist 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