[ESS] 2 things I wish ESS would do

tyler tyler.smith at mail.mcgill.ca
Tue May 6 20:02:07 CEST 2008


David Whiting <david.whiting at ncl.ac.uk> writes:

> Dear Paul and others,
>
>
> On Wed, Apr 30, 2008 at 06:31:56PM +0100, Stephen Eglen wrote:
>> 
>
>>  > 2. Can you make it easier to transfer commands that work from the *R*
>>  > window back to the script file "blob.R" ?  Once we do hack our way to
>>  > success in the *R* file, we want to get those commands back and save
>>  > them.  At the current time, the only way I can find is to highlight
>>  > the whole section of the *R* buffer, copy it over to "blob.R" and then
>>  > delete all the lines that don't start with > and edit the rest.
>
>
> I have found myself often wanting to do this as well, and needed to
> again today. So, based on Stephen's outline, I have hacked some code
> together. 
>

It seems to me that most of the necessary functions are already present
in ESS, just not available from ESS[S] mode. If inferior-ess-prompt were
defined for this mode, and the functions for transcript mode loaded,
there's not much left to do.

After manually defining inferior-ess-prompt in the .R buffer, and
loading transcript mode (doesn't seem to matter which buffer it gets
loaded for), the following works:

copy commands and output in the process buffer with M-h and M-w
switch to the desired .R buffer
yank the selection
select it and invoke ess-transcript-clean region

Is there a good reason to keep the ess-transcript functions and
inferior-ess-prompt hidden from ESS[S] mode? Appropriate helper
functions would be easy to cook up if the these items were available. I
imagine a single command to collect the current region in the process
buffer, prompt for the destination buffer, possibly with a default, and
then paste and clean the kill-ring at point in the destination buffer.

Cheers,

Tyler

-- 
Power corrupts. PowerPoint corrupts absolutely.
                                       --Edward Tufte

http://www.wired.com/wired/archive/11.09/ppt2.html




More information about the ESS-help mailing list