Make trailing whitespace less distracting and optional

By using font-lock-comment-face, it's less distracting than the default
bright red, since comment face is designed to be subtle.

Also allow users to turn it off by adding an option
spacemacs-show-trailing-whitespace.
This commit is contained in:
Tu Do 2015-05-05 21:06:26 +07:00 committed by syl20bnr
parent db47cead53
commit 760fa0dbe4

View file

@ -121,7 +121,18 @@ It runs `tabulated-list-revert-hook', then calls `tabulated-list-print'."
;; because it avoids autoloads of elisp modes)
(setq initial-major-mode 'text-mode)
;; whitespace-mode
(add-hook 'prog-mode-hook (lambda () (setq show-trailing-whitespace 1)))
(defcustom spacemacs-show-trailing-whitespace t
"If t, show trailing whitespace."
:type 'boolean
:group 'spacemacs)
(add-hook 'prog-mode-hook (lambda ()
(when spacemacs-show-trailing-whitespace
(set-face-attribute 'trailing-whitespace nil
:background (face-attribute 'font-lock-comment-face
:foreground))
(setq show-trailing-whitespace 1))))
;; use only spaces and no tabs
(setq-default indent-tabs-mode nil