Ryan Wilcox wrote: > Hmm... another idea would be to write a script and attach it to BBEdit's Save > item so that it automatically performs Detab on your source code. Write in > tabs, have it automagically convert to spaces. Such a script is below: > > --name this "Fileā¢Save" and put it in the > --~/Library/BBEdit/Menu Scripts > on MenuSelect(menuName, menuItem) > tell application "BBEdit" > set myName to name of document 1 > > if myName contains ".py" then --python file!!!! > detab text document 1 tab width 4 > end if > end tell > return false --do the save operation > end MenuSelect
This looks dangerous. In Python, tabs are hard coded to equal 8 spaces. Any other setting is asking for trouble. If you have only tabs it's not a problem, but if they get mixed.... Could you also write a script then entabed all python files on load? It would have to use 8 spaces per tab when it did it, but that would mean that it wouldn't put tabs in when there were four spaces. It would be better to write it in python, then you could use the python parser to figure out the indentation, an re-write the file with all tabs. There have been scripts to do this floating around for years. I used to use them all the time, but now, thank goodness, most people just use spaces. All this because Bare Bones has decided for us that no one would ever want to map the delete key to mean "remove one level of indentation" when you're at the beginning of a line. -Chris -- Christopher Barker, Ph.D. Oceanographer NOAA/OR&R/HAZMAT (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception [EMAIL PROTECTED] _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig