Configuring Hunspell in Emacs on Windows

First off we must install Hunspell on the machine and expose it via exec-path:

  winget install hunspell

After restarting powershell this is handy for getting the exec path:

Get-Command hunspell | select -ExpandProperty Source | Split-Path | clip

Insert into exec-path and verify that it works via (executable-find "hunspell")

Getting dictionaries

We can find out where hunspell looks for dictionaries via:

> hunspell -D
  SEARCH PATH:
.;;C:\Hunspell\;%USERPROFILE%\Application Data\OpenOffice.org 2\user\wordbook;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):

Just pick one of these search paths and place dictionaries there. They can be downloaded from elastic, you need the .add and .dic files for each.

One small trick

Now in emacs issue ispell-change-dictionary to select the language you want. This is where I normally get stuck teasing out the right names of dictionaries. The trick is that everything will work out of the box, if you rename your downloaded dictionary files to whatever is already in ispell-dictionary-alist.

For example, when I issue ispell-change-dictionary, I can choose between american, english or dansk, but the dictionaries I downloaded are called en_US, en_GB and da.

So, just rename the files en_US.aff -> american.aff, en_US.dic -> american.dic, da.aff -> dansk.aff etc. etc. This seems a much simpler workaround than trying to fix up the elisp dictionaries, which is where I normally mess around for a while when trying to follow the thread on emacs stackexchange.

Hope this helps.