From 760fa0dbe4e9044103361d3e96054f4d2e866c06 Mon Sep 17 00:00:00 2001 From: Tu Do Date: Tue, 5 May 2015 21:06:26 +0700 Subject: [PATCH] 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. --- spacemacs/config.el | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/spacemacs/config.el b/spacemacs/config.el index 549e68c9c..2079484ca 100644 --- a/spacemacs/config.el +++ b/spacemacs/config.el @@ -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