[TxMt] Reformat comment command

James Edward Gray II james at grayproductions.net
Wed Aug 23 23:25:08 UTC 2006

On Aug 23, 2006, at 5:51 PM, Alan Schussman wrote:

> On Aug 23, 2006, at 3:20 PM, James Edward Gray II wrote:
>>>>     text = `ruby "#{ENV["TM_SUPPORT_PATH"]}/bin/rubywrap.rb" # 
>>>> {flags}`
>>> Here's where I go "huh." That works, but 1) I don't at all get  
>>> how the input is passed to the command; and 2) if I call on  
>>> STDIN.read prior to this line (by using it to get the beginning  
>>> of the input), then that line fails to get any input, and I have  
>>> to manually pipe the text back into it. What's happening there?
>> Well, if you call read(), you consume the input, so it's not there  
>> to pass on to the child process.
> I was guessing that was the case. But how about the first question,  
> if there is input how does that statement suck it up automatically?  
> (Apologies if this is excruciatingly basic; I'm just trying to  
> understand how the input gets passed without explicitly doing so.)

To put it simply, this is just how Unix works.  ;)

Child process inherit STDOUT, STDIN, and STDERR from their parent  

>> Here's the code I just moved into the Source bundle.  Let me know  
>> if this is working please:
> It looks like it works well for most cases, but I think the more  
> lenient regex causes a problem in the case of a latex comment such  
> as "%\usepackage" (note no space); in that case, the comment  
> parameter is set to "%\" and the backslash ends up causing problems.

If I remove backslash from the characters would that cover us?  I  
don't *think* it's a comment in any language I know...

James Edward Gray II

More information about the textmate mailing list