diff lisp/textmodes/flyspell.el @ 68196:9b4c8f5efab7

(flyspell-kill-ispell-hook): New fun. (flyspell-mode-on): Use it.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Sun, 15 Jan 2006 05:46:20 +0000
parents 5770fac9a117
children 979bd3539a58
line wrap: on
line diff
--- 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!