pimentel / atom-r-exec

Send R code to various R consoles from the Atom editor
https://atom.io/packages/r-exec
MIT License
19 stars 8 forks source link

Add option to clear the RStudio console before sending code #45

Closed ksmithbaylor closed 6 years ago

ksmithbaylor commented 7 years ago

When running and iterating on large chunks of code, I find it nice to clear the console each time before it runs so the code I previously ran isn't distracting. In RStudio, this can be done with ctrl+L, or the command cat("\f"). This new option prepends that command to any code that is sent to RStudio, so that the console is cleared each time.

It should also be possible to make this more generic so the consoles can be cleared on other targets as well, instead of just RStudio.

pimentel commented 7 years ago

Hey there @ksmithbaylor.

Thanks for this! Is there any reason you prefer cat('\f') to ctrl + L? I'm thinking it might be more convenient to not pollute the code that is being sent? But then again, I don't usually use this type of workflow so, I'm happy to hear opinions.

If we go-ahead with his future, I would also like to include this for some of the other applications (I can do that myself, unless you want to take a crack at it).

ksmithbaylor commented 6 years ago

I made this PR while in a class using R, which I haven't used since. With that in mind, I'm going to go ahead and close this, as it's unlikely that I'll have time or motivation to come back and add support for other applications (which is definitely the right way to go).