Hello Chuck, Thank you for the feedback. > You might want to check that point and mark are both inside the src block. Otherwise, the results are unpredictable. You are right, I've updated the patch. > ess-mode, python-mode, sh-mode and octave-mode already provide this capability (and a lot more) for R, python, shell scripts, octave/matlab and some other languages from the edit buffer. I understand that. My idea is to avoid the need to C-c ' back and forth. Actually that's a problem I have with org-babel; I usually find myself coding inside the src block and losing many of the major mode functionalities; switching to the edit buffer often seem too much of a hassle. Any tips about how to get more major-mode functionalities inside the src-block? Or should I develop the muscle memory to switch back and forth to the edit buffer all the time? > `org-babel-demarcate-block' gives the user the ability to break up src blocks into smaller pieces so they can be run independently. Thanks for pointing that; I didn't know about `org-babel-demarcate-block'. Best, Carlos 2015-11-02 13:19 GMT-05:00 Charles C. Berry : > On Sun, 1 Nov 2015, Carlos Henrique Machado S Esteves wrote: > > Hello, I find it useful to be able to execute only a region of a source >> code block, so I've implemented a new function for that. I've tested it >> with MATLAB and Python, but it should work for any mode, since it calls >> org-babel-execute-src-block. >> >> > You might want to check that point and mark are both inside the src block. > Otherwise, the results are unpredictable. > > Also note that: > > ess-mode, python-mode, sh-mode and octave-mode already provide this > capability (and a lot more) for R, python, shell scripts, octave/matlab and > some other languages from the edit buffer. > > `org-babel-demarcate-block' gives the user the ability to break up src > blocks into smaller pieces so they can be run independently. > > Best, > > Chuck > >