Spell checking in Emacs is one of those things that should just work but requires a bit of setup to get right, especially if you want a specific dictionary like Canadian English. This post walks through getting hunspell running in Doom Emacs with the keybindings you need to actually use it.
Installing Hunspell
Doom's spell module supports both aspell and hunspell. After looking around it seemed like hunspell had better dictionary support for non-US English variants, so it was my choice for Canadian spell checking.
Hunspell is available for Ubuntu, Fedora, and macOS via Hombrew. I'm on NixOS so I'd add the two packages I need and then run sudo nixos-rebuild switch to get them installed.
environment.systemPackages = with pkgs; [
hunspell
hunspellDicts.en-ca
];
Enabling the Spell Module
Open ~/.config/doom/init.el and find the :checkers section. Enable the spell module with the +flyspell flag:
:checkers
syntax
(spell +flyspell)
The +flyspell flag uses Emacs' built-in flyspell, which works reliably with hunspell. I didn't use the +hunspell flag because after some looking around I'd need to generate a list of words.
Run doom sync and restart Emacs after changing init.el.
Configuring the Dictionary
In ~/.config/doom/config.el, tell Emacs to use hunspell and set your dictionary:
(setq ispell-program-name "hunspell"
ispell-dictionary "en_CA")
Swap en_CA for en_GB, en_AU, etc. if you need a different variant. The dictionary name needs to match what hunspell has installed — you can check with hunspell -D in a terminal to see available dictionaries.
Reload your config with SPC h r r.
Turning Spell Checking On
Flyspell doesn't run automatically everywhere — Doom enables it in text and org buffers by default, but you can toggle it manually with:
| Key | Action |
|---|---|
SPC t s |
Toggle flyspell in the current buffer |
When active, misspelled words are underlined.
Navigating and Fixing Mistakes
Once flyspell is running, these are the keybindings you'll use most:
| Key | Action |
|---|---|
] s |
Jump to next misspelling |
[ s |
Jump to previous misspelling |
z = |
Show correction suggestions for word at point |
SPC z = |
Same, works in more contexts |
When you press z =, a list of suggestions pops up numbered. Press the corresponding number to accept a correction.
You can also right-click a highlighted word to get suggestions if you prefer the mouse.
Adding Words to the Dictionary
If flyspell flags something that's correct like a name, a technical term, or an acronym you have a couple of options:
| Key | Action |
|---|---|
z g |
Accept word and add it to your personal dictionary |
z w |
Mark word as incorrect (force flag it) |
Words added with z g go into ~/.aspell.en_CA.pws (or equivalent for your dictionary) and won't be flagged again.
Changing Dictionaries on the Fly
If you switch between languages in different files, you can change the active dictionary without touching your config:
M-x ispell-change-dictionary
Type the dictionary name (e.g. en_GB) and flyspell will re-check using that dictionary for the current session.