[ESS] ess-eval-chunk

Martin Maechler maechler at stat.math.ethz.ch
Mon Jan 8 15:09:15 CET 2007

>>>>> "StEgl" == Stephen Eglen <S.J.Eglen at damtp.cam.ac.uk>
>>>>>     on Sun, 7 Jan 2007 10:21:02 +0000 writes:

    StEgl> Shravan Vasishth writes:
    >> Hi all,
    >> Following earlier ess-help discussions, i use f5 for
    >> running chunks, but i would also like to have focus shift
    >> to the command line in the R buffer so I know what
    >> happened. As things stand, the code runs but I have to
    >> C-x o to the other window running the R
    >> process. Basically I want a single step chunk-evaluation
    >> the way we do C-c M-r for a region.
    >> Here's the current code in my .emacs:
    >> (defun my-ess-hook () "Add my keybindings to ESS mode."
    >> (local-set-key (kbd "<f5>") 'ess-eval-chunk)) (add-hook
    >> 'ess-mode-hook 'my-ess-hook)

    StEgl> Hi, I think the following defun might help you, also
    StEgl> in the ESS distribution.

    StEgl> Best wishes, Stephen

    StEgl> (defun ess-eval-chunk-and-go (vis) "Tangle the
    StEgl> current chunk, send to the ESS process, and go there.
    StEgl> Arg has same meaning as for `ess-eval-region'."  ...)

Indeed.  Note that this is automatically part of the 
"Eval and Go" submenu of the "ESS" menu (under the label "Eval chunk").

You should see the "ESS" menu whenever you're inside an R/S chunk.

It does not have a key binding though, and
of course can users bind it to <F?> keys.

For the normal (ess-eval-chunk ) {meaning "Eval chunk and don't go"},
however a simple key binding would be quite useful,
and if we are on this topic.

What would be quite neat would be an
function {+ easy key binding!}
which would let you step through your *.Rnw file evaluating
chunk after chunk, but keeping the latex around them visually.

For that reason I wouldn't want to quickly use up the few
remaining "nice" keybindings there.
'C-c RET' seems a free one that would be nice to use; one could
also consider re-assigning 'C-c C-c' since inside such Sweave
documents, a "chunk" is a much more natural unit than a
paragraph or function.


More information about the ESS-help mailing list