For whatever reason, my tab-width:4 setting sometimes gets over-ridden in a file, then I'm stuck with that tab width throughout. (I'm looking at you tab-width:2!)
I finally figured out how to fix this.
in user preferences
Which will almost fix things..
You'll notice that some code is tabbed twice in a row ...
just select all, shift+ctrl+p, choose reindent from menu
Code beautifully tabbed with tab-width:4 as god intended