[ESS] ess beginner issue: evaluate line/region commands

tyler tyler.smith at mail.mcgill.ca
Sun Dec 14 13:15:33 CET 2008


LeCzar <sirnixu at gmail.com> writes:

> Hi all,
> I am trying to use ess together with R, but I am used to simple commands for
> running a line (or region) from the script. The C-c M-j command seems
> inconvenient to me regarding two things: 
> 1) I need to press four keys, while I was used (and like the efficiency) to
> two keys in Rkward and R under Windows. Anyone got a solution for that? 

M-j is the same as <enter>, so that will cut it down to three keys.

> 2) The cursor jumps out of the script after executing the command, but I
> want it to stay in the script. I haven't found another command satisfying
> that. Is there, or how can I change that?

There are lots of different alternatives, explained in the ess manual,
section `7.4 Sending code to the ESS process'. You could rebind your
favourite to a more convenient key (ex., one of the function keys).

   * `C-c C-j' (`ess-eval-line')
     Send the line containing point to the ESS process.

   * `C-c M-j' (`ess-eval-line-and-go')
     As above, but returns you to the ESS process buffer as well.

   * `C-c C-f' or `ESC C-x' (aka `M-C-x') (`ess-eval-function')
     Send the S function containing point to the ESS process.

   * `C-c M-f' (`ess-eval-function-and-go')
     As above, but returns you to the ESS process buffer as well.

   * `C-c C-r' (`ess-eval-region')
     Send the text between point and mark to the ESS process.

   * `C-c M-r' (`ess-eval-region-and-go')
     As above, but returns you to the ESS process buffer as well.

   * `C-c C-b' (`ess-eval-buffer')
     Send the contents of the edit buffer to the ESS process.

   * `C-c M-b' (`ess-eval-buffer-and-go')
     As above, but returns you to the ESS process buffer as well.

   * `C-c C-n' (`ess-eval-line-and-step')
     Sends the current line to the ESS process, echoing it in the
     process buffer, and moves point to the next line.  Useful when
     debugging for stepping through your code.


> Also, is it possible to mark parts of the script by keyboard (common mark-up
> commands Shift+cursor keys doesn work), for example for copying/pasting
> regions within the script?
>

Shift + cursor keys work if you are using transient-mark-mode. See the
emacs manual, node `12.7 Persistent Marks'. They probably work when
you're not in that mode too, only by default emacs (prior to version 23)
doesn't provide a visual cue to show the current extent of the region.

Cheers,

Tyler


-- 
There is something fascinating about science. One gets such wholesale 
returns of conjecture out of such a trifling investment of fact.
                                       --Mark Twain




More information about the ESS-help mailing list