[TxMt] Perl Indentation Problems/Register Buffers

Rusty Conover rconover at infogears.com
Sat Nov 11 23:35:14 UTC 2006


Hi Textmate Guys,

I'm trying out textmate using version 1.5.4 and I checked out bundle  
revision 6074 from SVN this afternoon.  It appears the perl bundle  
has a few problems with indenting. Specifically with nested hashes  
and closing curly braces.

Typing this code is fine (the auto-indenting works great):

my $b = {
   a => {
     test => 1
   },
   b => {
     test_me => 2
   }
};

But if you were to re-indent that section you wind up with:

my $b = {
   a => {
     test => 1
     },
     b => {
       test_me => 2
     }
   };


Obviously this causes lots of problems for code read ability.

Secondarily, if you have a statement like:

my ($brand_name, $product_name) = $self->{feed_db}->selectrow_array 
("select brand, name from products where sku = ? limit 1", undef,
                                                                      
$results->{unique_product_id});

And reindent it changes to:

my ($brand_name, $product_name) = $self->{feed_db}->selectrow_array 
("select brand, name from products where sku = ? limit 1", undef,
$results->{unique_product_id});

Is there a way to indent the parameters to keep alignment with the  
first parameter, this helps for really long statements that take  
multiple lines.

It also appears to have problems with if statements like:

if($bar) {
   if($car) {
     $baz;
   } else {
     $car;	
   }
}


After re-indent that becomes:

if($bar) {
   if($car) {
     $baz;
     } else {
       $car;	
     }
   }


It would appear this is a general problem with a closing curly brace  
as even,

foo(bar => {
   a => 1,
},
car => {
   test => 3
})


Becomes:

foo(bar => {
   a => 1,
   },
   car => {
     test => 3
     })


Secondarily:

Is it possible to have a preference so that:

foo(bar => {
   a => 1,
   })

When indented becomes:

foo(bar => {
       a => 1,
     })

Lastly a more general Textmate question coming from XEmacs. I didn't  
see any support for register buffers.  Would there be a way to add  
them?  As for what a register buffer does is that it allows you to  
copy to a named "register" (commonly you pick a letter), and then you  
can insert a register by just entering that same letter that you  
copied the contents to.  You can see the docs from XEmacs about this  
here:

http://www.xemacs.org/Documentation/21.5/html/xemacs_13.html#SEC102

This would require support for reading input from the user once they  
hit the appropriate key binding.

Thanks,

Rusty





More information about the textmate mailing list