diff lisp/whitespace.el @ 91085:880960b70474

Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-283
author Miles Bader <miles@gnu.org>
date Sun, 11 Nov 2007 00:56:44 +0000
parents 14c4a6aac623 d3e87ee5aa0e
children 2fcaae6177a5
line wrap: on
line diff
--- a/lisp/whitespace.el	Fri Nov 09 14:52:32 2007 +0000
+++ b/lisp/whitespace.el	Sun Nov 11 00:56:44 2007 +0000
@@ -784,7 +784,6 @@
 (defun whitespace-write-file-hook ()
   "Hook function to be called on the buffer when whitespace check is enabled.
 This is meant to be added buffer-locally to `write-file-functions'."
-  (interactive)
   (let ((werr nil))
     (if whitespace-auto-cleanup
 	(whitespace-cleanup-internal)
@@ -794,6 +793,21 @@
 		       buffer-file-name))))
   nil)
 
+(defun whitespace-unload-function ()
+  "Unload the whitespace library."
+  (if (unintern "whitespace-unload-hook")
+      ;; if whitespace-unload-hook is defined, let's get rid of it
+      ;; and recursively call `unload-feature'
+      (progn (unload-feature 'whitespace) t)
+    ;; this only happens in the recursive call
+    (whitespace-global-mode -1)
+    (save-current-buffer
+      (dolist (buf (buffer-list))
+	(set-buffer buf)
+	(remove-hook 'write-file-functions 'whitespace-write-file-hook t)))
+    ;; continue standard unloading
+    nil))
+
 (defun whitespace-unload-hook ()
   (remove-hook 'find-file-hook 'whitespace-buffer)
   (remove-hook 'write-file-functions 'whitespace-write-file-hook t)