[TxMt] Python mode: offering some code and some suggestions

Domenico Carbotta domenico.carbotta at fastwebnet.it
Wed Nov 30 17:03:26 UTC 2005

> In the course of my evaluation, I changed some settings to try and  
> get closer to what I expected.  I gave up when I discovered that  
> the current approach to code folding (finding code block ends,  
> specifically) was apparently fundamentally incompatible with Python.

I'm pretty sure someday TM will support code folding purely based on  
indentation. There's a script bound to cmd+shift+V that modifies the  
indentation of blank lines to make folding work 99% of the time, you  
just press it and the little arrows rearrange nicely :)

> That's pretty standard Python style.  I was also curious to see if  
> I could make a line break inside a parenthesis autoindent to the  
> open parenthesis, but didn't see a way to do that.

that's possible but quite... er... nasty. you'd have to create a  
command that finds the position of the last unmatched parenthesis and  
inserts NL and a congruous number of spaces, then bind it to the  
enter key. one day I'll hack on it.

> Finally, pycheckmate didn't work for me.  The first reason had  
> something to do with using a specific Python installation, rather  
> than the environment Python.  I fixed that, and then the second  
> problem was that the custom popen relied on poll, which wasn't  
> included in the framework Python build.

you want to check the new version which fixes that (it was committed  
like two days ago IIRC)

> Pycheckmate also wasn't guessing where to find an installed  
> pychecker very well--I guess the intent was that you were supposed  
> to configure the environment variable in TextMate.
> That seemed unnecessary for the common case of installing via  
> distutils.  I fixed that at the start of the attached file--a bit  
> of a hack, maybe, but nicer first-use experience.

I'll forward your changes to Jay Soffian for merging.


-- Official Python Advocate of the ##textmate Channel.

More information about the textmate mailing list