I use this function almost daily. Why? Well, it’s because too many developers use editors that muck the alignment of the source.
1 2 3 4 5 6 | (defun iwb () "indent whole buffer" (interactive) (delete-trailing-whitespace) (indent-region (point-min) (point-max) nil) (untabify (point-min) (point-max))) |
Open a file, M-x iwb, save, commit, and edit happily.
I can’t take credit for it, but it seems like it should be passed along. I think I originally copied it from another co-worker’s .emacs file when I started using emacs.
1 response so far ↓
that’s cool.
i’ve tried to write one,but with no luck.
and here you iwb() is.
thanks~
Leave a Comment