Subject: Re: bug#19229: ispell on Windows

From: Eli Zaretskii <[email-masked]>
Date: Fri, 22 May 2015 09:53:10 +0300

> Date: Thu, 21 May 2015 21:19:19 +0100
> From: Alan Third <[email-masked]>
> Cc: [email-masked]
> 
> On 21 May 2015 at 17:23, Eli Zaretskii <[email-masked]> wrote:
> >> Date: Thu, 21 May 2015 09:16:00 +0100
> >> From: Alan Third <[email-masked]>
> >> Cc: [email-masked]
> >>
> >> This works in windows! Once this is done I can then use
> >> ispell-change-dictionary to change the dictionary to anything I want.
> >> Presumably, then, the problem I'm seeing is that ispell+hunspell falls
> >> over if the dictionary initially set by emacs doesn't exist.
> 
> OK, I was completely wrong here.

In what way?

> >> Is there a way to force ispell+hunspell to use a different dictionary
> >> from the start other than changing the LANG variable?
> >
> > There are several ways of doing that.
> >
> > First, you can customize the variable ispell-dictionary to name the
> > dictionary (without the .aff or .dic extensions, just the stem of the
> > basename, as in "en_GB").  You can set this in your ~/.emacs.  This
> > will cause ispell.el to invoke Hunspell with the appropriate -d
> > command-line option.
> 
> This doesn't work. I've done some digging in ispell.el and I think I
> know what's going on.
> 
> The function ispell-find-hunspell-dictionaries parses the output of
> `hunspell -D` looking for *hunspell's* default dictionary. If you
> don't have any of the variables you mentioned set then hunspell
> doesn't give a default.

What does your Hunspell say when you invoke it with -D?  Mine says
this:

  SEARCH PATH:
  .;;C:\Hunspell\;D:\usr\eli\.openoffice.org\3\user\wordbook;D:\usr\bin\..\share\hunspell;C:\Program files\OpenOffice.org 2.4\share\dict\ooo\;C:\Program files\OpenOffice.org 2.3\share\dict\ooo\;C:\Program files\OpenOffice.org 2.2\share\dict\ooo\;C:\Program files\OpenOffice.org 2.1\share\dict\ooo\;C:\Program files\OpenOffice.org 2.0\share\dict\ooo\
  AVAILABLE DICTIONARIES (path is not mandatory for -d option):
  D:\usr\bin\..\share\hunspell\american
  D:\usr\bin\..\share\hunspell\default
  D:\usr\bin\..\share\hunspell\de_AT
  D:\usr\bin\..\share\hunspell\de_CH
  D:\usr\bin\..\share\hunspell\de_DE
  D:\usr\bin\..\share\hunspell\de_DE_frami
  D:\usr\bin\..\share\hunspell\ENU
  D:\usr\bin\..\share\hunspell\en_GB
  D:\usr\bin\..\share\hunspell\en_MED
  D:\usr\bin\..\share\hunspell\en_US
  D:\usr\bin\..\share\hunspell\he_IL
  D:\usr\bin\..\share\hunspell\russian
  D:\usr\bin\..\share\hunspell\ru_RU
  D:\usr\bin\..\share\hunspell\sv_SE
  LOADED DICTIONARY:
  D:\usr\bin\..\share\hunspell\default.aff
  D:\usr\bin\..\share\hunspell\default.dic
  Hunspell 1.3.2

Note that the default dictionary it loaded, as announced near the end.

Once again, I ask where you got your Hunspell binary.  In the binary
distribution here:

  http://sourceforge.net/projects/ezwinports/files/hunspell-1.3.2-3-w32-bin.zip/download

which is what I use, there's the "default" dictionary, in the form of
2 files: default.dic and default.aff.  Do you have them in your
share/hunspell/ directory?  If not, just copy your "usual" dictionary
files into those names (or toss your Hunspell installation and use
mine instead ;-).

> Specifically, it looks for a line that ends ".aff" then uses that line
> in an argument for ispell-parse-hunspell-affix-file, which fails if
> it's nil, which in my case it is. Because that function errors,
> ispell-find-hunspell-dictionaries stops processing and therefore never
> builds ispell-hunspell-dictionary-alist, which seems to be a pretty
> vital variable.
> 
> While that doesn't seem like very good behaviour to me, I don't know
> if you'd classify it as a bug.

I see no bug here.  It works for me.  I think your Hunspell
installation is misconfigured, that's all.