Emacs Spell-Checking (Hunspell) in Windows

Last Updated: Apr 14, 2025

Most GNU/Linux distributions ship with a Western-language spell checker like Ispell out of the box. Of course, Windows doesn’t make such a convenient tool easy to install.

I use Ispell for English spell-checks in Emacs, but getting the same thing working on Windows was not so easy, so I’m writing it down.

First, it seems that on Windows Hunspell is more popular (or maybe easier to install). I thought there could be no big difference between them so I chose to go with Hunspell.

Procedures

Open PowerShell as administrator and run the following, one at a time:

Set-ExecutionPolicy Bypass 
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString(’http://internal/odata/repo/ChocolateyInstall.ps1’))

Next, install Hunspell via choco.

choco install hunspell.portable

Then download the English (or whichever language you want) dictionary from LibreOffice Extensions. The downloaded file is an oxt, but it’s basically a ZIP, so extract it one way or another. Place the relevant dictionary files (.aff and .dic) into a directory that is on Hunspell’s search path. You can find Hunspell’s path by running

hunspell -D

Then run

hunspell -D -d en_US NUL

to install the dictionary. Replace en_US with whichever language you want to install.

That’s the setup done. Now just tweak your .emacs and you should be good. If you installed Hunspell via choco, it’s added to PATH automatically; otherwise, either add it to PATH manually or put the full path on the third line.

(setenv "LANG" "en_US") 
(setenv "DICTIONARY" "en_US") 
(setq-default ispell-program-name "hunspell.exe")

This might just work, but on newer versions of Emacs it sometimes doesn’t, for some reason. The error looks like this:

ispell-phaf: No matching entry for en_US in ‘ispell-hunspell-dict-paths-alist’.

According to this page, the fix is to patch ispell.el.

At the moment that’s line 1127:

- (affix-file (concat dict ".aff"))) 
+ (affix-file (concat (file-name-sans-extension dict) ".aff")))

Apply the patch, then finally run M-x byte-compile-file path/to/ispell.el, and it should work.