changeset 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 bb2dfb332355
children 979bd3539a58
files lisp/ChangeLog lisp/textmodes/flyspell.el
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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  <monnier@iro.umontreal.ca>
 
+	* 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.
 
--- 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!