tags:

views:

150

answers:

2

I like Emacs to highlight tab characters using the trailing-whitespace face, which I set to be a slightly grayer version of my background color. That way, all whitespace that I consider unwanted (tab characters and trailing whitespace) will have a slightly gray background.

This is the code I use:

(add-hook 'font-lock-mode-hook
  '(lambda ()
     (font-lock-add-keywords
       nil
        '(("\t" 0 'trailing-whitespace prepend))
     )
   )
)

However, it seems to break list-colors-display: This function still lists all the colors, but they're monochrome. I don't get the dazzling spectrum of colors it's supposed to provide.

Why is this happening? Can it be fixed?

A: 

You could wrap your function so it doesn't do the whitespace thing in buffers that start/end in *'s. You probably don't want it in those types of buffers anyway:

(add-hook ...
  (unless (string-match "\\*.+\\*" (buffer-name))
    (font-lock-add-keywords ...)))
scottfrazer
That's a good workaround. If nobody posts an explanation for why the problem is actually happening, I'll accept this answer.
mike
+2  A: 

Unsure why the error. There is a mode available on the wiki that shows tabs (show-wspace.el) that works pretty well.

(require 'show-wspace)
(show-ws-toggle-show-tabs) ; default is no tabs shown, turn it on
;; the face used is 'show-ws-tab, which you can customize at will
Trey Jackson