Question

In matlab script editor, we can use double percent symbol to define a region. for example in the following matlab script, two region are defined:

%% region 1
a=1;
b=2;
%% region 2
c=7;
d=5;

The advantage of defining region is that you can just execute one region where the cursor locates rather than the whole script by press ctrl+enter.

if the cursor is at c=7; line, after pressing ctrl+enter, c=7 and d=5 will be executed while a=1 and b=2 will not be executed.

however, I have searched a lot from web to find something equivalent in ESS, there is no results.

There is a command 'eval region' in ESS, but I don't know how to define such a region.

Thanks in advance!

Was it helpful?

Solution

The region is emacs speak for the part of the text that you would (essentially) consider to be "highlighted" in a "normal"/GUI text editor.

You can read more about it in The Mark and the Region in the emacs manual.

As far as I know, there is no equivalent to the matlab behavior you are describing. The few times I have used matlab, though, I do recall finding it handy when poking at a problem using ad hoc scripts.

OTHER TIPS

As Steve said select a region, then all the standard ESS evaluation commands will act on a region (C-c C-c,C-RET,C-M-x).

But, what you describe sounds very interesting. Would you mind giving the full description of the workflow and markup, and post it to ess-help mailing list for a more thorough discussion? I would be interested in implementing such a feature. Thanks.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top