From: Stefan Monnier Date: Sun, 15 Jan 2006 05:46:20 +0000 (+0000) Subject: (flyspell-kill-ispell-hook): New fun. X-Git-Tag: emacs-pretest-22.0.90~4747 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ef0f5f7e622fa2e569228abc40f0f50eb5bb637f;p=emacs.git (flyspell-kill-ispell-hook): New fun. (flyspell-mode-on): Use it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 8850bc3ea97..4c009714ce4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,8 @@ 2006-01-15 Stefan Monnier + * textmodes/flyspell.el (flyspell-kill-ispell-hook): New fun. + (flyspell-mode-on): Use it. + * textmodes/ispell.el (ispell-kill-ispell): Run new hook ispell-kill-ispell-hook. diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el index 39d4b1f7b69..665d6c59fd7 100644 --- a/lisp/textmodes/flyspell.el +++ b/lisp/textmodes/flyspell.el @@ -525,6 +525,11 @@ in your .emacs file. (member (or ispell-local-dictionary ispell-dictionary) flyspell-dictionaries-that-consider-dash-as-word-delimiter))))) +(defun flyspell-kill-ispell-hook () + (setq flyspell-last-buffer nil) + (dolist (buf (buffer-list)) + (kill-local-variable 'flyspell-word-cache-word))) + ;;*---------------------------------------------------------------------*/ ;;* flyspell-mode-on ... */ ;;*---------------------------------------------------------------------*/ @@ -536,6 +541,8 @@ in your .emacs file. (or ispell-local-dictionary ispell-dictionary (if flyspell-default-dictionary (ispell-change-dictionary flyspell-default-dictionary))) + ;; Make sure we flush our caches when needed. + (add-hook 'ispell-kill-ispell-hook 'flyspell-kill-ispell-hook) ;; we have to force ispell to accept the local definition or ;; otherwise it could be too late, the local dictionary may ;; be forgotten!