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
On 12. Nov 2006, at 00:35, Rusty Conover wrote:
[...] It would appear this is a general problem with a closing curly brace as even,
Yes, it seems there are no indent patterns specifically created for Perl, so it inherits the very simple default patterns, which is:
decreaseIndentPattern = '^(.**/)?\s*}[;\s]*$';
So only ; or whitespace is allowed to follow } for it to decrease the indent.
[...] Is it possible to have a preference so that:
No, sorry. The indent system is described here: http://macromates.com/ textmate/manual/appendix#indentation_rules
While I am certainly open to suggestions for how to improve this, the suggestions I have seen so far have made it ten times as complex, and still not much better.
Seems the declarative aspect needs to be dropped, if we want it to go much beyond what it currently can do -- though I have a few ideas for intermixing it more with scopes.
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.
I would think that clipboard history should make it out for this feature: http://macromates.com/textmate/manual/ working_with_text#clipboard_history
It’s simple enough to make a command to save the selection using some identifier, see http://macromates.com/textmate/manual/commands -- but I assume that when you want to insert it, you want to press some modifier + key, and not have to type in the identifier in a dialog? Cause that is problematic.