[Libvir] removing trailing blanks (and keeping them away)

Jim Meyering jim at meyering.net
Mon Feb 4 18:50:31 UTC 2008


"Daniel P. Berrange" <berrange at 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.")
  ...




More information about the libvir-list mailing list