diff options
| author | Juanma Barranquero | 2007-10-31 15:59:19 +0000 |
|---|---|---|
| committer | Juanma Barranquero | 2007-10-31 15:59:19 +0000 |
| commit | 6341c3fc0b4da35afa56b6c2008a4b56201ef9a9 (patch) | |
| tree | fffabe74d2c8f9b9f3b68ac5a70185b1e4d1c70f | |
| parent | f5d47fb2622a7503f90bfba3503d254af3da11b4 (diff) | |
| download | emacs-6341c3fc0b4da35afa56b6c2008a4b56201ef9a9.tar.gz emacs-6341c3fc0b4da35afa56b6c2008a4b56201ef9a9.zip | |
(whitespace-write-file-hook): Remove interactive spec.
(whitespace-unload-function): New-style unload function.
If run, stop old style `-hook' function from running.
| -rw-r--r-- | lisp/ChangeLog | 4 | ||||
| -rw-r--r-- | lisp/whitespace.el | 13 |
2 files changed, 16 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cf0e02ddfb4..2ab695c5bdd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,9 @@ | |||
| 1 | 2007-10-31 Juanma Barranquero <lekktu@gmail.com> | 1 | 2007-10-31 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 2 | ||
| 3 | * whitespace.el (whitespace-write-file-hook): Remove interactive spec. | ||
| 4 | (whitespace-unload-function): New-style unload function. | ||
| 5 | If run, stop old style `-hook' function from running. | ||
| 6 | |||
| 3 | * strokes.el (strokes-alphabetic-lessp): Doc fix. | 7 | * strokes.el (strokes-alphabetic-lessp): Doc fix. |
| 4 | 8 | ||
| 5 | 2007-10-31 Sean O'Rourke <sorourke@cs.ucsd.edu> | 9 | 2007-10-31 Sean O'Rourke <sorourke@cs.ucsd.edu> |
diff --git a/lisp/whitespace.el b/lisp/whitespace.el index 3ea8394b0b7..0251618f099 100644 --- a/lisp/whitespace.el +++ b/lisp/whitespace.el | |||
| @@ -782,7 +782,6 @@ When this mode is active, `whitespace-buffer' is added to | |||
| 782 | (defun whitespace-write-file-hook () | 782 | (defun whitespace-write-file-hook () |
| 783 | "Hook function to be called on the buffer when whitespace check is enabled. | 783 | "Hook function to be called on the buffer when whitespace check is enabled. |
| 784 | This is meant to be added buffer-locally to `write-file-functions'." | 784 | This is meant to be added buffer-locally to `write-file-functions'." |
| 785 | (interactive) | ||
| 786 | (let ((werr nil)) | 785 | (let ((werr nil)) |
| 787 | (if whitespace-auto-cleanup | 786 | (if whitespace-auto-cleanup |
| 788 | (whitespace-cleanup-internal) | 787 | (whitespace-cleanup-internal) |
| @@ -792,6 +791,18 @@ This is meant to be added buffer-locally to `write-file-functions'." | |||
| 792 | buffer-file-name)))) | 791 | buffer-file-name)))) |
| 793 | nil) | 792 | nil) |
| 794 | 793 | ||
| 794 | (defun whitespace-unload-function () | ||
| 795 | "Unload the whitespace library." | ||
| 796 | (whitespace-global-mode -1) | ||
| 797 | (save-current-buffer | ||
| 798 | (dolist (buf (buffer-list)) | ||
| 799 | (set-buffer buf) | ||
| 800 | (remove-hook 'write-file-functions 'whitespace-write-file-hook t))) | ||
| 801 | ;; new-style unloading, stop old style from running | ||
| 802 | (with-no-warnings (setq whitespace-unload-hook nil)) | ||
| 803 | ;; continue standard unloading | ||
| 804 | nil) | ||
| 805 | |||
| 795 | (defun whitespace-unload-hook () | 806 | (defun whitespace-unload-hook () |
| 796 | (remove-hook 'find-file-hook 'whitespace-buffer) | 807 | (remove-hook 'find-file-hook 'whitespace-buffer) |
| 797 | (remove-hook 'write-file-functions 'whitespace-write-file-hook t) | 808 | (remove-hook 'write-file-functions 'whitespace-write-file-hook t) |