dmitri wrote: |
Bob,
regexp is not something that can be called "trouble". Indeed, what trouble is in "replace \t with ' '"?
From regexp's perspectives, \t is tab and it's a trivial thing. Don't you agree?
|
Good point Dmitri. I tend to shy away from regexp because it never seems to do what I expect but in this case it is trivial.
dmitri wrote: |
But I should warn you. There is no trivial way to replace tabs with equivalent number of spaces... Let me explain a bit. Suppose we have a tab-width of 4 spaces. It means that if you have tab on the 1st (the leftmost) position, next position will be 5th (5=1+4). If there is space on the first position and tab on the 2nd, next position will be nevertheless 5th. IF there are two spaces on the 1st and 2nd positions and tab is on the 3rd, next position on right to the tab will still be 5th. It's the way tabs work. Guess, what will happen if you replace tabs with 4 spaces in those 3 cases.
If on the other hand you need to replace indenting spaces with tabs, it's a kind of trivial task you can achive with Optimal Fill option turned on. When you save the file, it will reindent all the lines with minimal number of spaces and tabs (will optimize the indent). |
My only tabs are indenting tabs and I want to go the other way (change tabs to spaces) so I think replacing each tab with 4 spaces would do it. I didn't know about Optimal Fill but I don't think it will work for changing tabs to spaces.
Actually, Polystyle is probably the smart way to go here.
Thanks,
Bob