Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

cleanup-buffer.el

View gist:3048595
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
(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
Something went wrong with that request. Please try again.