Hi,
I've just started using TM, previously I used emacs. When I typed a perl line like:
my $p = Base::Sub->new (id => 1234, name => "test");
I would only have to hit tab on each new line to move the cursor to below the appropriate place on the above line i.e. it auto formatted the code for me. TM doesn't seem to do this, which is annoying the hell out of me. Can someone help please?
Simon-
I keep my Perl code formatted using the "Tidy" command. I keep things semi-aligned myself, and then do a "Tidy" (control-shift-H) periodically. Everything ends up very nicely formatted.
-albert
PS. I don't miss emacs for a second.
On Dec 6, 2007 10:35 PM, Simon Holroyd holroyd@sanger.ac.uk wrote:
Hi,
I've just started using TM, previously I used emacs. When I typed a perl line like:
my $p = Base::Sub->new (id => 1234, name => "test");
I would only have to hit tab on each new line to move the cursor to below the appropriate place on the above line i.e. it auto formatted the code for me. TM doesn't seem to do this, which is annoying the hell out of me. Can someone help please? -- View this message in context: http://www.nabble.com/Lining-up-code-automatically---perl-mainly-tf4958584.h... Sent from the textmate users mailing list archive at Nabble.com.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Thanks.
I've tried to use perltidy and I get the following error pasted into the top of the script I am attempting to tidy:
Possible precedence problem on bitwise & operator at /sw/lib/perl5/Perl/Tidy.pm line 1840.
Which is really annoying. This is obviously a problem with the Tidy module so I'll take a look at upgrading it.
Thanks for the reply. I'm still not to sure about TM over emacs, but I'll give it a fair go.
-Simon
Albert Vernon Smith-2 wrote:
Simon-
I keep my Perl code formatted using the "Tidy" command. I keep things semi-aligned myself, and then do a "Tidy" (control-shift-H) periodically. Everything ends up very nicely formatted.
-albert
PS. I don't miss emacs for a second.
On Dec 6, 2007 10:35 PM, Simon Holroyd holroyd@sanger.ac.uk wrote:
Hi,
I've just started using TM, previously I used emacs. When I typed a perl line like:
my $p = Base::Sub->new (id => 1234, name => "test");
I would only have to hit tab on each new line to move the cursor to below the appropriate place on the above line i.e. it auto formatted the code for me. TM doesn't seem to do this, which is annoying the hell out of me. Can someone help please? -- View this message in context: http://www.nabble.com/Lining-up-code-automatically---perl-mainly-tf4958584.h... Sent from the textmate users mailing list archive at Nabble.com.
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On 7 Dec 2007, at 12:20, Simon Holroyd wrote:
Thanks.
I've tried to use perltidy and I get the following error pasted into the top of the script I am attempting to tidy:
Possible precedence problem on bitwise & operator at /sw/lib/perl5/Perl/Tidy.pm line 1840.
Which is really annoying. This is obviously a problem with the Tidy module so I'll take a look at upgrading it.
That looks like a pretty old perltidy:
2003 07 26 -Corrected cause of warning message with recent versions of Perl: "Possible precedence problem on bitwise & operator at ..." Thanks to Jim Files.
On 6 Dec 2007, at 22:35, Simon Holroyd wrote:
I've just started using TM, previously I used emacs. When I typed a perl line like:
my $p = Base::Sub->new (id => 1234, name => "test");
I would only have to hit tab on each new line to move the cursor to below the appropriate place on the above line i.e. it auto formatted the code for me. TM doesn't seem to do this, which is annoying the hell out of me. Can someone help please?
I bind a key to perltidy and forget all about formatting apart from that. I use something like this:
dir=`dirname $TM_FILEPATH` up=''
for i in 1 2 3 4 5 ; do try="${dir}${up}/perltidyrc" [ -f $try ] && break; try="${dir}${up}/.perltidyrc" [ -f $try ] && break; up="$up/.." done
if [ -f $try ] ; then perltidy -st -q -pro=$try "$TM_FILEPATH" else perltidy -st -q "$TM_FILEPATH" fi
So that if I'm working on a project that has its own perltidyrc or .perltidyrc I use that otherwise my default settings.
Simon Holroyd wrote:
I've just started using TM, previously I used emacs. When I typed a perl line like:
my $p = Base::Sub->new (id => 1234, name => "test");
I would only have to hit tab on each new line to move the cursor to below the appropriate place on the above line i.e. it auto formatted the code for me. TM doesn't seem to do this, which is annoying the hell out of me. Can someone help please?
Hmmm... It works fine for me, but I use a different indentation style. I tried typing in that fragment you sent, and this is how TM formatted it for me:
my $p = Base::Sub->new (id => 1234, name => "test");
In case the mailer screws up the formatting, the second line is flush with the left margin, and the third line starts with the cursor indented by one (soft) tab stop.
Normally I'd break the line differently, leaving the opening parenthesis on the first line.
my $p = Base::Sub->new( id => 1234, name => "test");
Both the 2nd and 3rd lines and indented one tab stop. In both cases, if I hit another return and continue to type, the 4th line is also indented (which it shouldn't be). So the auto-formatting does work, though it's pretty dependent on your idea of style matching that of the the bundle author. There's definitely room for improvement.
(And a stupid is-it-plugged-in question: You *are* in Perl mode, right?)