Refactor doom-highlight-non-default-indentation-h
And revise its docstring.
This commit is contained in:
parent
1406a45750
commit
e2855db2a6
1 changed files with 9 additions and 7 deletions
|
@ -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)))
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue