It's easy to implement, but I'm still surprised Emacs doesn't ship with an indent-buffer command. I use it often.