changeset 88115:becc5f138486

(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.
author Juanma Barranquero <lekktu@gmail.com>
date Fri, 01 Feb 2008 11:23:22 +0000
parents cdc2587a2082
children f7fe8f8f3937
files lisp/whitespace.el
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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)