[TxMt] Code folding for Python?

Sean Schertell sean at datafly.net
Tue Oct 30 02:42:51 UTC 2007


Uh-oh... here we go with the Python whitespace wars. Fasten your seat  
belts :-)

Sean


On Oct 29, 2007, at 7:14 PM, Thomas Aylott wrote:

> Personally, I blame Python for being dumb.
> What kind of crazy language requires perfect whitespace or  
> everything breaks?!
> Sheer Madness!
>
> I wants my 1 line classes dagnabbit!
>
> On Oct 29, 2007, at 10:09 PM, Sean Schertell wrote:
>
>> Well, at least I have a clear answer now. It's a bit disappointing  
>> though that the code folding system as it's currently implemented  
>> wasn't made to handle one of the major scripting languages in use  
>> today (and my personal favorite)
>>
>> Oh well -- I guess I'll have to wait. Thanks again.
>>
>> :-)
>>
>> Sean
>>
>>
>>
>>
>>
>>
>>
>> On Oct 29, 2007, at 6:21 PM, Alex Ross wrote:
>>
>>>> Please forgive me if this has been asked and answered before...  
>>>> But is there any way to fold your code normally when using TM  
>>>> for Python?
>>>
>>> Well, yeah... this comes up from time to time.  But since you  
>>> asked, I'll forgive you.  ;-)
>>>
>>> The short answer is “no”.
>>>
>>> The longer answer is that Textmate folds by looking for “Start”  
>>> and “End” markers.  Python folding is indentation based, but  
>>> Textmate has no way of reliably matching that.  So we have some  
>>> hacks that don't really work.
>>>
>>>> Any tips from my fellow Pythonistas?
>>>
>>> You can use the “Cleanup Whitespace” command.  This command does  
>>> what it can to put the file in a state where the hacks can kinda- 
>>> sorta fold your code.
>>>
>>> But don't lose hope!  At some point in the future, the folding  
>>> system is getting an overhaul.  Things will be better then.
>>>
>>> – Alex
>>>
>>>
>>>
>>> ____________________________________________________________________ 
>>> __
>>> For new threads USE THIS: textmate at lists.macromates.com
>>> (threading gets destroyed and the universe will collapse if you  
>>> don't)
>>> http://lists.macromates.com/mailman/listinfo/textmate
>>
>> ::::  DataFly.Net  ::::
>> Complete Web Services
>> http://www.datafly.net
>>
>>
>> _____________________________________________________________________ 
>> _
>> For new threads USE THIS: textmate at lists.macromates.com
>> (threading gets destroyed and the universe will collapse if you  
>> don't)
>> http://lists.macromates.com/mailman/listinfo/textmate
>
> —Thomas Aylott – subtleGradient—
>
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate

::::  DataFly.Net  ::::
Complete Web Services
http://www.datafly.net




More information about the textmate mailing list