# HG changeset patch # User Stefan Monnier # Date 1137303980 0 # Node ID 9b4c8f5efab7aca9b96024aae0037639d46c3441 # Parent bb2dfb3323552041a0ca68c86f74ce004f25b61b (flyspell-kill-ispell-hook): New fun. (flyspell-mode-on): Use it. diff -r bb2dfb332355 -r 9b4c8f5efab7 lisp/ChangeLog --- a/lisp/ChangeLog Sun Jan 15 05:42:35 2006 +0000 +++ b/lisp/ChangeLog Sun Jan 15 05:46:20 2006 +0000 @@ -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 -r bb2dfb332355 -r 9b4c8f5efab7 lisp/textmodes/flyspell.el --- a/lisp/textmodes/flyspell.el Sun Jan 15 05:42:35 2006 +0000 +++ b/lisp/textmodes/flyspell.el Sun Jan 15 05:46:20 2006 +0000 @@ -525,6 +525,11 @@ (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 @@ (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!