Created
July 4, 2012 17:57
-
-
Save magnars/3048595 to your computer and use it in GitHub Desktop.
cleanup-buffer.el
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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)) | |
(defun cleanup-buffer () | |
"Perform a bunch of operations on the whitespace content of a buffer. | |
Including indent-buffer, which should not be called automatically on save." | |
(interactive) | |
(cleanup-buffer-safe) | |
(indent-buffer)) | |
(global-set-key (kbd "C-c n") 'cleanup-buffer) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment