[TxMt] Ruby (Un)Comment command

Chris Thomas chris at m-audio.com
Wed Dec 22 18:48:52 UTC 2004

On Dec 22, 2004, at 11:15 AM, William D. Neumann wrote:

> On Wed, 22 Dec 2004, Chris Thomas wrote:
>> If Ruby 1.8 isn't installed in /usr/bin, you'll need to specify the 
>> full path to it. Ruby's default install location is /usr/local, so 
>> I'd guess that you need:
>> /usr/local/bin/ruby -s ...
> OK, that fixed the first problem... The ruby in /usr/bin was v1.6.8, 
> and TextMate was using that version instead of the 1.8.1 installed via 
> Fink. However, now that I'm using the correct version, I'm having new, 
> exciting issues...
> /Users/wneuman/Library/Dev/TextMate/comment.rb:23: invalid regular 
> expression; there's no previous pattern, to which '*' would define 
> cardinality at 6: /^\s*(*(.*)*)/ (RegexpError)
> Im guessing that this problem is stemming from the OCaml comment 
> delimiters being "(*" and "*)", which seem to be messing up the regexp 
> created in line 24 of the script. I'm guessing that they're not being 
> escaped when comment_expr is created, however, escaping them up when 
> they're defined in line 16 (either manually or via Regexp.escape) 
> wraps the block with escaped delimiters "\(\*" and "\*\)" -- this also 
> breaks uncommenting.
> Any Ruby speakers have a fix for this?
Replace the line:

  comment_expr = 


  # Quote any regexp characters
  regexp_quoted_comments = comment_strings.map {|string| 

  comment_expr = 


More information about the textmate mailing list