diff options
author | Kyle Meyer <meyerkya@gmail.com> | 2013-01-02 21:26:25 -0500 |
---|---|---|
committer | Kyle Meyer <meyerkya@gmail.com> | 2013-01-02 21:26:47 -0500 |
commit | 855cf4357c91cde0f5779415ef02896adc9b1a24 (patch) | |
tree | 7a96c13315b0fe523e83b6f1275ae692695edd2e | |
parent | c469aa5130b1c33ef5416cef1bb74f83e2caaf9c (diff) | |
download | emacs.d-855cf4357c91cde0f5779415ef02896adc9b1a24.tar.gz |
buffer cleanup save hook
-rw-r--r-- | conf/em.el | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -27,8 +27,8 @@ ;; make whitespace-mode use just basic coloring ;; http://ergoemacs.org/emacs/whitespace-mode.html (setq whitespace-style (quote - (spaces tabs newline space-mark - tab-mark newline-mark))) + (spaces tabs newline space-mark + tab-mark newline-mark))) ;; y or n (defalias 'yes-or-no-p 'y-or-n-p) @@ -96,3 +96,11 @@ ;; tramp (require 'tramp) (setq tramp-default-method "ssh") + +;; whitespace cleanup +(defun cleanup-buffer () + (interactive) + (untabify (point-min) (point-max)) + (delete-trailing-whitespace) + (set-buffer-file-coding-system 'utf-8)) +(add-hook 'before-save-hook 'cleanup-buffer) |