Subject: Suggested patch to whitespace.el

From: Jeremy Moore <[email-masked]>
Date: Thu, 16 May 2013 15:41:14 +0100

(whitespace-turn-on-if-enabled) gets called multiple times by hooks when a
file is opened. The value of font-lock-keywords is changed by the first
call, and subsequent calls record that value into
whitespace-font-lock-keywords. When GWM is disabled, the value restored to
font-lock-keywords still includes highlighting for white space characters.

How's this change?

*** whitespace.el.orig    Thu May 16 15:22:05 2013
--- whitespace.el    Thu May 16 15:22:59 2013
*************** resultant list will be returned."
*** 2176,2183 ****
    (add-hook 'write-file-functions 'whitespace-write-file-hook nil t)
    ;; create whitespace local buffer environment
    (set (make-local-variable 'whitespace-font-lock-mode) nil)
!   (set (make-local-variable 'whitespace-font-lock) nil)
!   (set (make-local-variable 'whitespace-font-lock-keywords) nil)
    (set (make-local-variable 'whitespace-display-table) nil)
    (set (make-local-variable 'whitespace-display-table-was-local) nil)
    (set (make-local-variable 'whitespace-active-style)
--- 2176,2184 ----
    (add-hook 'write-file-functions 'whitespace-write-file-hook nil t)
    ;; create whitespace local buffer environment
    (set (make-local-variable 'whitespace-font-lock-mode) nil)
!   (unless whitespace-font-lock
!     (set (make-local-variable 'whitespace-font-lock) nil)
!     (set (make-local-variable 'whitespace-font-lock-keywords) nil))
    (set (make-local-variable 'whitespace-display-table) nil)
    (set (make-local-variable 'whitespace-display-table-was-local) nil)
    (set (make-local-variable 'whitespace-active-style)

Regards,
Jeremy Moore