changeset 65670:dac12c967d98

(ispell-maybe-find-aspell-dictionaries): New function, code extracted from ispell-valid-dictionary-list. (ispell-valid-dictionary-list, ispell-accept-buffer-local-defs): Call it.
author Eli Zaretskii <eliz@gnu.org>
date Sat, 24 Sep 2005 10:45:11 +0000
parents cd937da92e58
children 09c8aeb9e280
files lisp/textmodes/ispell.el
diffstat 1 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/textmodes/ispell.el	Sat Sep 24 10:41:18 2005 +0000
+++ b/lisp/textmodes/ispell.el	Sat Sep 24 10:45:11 2005 +0000
@@ -880,6 +880,16 @@
 (defvar ispell-have-aspell-dictionaries nil
   "Non-nil if we have queried Aspell for dictionaries at least once.")
 
+(defun ispell-maybe-find-aspell-dictionaries ()
+  "Find Aspell's dictionaries, unless already done."
+  (when (and (not ispell-have-aspell-dictionaries)
+	     (condition-case ()
+		 (progn (ispell-check-version) t)
+	       (error nil))
+	     ispell-really-aspell
+	     ispell-aspell-supports-utf8)
+    (ispell-find-aspell-dictionaries)))
+
 (defun ispell-find-aspell-dictionaries ()
   "Find Aspell's dictionaries, and record in `ispell-dictionary-alist'."
   (interactive)
@@ -976,13 +986,7 @@
   "Returns a list of valid dictionaries.
 The variable `ispell-library-directory' defines the library location."
   ;; If Ispell is really Aspell, query it for the dictionary list.
-  (when (and (not ispell-have-aspell-dictionaries)
-	     (condition-case ()
-		 (progn (ispell-check-version) t)
-	       (error nil))
-	     ispell-really-aspell
-	     ispell-aspell-supports-utf8)
-    (ispell-find-aspell-dictionaries))
+  (ispell-maybe-find-aspell-dictionaries)
   (let ((dicts (append ispell-local-dictionary-alist ispell-dictionary-alist))
 	(dict-list (cons "default" nil))
 	name load-dict)
@@ -3573,6 +3577,7 @@
 
 (defun ispell-accept-buffer-local-defs ()
   "Load all buffer-local information, restarting Ispell when necessary."
+  (ispell-maybe-find-aspell-dictionaries)
   (ispell-buffer-local-dict)		; May kill ispell-process.
   (ispell-buffer-local-words)		; Will initialize ispell-process.
   (ispell-buffer-local-parsing))