Recently I have been faced with the desire to reformat some files I adopted for a contract.
Replace all tabs in an emacs buffer is easy. run
query-replace-regexp, then hit <TAB> (not ‘’) as the match, and
__, i.e. two (or 4 or 8 or whatever your standard is) spaces. Finally ‘!’ replaces all matches in the buffer.
M-x query-replace-regexp <TAB> !
Here’s a more interesting list of
regexp-replace goodness. Instead of replacing with strings you can run some elisp for every match!