Hi, I am trying add a command to the R bundle that will send the current line to the R GUI, in the same way the ESS for Emacs "Eval line & step" command works. It is quite easy to send the line to R GUI, but I cannot find a good way to move to the cursor to the next line in TextMate. Currently I am using this Applescript to do the job: # move the cursor osascript -e 'tell application "System Events"' \ -e 'tell application "TextMate" to activate' \ -e 'tell process "TextMate"' \ -e 'keystroke (ASCII character 31)' \ -e 'end tell' \ -e 'end tell'
But the problem is that when you call the command using a keyboard shortcut ie. cmd+shift + R and keep holding cmd+shift for some time (I have this of a habit unfortunately :) ) the keystroke will be cmd +shift + (ASCII character 31) causing the text from the cursor to the end of the document to be selected.
Is there a smarter way to advance the cursor one line? -- maybe an internal TextMate command?
Thanks in advance. with best regards, Tobias Pyndt Steinmann
On 04.10.2008, at 18:12, Tobias Pyndt Steinmann wrote:
I am trying add a command to the R bundle that will send the current line to the R GUI, in the same way the ESS for Emacs "Eval line & step" command works.
Before I start one question. Which R bundle do you are using? The 'normal' one or the Review bundles R, R Console (R.app), R Console (Rdaemon)?
--Hans
On 04.10.2008, at 18:25, Hans-Jörg Bibiko wrote:
On 04.10.2008, at 18:12, Tobias Pyndt Steinmann wrote:
I am trying add a command to the R bundle that will send the current line to the R GUI, in the same way the ESS for Emacs "Eval line & step" command works.
Before I start one question. Which R bundle do you are using? The 'normal' one or the Review bundles R, R Console (R.app), R Console (Rdaemon)?
And I forgot my second question ;) Why do you want to do it?
--Hans
Hi Hans-Jörg
Den 04/10/2008 kl. 18.25 skrev Hans-Jörg Bibiko:
On 04.10.2008, at 18:12, Tobias Pyndt Steinmann wrote:
I am trying add a command to the R bundle that will send the current line to the R GUI, in the same way the ESS for Emacs "Eval line & step" command works.
Before I start one question. Which R bundle do you are using? The 'normal' one or the Review bundles R, R Console (R.app), R Console (Rdaemon)?
I must say I have only used R for three weeks now as part of a course at my university, so I have not found my preferred workflow yet. I am currently using the 'normal' R bundle, I just discovered the Console mode and your Rdaemon bundle. But I have not been able to find the above mentioned feature in non of them...
And I forgot my second question ;) Why do you want to do it?
My current workflow is to write my script in a .R file and then execute the script or parts of it. I have used MATLAB a lot and this is the way I work in MATLAB. With the 'normal' R bundle you can execute the entire script inside TextMate, send the entire script to the R GUI, or send a selection to the R GUI, but you cannot send the current line to R. That is if you only want to execute one line you have to select the line, which requires more click/keyboard actions. This is why I want to make a shortcut that send the current line to R and moves the cursor down to enable me to run the next line quickly.
It would also be nice to be able to do cells like in MATLAB: splitting the script into sections by two comment characters, and then run the cells independently.
But maybe it is my workflow that is the problem, how do you work with R in TextMate?
with best regards, Tobias Pyndt Steinmann
On Oct 5, 2008, at 7:54 AM, Tobias Pyndt Steinmann wrote:
That is if you only want to execute one line you have to select the line, which requires more click/keyboard actions. This is why I want to make a shortcut that send the current line to R and moves the cursor down to enable me to run the next line quickly.
Tobias, you have some nice suggestions, so I don't want to steer the discussion away from them, but just to answer this particular question, selecting the current line is a single extra keystroke: cmd- shift-L. Not perfect, but not too bad either I would think.
Haris Skiadas Department of Mathematics and Computer Science Hanover College