emacs - Auto delete trailing whitespace and empty lines at begin or end of buffer

This commit is contained in:
madmaurice 2017-10-17 12:45:13 +02:00
parent f567040a7a
commit 540b0ed4f5

View file

@ -141,6 +141,14 @@
(tool-bar-mode -1))
(menu-bar-mode -1)
;; Buffer cleanup
(defun buffer-cleanup-whitespace ()
"Remove trailing whitespaces upon save"
(let ((whitespace-style '(empty trailing)))
(whitespace-cleanup)))
(add-hook 'before-save-hook 'buffer-cleanup-whitespace)
(setq-default show-trailing-whitespace t)
;; ensure repo cache is up1date
(or (file-exists-p package-user-dir)
(package-refresh-contents))
@ -172,8 +180,6 @@
;; No tabs - tabs are evil
(setq indent-tabs-mode nil)
;; No trailing whitespaces - those are even evileler
(setq show-trailing-whitespace t)
(use-package delight
:ensure t