summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <meyerkya@gmail.com>2013-01-02 21:26:25 -0500
committerKyle Meyer <meyerkya@gmail.com>2013-01-02 21:26:47 -0500
commit855cf4357c91cde0f5779415ef02896adc9b1a24 (patch)
tree7a96c13315b0fe523e83b6f1275ae692695edd2e
parentc469aa5130b1c33ef5416cef1bb74f83e2caaf9c (diff)
downloademacs.d-855cf4357c91cde0f5779415ef02896adc9b1a24.tar.gz
buffer cleanup save hook
-rw-r--r--conf/em.el12
1 files changed, 10 insertions, 2 deletions
diff --git a/conf/em.el b/conf/em.el
index 12a9083..6441ce0 100644
--- a/conf/em.el
+++ b/conf/em.el
@@ -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)