In Emacs, intelligently call whitespace-cleanup on save