# HG changeset patch # User Juanma Barranquero # Date 1201865002 0 # Node ID becc5f138486744b9a12b980676b3c2365da496b # Parent cdc2587a20828d3e5031421665e102e953665406 (global-whitespace-mode): When turning off the global mode, turn off the local modes too if whitespace is being unloaded. (whitespace-unload-function): New function. diff -r cdc2587a2082 -r becc5f138486 lisp/whitespace.el --- a/lisp/whitespace.el Fri Feb 01 10:25:35 2008 +0000 +++ b/lisp/whitespace.el Fri Feb 01 11:23:22 2008 +0000 @@ -931,7 +931,9 @@ (remove-hook 'find-file-hooks 'whitespace-turn-on-if-enabled)) (dolist (buffer (buffer-list)) ; adjust all local mode (set-buffer buffer) - (unless whitespace-mode + (when (or (not whitespace-mode) + ;; whitespace is being unloaded + (bound-and-true-p unload-function-defs-list)) (whitespace-turn-off))))))) @@ -1757,6 +1759,12 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun whitespace-unload-function () + "Unload the Whitespace library." + (global-whitespace-mode -1) + ;; continue standard unloading + nil) + (provide 'whitespace)