]> git.eshelyaron.com Git - emacs.git/commitdiff
(whitespace-write-file-hook): Remove interactive spec.
authorJuanma Barranquero <lekktu@gmail.com>
Wed, 31 Oct 2007 15:59:19 +0000 (15:59 +0000)
committerJuanma Barranquero <lekktu@gmail.com>
Wed, 31 Oct 2007 15:59:19 +0000 (15:59 +0000)
(whitespace-unload-function): New-style unload function.
If run, stop old style `-hook' function from running.

lisp/ChangeLog
lisp/whitespace.el

index cf0e02ddfb4136ed7471e42ea2e8c73736162858..2ab695c5bdde559cbf92e95568cf98da1a315719 100644 (file)
@@ -1,5 +1,9 @@
 2007-10-31  Juanma Barranquero  <lekktu@gmail.com>
 
+       * whitespace.el (whitespace-write-file-hook): Remove interactive spec.
+       (whitespace-unload-function): New-style unload function.
+       If run, stop old style `-hook' function from running.
+
        * strokes.el (strokes-alphabetic-lessp): Doc fix.
 
 2007-10-31  Sean O'Rourke  <sorourke@cs.ucsd.edu>
index 3ea8394b0b79681d6db2073ac8bc75898dc3f274..0251618f0996f3aee55c09ddb9195b557311cc77 100644 (file)
@@ -782,7 +782,6 @@ When this mode is active, `whitespace-buffer' is added to
 (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)
@@ -792,6 +791,18 @@ This is meant to be added buffer-locally to `write-file-functions'."
                       buffer-file-name))))
   nil)
 
+(defun whitespace-unload-function ()
+  "Unload the whitespace library."
+  (whitespace-global-mode -1)
+  (save-current-buffer
+    (dolist (buf (buffer-list))
+      (set-buffer buf)
+      (remove-hook 'write-file-functions 'whitespace-write-file-hook t)))
+  ;; new-style unloading, stop old style from running
+  (with-no-warnings (setq whitespace-unload-hook nil))
+  ;; 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)