baohaojun/skeleton-complete — pull request #3 by Fuco1 (2013-04-19 14:52:17+00:00)
Title: Fix whitespace

Whitespace fix.

I recommend adding this somewhere in your config. It will automatically detabify and remove the trailing whitespace. It's very handy when working on open-source projects since it fixes trivial merge conflicts where someone adds a space or tab somewhere.

(add-hook 'before-save-hook 'cleanup-buffer-safe)
(defun cleanup-buffer-safe ()
"Perform a bunch of safe operations on the whitespace content of a buffer.
Does not indent buffer, because it is used for a before-save-hook, and that
might be bad."
(interactive)
(untabify-buffer)
(delete-trailing-whitespace)
(set-buffer-file-coding-system 'utf-8))