Navigation

home code debian images resume weblog wiki

Older news:

Dec 11, 2006:

Debian GNU/Linux

About lychnis.net
Jul 7, 2005:
Wanneer gebruik je -d en wanneer gebruik je -t?
Feb 18, 2005:
Mixing whitespace
Jan 10, 2005:
The difference between dogs and cats
Dec 22, 2004:
Sunrise in winter
Dec 12, 2004:
New site layout

Browse:


Mixing whitespace/programming

Posted on 2005-02-18 by ivo :: /programming :: link

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.