[TxMt] Re: Improvements to Objective-C Bundle

Nithin Reddy jashugan at gmail.com
Thu May 3 04:29:01 UTC 2007

 > Yeah, /* … */ doesn't nest, that's really a language
> limitation — for this reason I am using // as the primary comment
> character, since that nests nicely.
> The default for C and Objective-C was having /* … */ as primary, but
> I just changed that. FYI this is a preference in the C bundle.

I'm enamored with how /* ... */ looks, especially when it spans multiple lines.

> > Plus, how do you undo it when you want to uncomment the code?
> It is a toggle. I.e. just hit ⌘/ again.

Thanks didn't know that.

> But I often make use of #if 0 … #endif to disable code in C. This
> also nests nicely and TextMate will render the disabled part as a
> comment, and it allows you to use #else, for example:
>      #if 0
>        // old code
>      #else
>        // new code
>      #endif
> Now you can just change 0 to 01 (or just 1) to switch from the new
> code back to the old vice versa.

Thanks for the tip. In the past I used a different version of this technique:

#ifndef NOT_DEF
//old code

I stopped using it, because in Visual Studio it would left-align any
macros, which looked very odd.

In any case, I like your way.

More information about the textmate mailing list