Fix over-eager whitespace-mode after switching major modes

Some major modes (like rust-mode) may trigger
doom-highlight-non-default-indentation-h twice, causing whitespace-style
to be set to its default global value, which (by default) enables
whitespace-mode with all its features. This may overwhelm the
unsuspecting user, so we instead only tack on our modifications to
whitespace-style to its existing buffer-local value, rather than its
global value.
This commit is contained in:
Henrik Lissner 2019-08-06 20:38:04 -04:00
parent 1dcbdc8dfb
commit b34a542ca0
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -141,9 +141,9 @@ read-only or not file-visiting."
(set (make-local-variable 'whitespace-style) (set (make-local-variable 'whitespace-style)
(let ((style (if indent-tabs-mode '(indentation) '(tabs tab-mark)))) (let ((style (if indent-tabs-mode '(indentation) '(tabs tab-mark))))
(if whitespace-mode (if whitespace-mode
(cl-union style (default-value 'whitespace-style)) (cl-union style whitespace-active-style)
`(face ,@style)))) style)))
(add-to-list 'whitespace-style 'face) (cl-pushnew 'face whitespace-style)
(whitespace-mode +1))) (whitespace-mode +1)))