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>
(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)
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)