[SVN] RFC: async window support for tm_dialog

Allan Odgaard throw-away-1 at macromates.com
Wed Nov 29 04:15:07 UTC 2006


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:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: Surround Line With Brackets.tmMacro
Type: application/octet-stream
Size: 1872 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate-dev/attachments/20061129/610d4791/attachment.tmMacro>
-------------- next part --------------

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.



More information about the textmate-dev mailing list