From 855cf4357c91cde0f5779415ef02896adc9b1a24 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Wed, 2 Jan 2013 21:26:25 -0500 Subject: buffer cleanup save hook --- conf/em.el | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'conf') 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) -- cgit v1.2.3