summaryrefslogtreecommitdiff
path: root/lisp/whitespace.el
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2007-11-09 09:45:30 +0000
committerMiles Bader <miles@gnu.org>2007-11-09 09:45:30 +0000
commitc12ecb0af9679cc0e2fa0409931c34c035763469 (patch)
treebd118c7ebc571de0dab542f48ad0c1648c6ccf72 /lisp/whitespace.el
parente83d1fe87564d06d2fcbb4006dfd9133bc340aa8 (diff)
parent9d2185d10e3da9062672d96d3b59fcea31ff17ed (diff)
downloademacs-c12ecb0af9679cc0e2fa0409931c34c035763469.tar.gz
Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-923
Diffstat (limited to 'lisp/whitespace.el')
-rw-r--r--lisp/whitespace.el16
1 files changed, 15 insertions, 1 deletions
diff --git a/lisp/whitespace.el b/lisp/whitespace.el
index 6e6aeb5fbb7..f6c94534a00 100644
--- a/lisp/whitespace.el
+++ b/lisp/whitespace.el
@@ -784,7 +784,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)
@@ -794,6 +793,21 @@ This is meant to be added buffer-locally to `write-file-functions'."
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)