mirror of
https://github.com/doomemacs/doomemacs
synced 2025-08-01 12:17:25 -05:00
refactor: move doom-highlight-non-default-indentation-h out of core
This functionality falls under the umbrella of "better defaults" rather than essential defaults, and so belongs in :config default. Whats more, the naming convention (+emacs-...) was intentional, because this function (and the :config default module) will be moved to :doom emacs in the near future. This also indirectly fixes #8373. Fix: #8373
This commit is contained in:
@ -83,6 +83,31 @@
|
||||
(setq tramp-default-method "ssh")) ; faster than the default scp
|
||||
|
||||
|
||||
;;;###package whitespace
|
||||
(add-hook! 'after-change-major-mode-hook :append
|
||||
(defun +emacs-highlight-non-default-indentation-h ()
|
||||
"Highlight whitespace at odds with `indent-tabs-mode'.
|
||||
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."
|
||||
(unless (or (eq major-mode 'fundamental-mode)
|
||||
(bound-and-true-p global-whitespace-mode)
|
||||
(null buffer-file-name)
|
||||
buffer-read-only)
|
||||
(require 'whitespace)
|
||||
(set (make-local-variable '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))))
|
||||
|
||||
|
||||
;;
|
||||
;;; Smartparens config
|
||||
|
||||
|
Reference in New Issue
Block a user