emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

aspell dictionaries not initialized properly


From: Reiner Steib
Subject: aspell dictionaries not initialized properly
Date: Thu, 18 Jan 2007 23:07:23 +0100
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.92 (gnu/linux)

Hi,

when `ispell-change-dictionary' is called interactively,
`ispell-valid-dictionary-list' initializes `ispell-dictionary-alist'
through `ispell-maybe-find-aspell-dictionaries' (which calls
`ispell-find-aspell-dictionaries').  But if the first call of
`ispell-change-dictionary' is non-interactively, aspell's dictionaries
are not added correctly so `ispell-change-dictionary' errors out with
"Undefined dictionary" (see IELM session below).  The patch[1] below
seems to solve the problem, but I'm not sure it the right thing to do.

Here's a sample Emacs session starting from "emacs -Q -f ielm" shows
the problem:

,----
| ELISP> (featurep 'ispell)
| nil
| ELISP> (require 'ispell)
| ispell
| ELISP> ispell-program-name
| "/usr/bin/aspell"
| ELISP> ispell-local-dictionary
| nil
| ELISP> (with-temp-buffer
|        (call-process ispell-program-name nil t nil "dicts")
|        (buffer-string))
| "en\nen-variant_0\nen-variant_1\nen-variant_2\n[...]"
| ELISP> (mapcar 'car ispell-local-dictionary-alist)
| nil
| ELISP> (mapcar 'car ispell-dictionary-alist)
| (nil "american" "brasileiro" "british" "castellano" [... no "en" etc. ...])
| 
| ELISP> (ispell-change-dictionary "en")
| *** Eval error ***  Undefined dictionary: en
| ELISP> (message "With patch [1]")
| "With patch [1]"
| ELISP> (ispell-change-dictionary "en")
| "Local Ispell dictionary set to en"
| ELISP> 
`----

[1]
--8<---------------cut here---------------start------------->8---
*** ispell.el   18 Jan 2007 12:27:56 +0100      1.204
--- ispell.el   18 Jan 2007 22:51:25 +0100      
***************
*** 2607,2612 ****
--- 2607,2616 ----
               (mapcar 'list (ispell-valid-dictionary-list)))
          nil t)
         current-prefix-arg))
+   (unless (called-interactively-p)
+     ;; If interactive, `ispell-valid-dictionary-list' has already set up
+     ;; aspell ditionaries.
+     (ispell-maybe-find-aspell-dictionaries))
    (unless arg (ispell-buffer-local-dict 'no-reload))
    (if (equal dict "default") (setq dict nil))
    ;; This relies on completing-read's bug of returning "" for no match
--8<---------------cut here---------------end--------------->8---

Bye, Reiner.
-- 
       ,,,
      (o o)
---ooO-(_)-Ooo---  |  PGP key available  |  http://rsteib.home.pages.de/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]