[ESS] ESS[R}: Evaluate region keyboard command

Peter Geelan-Small peter.geelan-small at sydney.edu.au
Fri Aug 6 07:39:43 CEST 2010

G'day, McKay.

Thanks for your reply. I copied the code below into my .emacs file and restarted Emacs. When I then got R going etc., highlighted a section of code and used Shift+Enter, the highlighted code was deleted and nothing went to R.

This is becoming a bit of a mystery!!



-----Original Message-----
From: s.mckay.curtis at gmail.com [mailto:s.mckay.curtis at gmail.com] On Behalf Of S. McKay Curtis
Sent: Friday, 6 August 2010 2:42 PM
To: Peter Geelan-Small
Cc: ess-help at stat.math.ethz.ch
Subject: Re: [ESS] ESS[R}: Evaluate region keyboard command

Hi Peter,

I am not sure why "C-c C-r" is not working on your emacs.  However,
you may find the following suggestion useful (see the suggestion from
"FelipeCsaszar" on th ESS wiki
http://www.emacswiki.org/emacs/EmacsSpeaksStatistics#toc2).  If you
add the following lines of code to your .emacs file, you will then be
able to use Shift+Enter to send a region of code OR a single line of
code to the R session buffer:

(defun my-ess-eval ()
  (if (and transient-mark-mode mark-active)
      (call-interactively 'ess-eval-region)
    (call-interactively 'ess-eval-line-and-step)))

(add-hook 'ess-mode-hook
    (local-set-key [(shift return)] 'my-ess-eval)


Steven "McKay" Curtis
Postdoctoral Research Associate
University of Washington
Department of Statistics
Box 354320
Seattle, WA 98195-4320
(206) 543-6851

On Thu, Aug 5, 2010 at 9:11 PM, Peter Geelan-Small
<peter.geelan-small at sydney.edu.au> wrote:
> G'day, Everyone.
> I'm trying to find the keyboard command that you can use to send a
> highlighted block of code from ESS to R for evaluation. I highlight a
> block of code and then try C-c C-r or C-c M-r, which I found in the
> documentation, but neither pair works. Can someone please shed some
> light on this?  The commands C-c C-c for sending the paragraph that the
> cursor is in and C-c C-j (or C-c C-n) for sending a single line of code
> work perfectly well for me.
> My set up is:
> Windows XP SP3
> GNU Emacs 23.1 (from Vincent Goulet's package)
> ESS 5.4
> R 2.10.0
> Regards,
> Peter Geelan-Small
> ______________________________________________
> ESS-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/ess-help

More information about the ESS-help mailing list