On 29. Nov 2006, at 02:49, Chris Thomas wrote:

On Nov 28, 2006, at 4:26 PM, Allan Odgaard wrote:
As for the code: You would make me really happy if the style (i.e. wrt spacing and indent) would follow the rest of the source :) I try to do the same for you when I patch CommitWindow etc. ;)
Update for style (no other changes).

Thanks :) The only thing I could spot now is the binding of * and &, i.e. I do:

    char const* foo = "string";
    void some_function (id& obj_by_ref);
    NSString* str = @"foo";

etc. -- i.e., no space before the pointer/reference indicator.

Are extra curlybrackets offensive? I usually prefer them to adding bugs later. Especially if switching between Python and the C family...

Well, for one line bodies, I never do them, and for one-line if/elses I do:

    if(something)
          then_expression;
    else  other_expression:

But I am okay with them, so feel free to add them -- spacing is really the main thing, because it is easy to see the inconsistency, so it sort of stands out.

Speaking of brackets, I have this macro I use myself quite a lot:

Attachment: Surround Line With Brackets.tmMacro
Description: Binary data


The key trigger is ⌥↩ -- what it does is, it takes the current line, puts a { and } before/after it, and indents the entire thing properly.

So imagine you have this:

    if(something)
       expression;

If you put the caret on the second line and press ⌥↩ you end up with:

    if(something)
    {
       expression;
    }

And caret still on expression -- it is scoped to C++ / Objective-C++ (not C / Objective-C, not sure why, but I never use the latter, so probably that is why ;) ).

Since it takes care of the indent, expression does not need to be indented properly, when pressing ⌥↩.

I’ve wanted to add this to the standard bundle, but I wasn’t sure ⌥↩ is the proper key, and if perhaps one should do a more general convention for this, as many languages have wrapping in brackets.

_______________________________________________
textmate-dev mailing list
[email protected]
http://lists.macromates.com/mailman/listinfo/textmate-dev

Reply via email to