diff --git a/core/core-ui.el b/core/core-ui.el index c5cd5427e..ece7a3a77 100644 --- a/core/core-ui.el +++ b/core/core-ui.el @@ -133,8 +133,9 @@ An omitted font size means to inherit `doom-font''s size.") (defun doom-highlight-non-default-indentation-h () "Highlight whitespace at odds with `indent-tabs-mode'. -That is, highlight tabs if the usual indentation is with spaces, and highlight -spaces at the beginnings of lines if the usual indentation is with tabs. +That is, highlight tabs if `indent-tabs-mode' is `nil', and highlight spaces at +the beginnings of lines if `indent-tabs-mode' is `t'. The purpose is to make +incorrect indentation in the current buffer obvious to you. Does nothing if `whitespace-mode' or `global-whitespace-mode' is already active or if the current buffer is read-only or not file-visiting." @@ -143,11 +144,12 @@ or if the current buffer is read-only or not file-visiting." (null buffer-file-name)) (require 'whitespace) (set (make-local-variable 'whitespace-style) - (let ((style (if indent-tabs-mode '(indentation) '(tabs tab-mark)))) - (if whitespace-mode - (cl-union style whitespace-active-style) - style))) - (cl-pushnew 'face whitespace-style) + (cl-union (if indent-tabs-mode + '(indentation) + '(tabs tab-mark)) + (when whitespace-mode + (remq 'face whitespace-active-style)))) + (cl-pushnew 'face whitespace-style) ; must be first (whitespace-mode +1)))