[ESS] keybinding for (ess-eval-paragraph) and more

Martin Maechler maechler at stat.math.ethz.ch
Fri Mar 17 20:18:31 CET 2006

>>>>> "MM" == Martin Maechler <maechler at stat.math.ethz.ch>
>>>>>     on Fri, 17 Mar 2006 11:49:18 +0100 writes:

>>>>> "Dan" == Dan Bolser <dmb at mrc-dunn.cam.ac.uk>
>>>>>     on Fri, 17 Mar 2006 10:20:55 +0000 writes:

    Dan> I thought I would post this code in the case that anyone finds it 
    Dan> useful, or can offer some improvements. I use sql-mode all the time, so 
    Dan> I find this function 'missing' from ess...

    Dan> (defun ess-eval-paragraph ()

    MM> Hmm,  ess-inf.el has been containing -- for about 10.5 years it
    MM> seems:

    MM> ---------------------------------------------------------------    

    MM> ;; This is from	 Mary Lindstrom <lindstro at Biostat.Wisc.Edu>
    MM> ;; 31 Aug 1995 14:11:43		To: S-mode at stat.math.ethz.ch
    MM> (defun ess-eval-paragraph (vis)

    MM> but it is not (yet) bound to any key inside ESS,
    MM> as you propose here :

    Dan> (global-set-key (kbd "C-c C-c") 'ess-eval-paragraph)

    MM> Since I just see that  C-c C-c  is indeed unbound
    MM> in the *.R buffers,  we could adopt your proposed key binding
    MM> indeed.

    MM> What do others think about the proposed keybinding?

    MM> I could envisage an even smarter thing:

    MM> Bind C-c C-c to  ess-eval-paragraph-or-function
    MM> which does not yet exist, but which would

    MM> - see if we are inside of a function definition;
    MM> - if yes, call ess-eval-function
    MM> - if  no, call ess-eval-paragraph

    MM> What do people think about this?

I only got another private positive reaction.
In the mean time, I've happily ``hacked away'' 
and set new menu entries and new key bindings for (partially)
new functions:

 C-c C-p :  ess-eval-paragraph-and-step
 C-c M-p :  ess-eval-paragraph-and-go

  and the pearl -- da dah! --

 C-c C-c :  ess-eval-function-or-paragraph-and-step

The latter now allowing to use C-c C-c to nicely step through
your source file, sending paragraphs or functions at a time...
Very nice, I must say myself!

As usual you can prefix the command by 'C-u' which toggles

I'm sure there could be some minor buglets there (in some
situations),  but it did nicely work in the few cases I tried.

Of course, everything is online available from the subversion
archive @ https://svn.R-project.org/ESS/  
but given the nice new feature (and some bug fixes that have been
waiting for a few weeks),  I'm thinking of releasing ESS 5.2.13
with the above new features pretty soon.

Waiting for feedback still (particularly from fellow ESS-corers!) ...

Martin Maechler, ETH Zurich

More information about the ESS-help mailing list