(ispell-init-process): Include the used dictionary in ispell process
authorEli Zaretskii <eliz@gnu.org>
Fri, 13 Jan 2006 10:46:09 +0000 (10:46 +0000)
committerEli Zaretskii <eliz@gnu.org>
Fri, 13 Jan 2006 10:46:09 +0000 (10:46 +0000)
start message.
(ispell-internal-change-dictionary): When flyspell-mode is active and
dictionary is changed, make sure ispell process is restarted and
flyspell word cache cleared out for the current buffer.
(ispell-change-dictionary): Make sure flyspell word cache is cleared
out in all buffers with active flyspell mode when dictionary is globally
changed.  Call ispell-internal-change-dictionary after dictionary change.

lisp/ChangeLog
lisp/textmodes/ispell.el

index e540848..2abf498 100644 (file)
@@ -1,3 +1,15 @@
+2006-01-13  Agustin Martin  <agustin.martin@hispalinux.es>
+
+       * textmodes/ispell.el (ispell-init-process): Include the used
+       dictionary in ispell process start message.
+       (ispell-internal-change-dictionary): When flyspell-mode is active
+       and dictionary is changed, make sure ispell process is restarted
+       and flyspell word cache cleared out for the current buffer.
+       (ispell-change-dictionary): Make sure flyspell word cache is
+       cleared out in all buffers with active flyspell mode when
+       dictionary is globally changed.  Call
+       ispell-internal-change-dictionary after dictionary change.
+
 2006-01-13  Eli Zaretskii  <eliz@gnu.org>
 
        * emacs-lisp/bytecomp.el (batch-byte-recompile-directory): Doc fix.
index 42c7732..5f36918 100644 (file)
 ;;; Code:
 
 (defvar mail-yank-prefix)
+(eval-when-compile (defvar flyspell-word-cache-word))
 
 ;;; Custom.el macros require recompiling this when they are not present.
 ;;; Add in backward compatible custom support.
@@ -2504,7 +2505,8 @@ Keeps argument list for future ispell invocations for no async support."
       (setq ispell-filter nil ispell-filter-continue nil)
     ;; may need to restart to select new personal dictionary.
     (ispell-kill-ispell t)
-    (message "Starting new Ispell process...")
+    (message "Starting new Ispell process [%s] ..."
+            (or ispell-local-dictionary ispell-dictionary "default"))
     (sit-for 0)
     (setq ispell-library-directory (ispell-check-version)
          ispell-process-directory default-directory
@@ -2619,6 +2621,14 @@ By just answering RET you can find out what the current dictionary is."
               (setq ispell-local-dictionary dict)
               (setq ispell-local-dictionary-overridden t))
           (error "Undefined dictionary: %s" dict))
+        ;; For global setting clear out flyspell word cache when needed
+         (when (and arg
+                   (featurep 'flyspell))
+          (dolist (buf (buffer-list))
+            (with-current-buffer buf
+              (when flyspell-mode
+                (setq flyspell-word-cache-word nil)))))
+        (ispell-internal-change-dictionary)
         (message "%s Ispell dictionary set to %s"
                  (if arg "Global" "Local")
                  dict))))
@@ -2630,8 +2640,12 @@ a new one will be started when needed."
   (let ((dict (or ispell-local-dictionary ispell-dictionary)))
     (unless (equal ispell-current-dictionary dict)
       (ispell-kill-ispell t)
-      (setq ispell-current-dictionary dict))))
-
+      (setq ispell-current-dictionary dict)
+      ;; If needed, start ispell process and clear out flyspell word cache
+      (when (and (featurep 'flyspell)
+                 flyspell-mode)
+        (ispell-init-process)
+        (setq flyspell-word-cache-word nil)))))
 
 ;;; Spelling of comments are checked when ispell-check-comments is non-nil.