From: Juanma Barranquero Date: Fri, 1 Feb 2008 11:25:16 +0000 (+0000) Subject: (global-whitespace-mode): When turning off the global mode, X-Git-Tag: emacs-pretest-23.0.90~8297 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1e2b96c2b8293359fca97b7842838032e8ad20f6;p=emacs.git (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 --git a/lisp/ChangeLog b/lisp/ChangeLog index 7e418a35721..b2a131b2b76 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,6 +1,9 @@ 2008-02-01 Juanma Barranquero * whitespace.el (global-whitespace-mode): Fix modeline lighter. + When turning off the global mode, turn off the local modes too + if whitespace is being unloaded. + (whitespace-unload-function): New function. 2008-02-01 Thien-Thi Nguyen diff --git a/lisp/whitespace.el b/lisp/whitespace.el index e3ce8a4dc27..4615e28b97f 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el @@ -931,7 +931,9 @@ Only useful with a windowing system." (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 @@ options are valid." ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(defun whitespace-unload-function () + "Unload the Whitespace library." + (global-whitespace-mode -1) + ;; continue standard unloading + nil) + (provide 'whitespace)