[TxMt] Re: How to execute all lines before the cursor position?

Steve King sking at arbor.net
Thu Apr 21 19:38:34 UTC 2011


On 2011-04-21 14:35, Marius Hofert wrote:
> Now when I executed the command, a lot of weird things happened

First a caveat. I know nothing about R. I'd never even heard of it 
before your question. I only installed the bundle briefly to see what it 
was doing, then deleted it. So I can't help you with the specifics there.

But, there were a couple things wrong with what I sent.  Serves me right 
for not posting exactly what I tested...  First, I had spaces around the 
equals sign in the assignment, which is a no-no in shell syntax.  
Second, at least in my test script, I had failed to quote the the 
$rawText variable in the echo command, which ended up stripping the 
newlines.  Here's my full test script cut'n'pasted straight from the 
bundle editor, and a screen shot of the output.

#! /bin/sh
rawText="`head -$(($TM_LINE_NUMBER-1))`"
echo "<pre>" "$rawText" "</pre>" | cat

The "<pre>" wrapper is to get the newlines to show up in the HTML output 
window; you'll want to eliminate that.  The '| cat' here is a 
placeholder for the 'osascript' command the R bundle script is calling.  
You'll need to keep the echo command as it is in the bundle (perhaps 
adding quotes around "$rawText" if they're not already there.)  In the 
screen shot the cursor is in the middle of the word "dolore" on line 
11.  I added some punctuation to the text to make sure that special 
characters came through okay. The HTML output window shows what would be 
passed on to the command in the R bundle if I still had that installed.

I hope it works for you this time around!

-- 
Steve King
Sr. Software Engineer
Arbor Networks
+1 734 821 1461
www.arbornetworks.com <http://www.arbornetworks.com/>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: screen.png
Type: image/png
Size: 123076 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20110421/5331e6ec/attachment-0001.png>


More information about the textmate mailing list