Don't trigger whitespace-mode if already on

Normally doom|show-whitespace-maybe turns on whitespace-mode with a
subset of its features when indent-tabs-mode was different in that
buffer versus it's global default. e.g. If your default was spaces and
you opened a file with tabs.

This is to make it easier to notice whitespace style discrepancies.

However, it have side effects if whitespace-mode/global-whitespace-mode
was already on.
This commit is contained in:
Henrik Lissner 2018-06-06 19:23:27 +02:00
parent dda81f7b54
commit ef9d8fb2e8
No known key found for this signature in database
GPG Key ID: 5F6C0EA160557395

View File

@ -341,7 +341,9 @@ DEFAULT is non-nil, set the default mode-line for all buffers."
(defun doom|show-whitespace-maybe ()
"Show whitespace-mode when file has an `indent-tabs-mode' that is different
from the default."
(unless (or (eq indent-tabs-mode (default-value 'indent-tabs-mode))
(unless (or (bound-and-true-p global-whitespace-mode)
(bound-and-true-p whitespace-mode)
(eq indent-tabs-mode (default-value 'indent-tabs-mode))
(eq major-mode 'fundamental-mode)
(derived-mode-p 'special-mode))
(require 'whitespace)