"Daniel P. Berrange" <berrange(a)redhat.com> wrote:
(require 'show-wspace)
(add-hook 'font-lock-mode-hook 'highlight-trailing-whitespace)
Which does the trick for me
I've found it useful to highlight space-before-TAB
and blank-lines-at-EOB, too.
(when window-system
;;; Create faces for highlighting white space.
(copy-face 'underline 'ws-space-face)
(set-face-foreground 'ws-space-face "red")
(copy-face 'underline 'ws-unbreakable-space-face)
(set-face-foreground 'ws-unbreakable-space-face "grey")
;;; Things to highlight in nearly every mode.
(defvar always-font-lock-keywords
'(("\\<\\(FIXME\\|XXX\\)[-!:]?\\>" 1 font-lock-warning-face t)
("\240" 0 'ws-unbreakable-space-face t)
("[ \t]+$" 0 'ws-space-face t) ; trailing white space
("\\( +\\)\t" 1 'ws-space-face t) ; spaces before a TAB
("\n\\(\n+\\)\\'" 1 'ws-space-face t)) ; blank lines at end of
buffer
"expressions to highlight in every font-lock enabled mode.")
...