Emacs is hard to use and even harder to learn how to use. Here is what I (finally) had to do to make emacs spell-checking work on OS X with:
- Hunspell; and
- an Australian English Dictionary.
It’s pretty easy once you know what to do:
Install hunspell.
brew install hunspell
Download and install the dictionary files:
mkdir -p "$HOME/Library/Spelling" wget 'https://downloads.sourceforge.net/project/aoo-extensions/1232/7/dict-en-au-2008-12-15.oxt' unzip dict-en-au-2008-12-15.oxt *.aff *.dic -d ~/Library/Spelling
Edit your
~/.emacs
file to add the following (or something morally equivalent):;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell. (setenv"DICPATH" "HOME") "/Library/Spelling")) (concat (getenv ;; Tell ispell-mode to use hunspell. (setq ispell-program-name"/usr/local/bin/hunspell")
You’ll probably need to add something else to make spell-checking actually happen. I add
flyspell-mode
to the hooks for the major modes I use to edit things that need spell-checking: Haskell source and Markdown text files. You can see examples of this in my.emacs
file.
Now try to edit something using emacs. Type some gibberish to make sure it works and try some dictionary specific words to make sure it’s using the right dictionary (I use “colour” to make sure it’s not using an en_US dictionary).
As a side note, the only reason I went on this saga is because
hunspell can’t find dictionaries installed in ~/Library/Spelling
unless you happen to started it from your $HOME
directory:
$ pwd
/tmp
$ hunspell -D
SEARCH PATH:
....:Library/Spelling:....
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
Can't open affix or dictionary files for dictionary named "en_AU".
The ....
ellipsis is where I’ve omitted quite a few relative and
absolute paths but most of them are paths that some versions of Open
Office got installed to by some installers at some point in time. It
looks like hunspell attempts prefix these paths with $HOME
but
it doesn’t seem to work for some reason ($HOME
is defined and
non-empty).
If only autoconf 2.69 and automake 1.15 were able to prepare the hunspell source tree to building I’d take a close look at this C/C++ string munging and submit a pull request. (It’s 2017! Surely we can ship release tarballs with a configure script?)
Alas.