Mixing whitespace
The following emacs lisp code visually marks all initial whitespace that mixes both tabs and spaces on the same line:
;; Highlight dangerous whitespace mixing
(defface invalid-whitespace-face
‘((t (:background “red”)))
“Used in programming modes for marking mixed tabs
and spaces.”)
(mapcar (lambda (mode)
(font-lock-add-keywords
mode
‘((“^\(t+ \| +t\)\s-*” 0 ‘invalid-whitespace-face))))
‘(c-mode python-mode …))
Just add a list of modes for which you want to activate this warning.
Discussion Area - Leave a Comment