[ESS] [External] Re: Function to copy command to script?

Kevin Wright kw@@t@t @end|ng |rom gm@||@com
Tue May 19 18:35:29 CEST 2020


Thanks for the comments. I'm not talking about working with a transcript
file.  Rather, while I'm beta-testing a line of code in the inferior R
process buffer, and then get a final version that I like, I'd like a single
function to copy the most-recently-executed command (or the current command
line) back into the R script and insert it at point, without the need to
copy, switch-buffer, paste, switch buffer.  I could write this myself with
some pain, but I find myself doing this type of editing all the time, so I
figured there must already be a function.  But maybe not.

Kevin

On Tue, May 19, 2020 at 11:27 AM Richard M. Heiberger <rmh using temple.edu>
wrote:

> Hi Kevin,
>
> I think Stephen is assuming you do a lot of work in the *R* and then want
> to recover it into a script.
> For that case I wouldn't bother saving the *R* buffer, but would just copy
> the relevant lines (including output)
> and then save it back into the script file with C-u C-u C-y
> (ess-yank-cleaned-commands).
> The C-u C-u C-y strips out the prompts and output and pastes just the
> input commands.
>
> For the way I read your email, you are looking to copy just a single line
> from *R* to something.r.
> For that I would just highlight it, then copy and paste.
>
> Rich
>
> On Tue, May 19, 2020 at 12:14 PM Stephen Eglen via ESS-help <
> ess-help using r-project.org> wrote:
>
>>
>> On Tue, May 19 2020, Kevin Wright via wrote:
>>
>> > Is there a function to copy an inferior-buffer R command back to the R
>> > script and insert it at point?
>>
>> I'm not sure you get it in a single defun, but you can glue the
>> following bits together:
>>
>> https://ess.r-project.org/Manual/ess.html#Transcript-Mode
>>
>> so save your *R* buffer as a file.Rout, and then edit that file and run
>> ess-transcript-clean-region to remove the output and preserve just the
>> R commands  you sent.
>>
>> Stephen
>>
>> ______________________________________________
>> ESS-help using r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/ess-help
>>
>

-- 
Kevin Wright

	[[alternative HTML version deleted]]



More information about the ESS-help mailing list