TM2 indentation behavior seems erratic (one key I hit out of ten is
dedicated to revert the last automatic indentation action) so I
disabled from the C bundle "Indentation Rules" and "Indentation Rules
(Comments)" in the bundle editor - I'm editing ANSI C files.
However, TM2 keeps changing the indentation in some random way (from
my perspective, while TM1 was mostly right). Is some special action
required to tell TM2 to stop altering the indentation till it gets
fixed?
As a more generic question, is there a way to tell TM2 "cancel the
last automatic indentation and do not repeat it on the next key hit"?
I really do prefer to lose automatic indentation rather than fighting
the indentation engine with every single edited line.
Thanks,
Manu
_______________________________________________
textmate mailing list
text...@lists.macromates.com
http://lists.macromates.com/listinfo/textmate
> TM2 indentation behavior seems erratic (one key I hit out of ten is
> dedicated to revert the last automatic indentation action) so I
> disabled from the C bundle "Indentation Rules" and "Indentation Rules
> (Comments)" in the bundle editor - I'm editing ANSI C files.
This will make it worse, as the auto-indent no longer have good rules to work with.
> […] Is some special action required to tell TM2 to stop altering the indentation
http://lists.macromates.com/textmate/2012-January/034056.html
> till it gets fixed?
For C the indentation is not considered broken. Which is not the same as perfect, see e.g.:
http://lists.macromates.com/textmate/2012-January/034269.html
http://lists.macromates.com/textmate/2012-January/034155.html
But if you have examples of something you think is clearly broken, please submit steps to reproduce.
> For C the indentation is not considered broken. Which is not the same as perfect, see e.g.:
> http://lists.macromates.com/textmate/2012-January/034269.html
I got this indent-each-line issue with another C-style coding, I can
remember which one by now,
but I'll keep you posted as soon as it triggers again.
> But if you have examples of something you think is clearly broken, please submit steps to reproduce.
Typically, from an empty file:
/**
* @file ns_gcov.c
*/
^
TM2 [9090] keeps indenting the caret, even after some #include
directive, or // C++-style comment block for example.
Thanks,
Manu
Another issue that seems to be related to the Doxygen/Javadoc comment block:
/**
* @file foo.c
*/
void foo()
Hitting "{" on the last line will produce a one-column indentation:
/**
* @file foo.c
*/
void foo()
{
}
Cheers,
I just got it:
/**
* Protection register
*/
static void spi_at45_cmd_3D(SpiAT45Sm * at45, uint8_t recv, uint8_t *send)
{
if ( ! at45->data_count )
{
fprintf(stderr, "ADDRESS: %02x %02x %02x\n",
at45->address[0],
Cmd-C the last line (at45->address[0])
Cmd-V to the next line, and hit Cmd-V again gives
fprintf(stderr, "ADDRESS: %02x %02x %02x\n",
at45->address[0],
at45->address[0],
at45->address[0],
etc.
Cheers,
> […] I just got it: […]
> fprintf(stderr, "ADDRESS: %02x %02x %02x\n",
> at45->address[0],
> at45->address[0],
> at45->address[0],
Which is exactly the case I linked to http://lists.macromates.com/textmate/2012-January/034269.html
The leading comment before #include is also known — the issue here is that includes are ignored for the purpose of indent, so it uses the level above the includes, and multi-line comments are messing this up.
> Which is exactly the case I linked to http://lists.macromates.com/textmate/2012-January/034269.html
Sure, I was just quoting it in my previous message.
> The leading comment before #include is also known — the issue here is that includes are ignored for the purpose of indent, so it uses the level above the includes, and multi-line comments are messing this up.
Ok. So is there some known workaround until it gets fixed, except
disabling the whole indentation feature altogether?
If I understand it right, as soon as a Doxygen comment is introduced
in a C file, there may be some issues with the following indentation.
As all my functions are doxy-commented, I'm in trouble ;-)
By "workaround", I mean something like "ignore all comments for
computing indentation level", and/or a special key sequence that could
tell TM2 to cancel and not re-attempt the last indentation action.
Thanks,
Manu
> […] If I understand it right, as soon as a Doxygen comment is introduced in a C file, there may be some issues with the following indentation. As all my functions are doxy-commented, I'm in trouble ;-)
Right.
> By "workaround", I mean something like "ignore all comments for computing indentation level",
The manual has a section about how these rules work. There are no hidden settings left out.
> and/or a special key sequence that could tell TM2 to cancel and not re-attempt the last indentation action.
2.0 only makes indent corrections if the line prior to your edit was indented according to the patterns, and after the edit, is not. So if you change the indent once, it should stick. There are some issues with blank/ignored lines though (as these have no known indent prior to the edit). There is no special key sequences etc.
>> By "workaround", I mean something like "ignore all comments for computing indentation level",
> The manual has a section about how these rules work. There are no hidden settings left out.
Ok, so I should read the manual to understand how to fix my indentation issues.
>> and/or a special key sequence that could tell TM2 to cancel and not re-attempt the last indentation action.
> 2.0 only makes indent corrections if the line prior to your edit was indented according to the patterns, and after the edit, is not. So if you change the indent once, it should stick.
If I understand it right, TM1 did not attempt to perform indent
corrections *after* editing, whereas TM2 does; this may be the reason
why I'm in trouble as long as I do not configure the indentation rules
to fit ours. Time to read the documentation…
Thanks for your help,
Manu.
About the indentation rules:
* can they be edited from the TM2 bundle editor? It does not look
like the changes are taken into account, maybe there's a "refresh" or
"reload" action to invoke?
* they are reverted to the original settings once TM2 is restarted.
Should I copy them into my user directory so that they override the
default ones?
I read the doc for TM1:
http://manual.macromates.com/en/appendix#indentation_rules.html
http://wiki.macromates.com/FAQ/TextMate2
I'm afraid I ask for questions that have been already replied dozens
of times, but I'm unable to google the proper ML answers :-(
> 2.0 only makes indent corrections if the line prior to your edit was indented according to the patterns, and after the edit, is not. So if you change the indent once, it should stick. There are some issues with blank/ignored lines though (as these have no known indent prior to the edit). There is no special key sequences etc.
Just to (hopefully) clarify how this is working for me in practice, if the line you are editing jumps to an unwanted indent level you need to re-indent with text on the line using cmd+[ – if you use delete to de-indent it will jump back to the unwanted indent after you start typing again. The cmd+[ will not work unless there is some text on the line.
> About the indentation rules:
> * can they be edited from the TM2 bundle editor? It does not look
> like the changes are taken into account, maybe there's a "refresh" or
> "reload" action to invoke?
You hit ⌘S after making changes, that should reload them automatically. You can always relaunch TextMate (⌃⌘Q) if you want to be sure that all caches are flushed, for indent patterns though I don’t believe there are any caching going on.
> * they are reverted to the original settings once TM2 is restarted.
In the bundle editor? That indicates they were not saved on disk. Though normally you should get a warning if closing bundle editor with unsaved changes.
> Should I copy them into my user directory so that they override the
> default ones?
No… perhaps you can give a step-by-step of how exactly you edited the patterns?