How do I set up Hunspell so that I can add new UTF-8 words (e.g. "Rúdi") to my user local dictionary?
I have a function that allows me to add new words to my local dictionary. It works for adding new words that don't contain UTF-8 characters. But if a word contains a UTF-8 character, Flyspell doesn't remember that the newly added word is correctly spelled.
Here's my setup:
(executable-find "hunspell")
(setq-default ispell-program-name "hunspell")
(setq ispell-really-hunspell t)
(setq flyspell-default-dictionary "en_US")
(setq ispell-dictionary "en_US")
(setq ispell-program-name "/usr/local/bin/hunspell")
(setenv "DICTIONARY" "en_US")
(setq ispell-program-name "hunspell")
(eval-after-load "ispell"
'(progn (defun ispell-get-coding-system () 'utf-8)))
(setq ispell-local-dictionary-alist '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)))
(setq ispell-extra-args '("-d en_US"))
(flyspell-mode-on)
(defun add-word-to-personal-dictionary ()
(interactive)
(let ((current-location (point))
(word (flyspell-get-word)))
(when (consp word)
(flyspell-do-correct 'save nil (car word) current-location (cadr word) (caddr word) current-location))))
If it matters, I'm running Hunspell 1.3.3 on OSX Yosemite.
(setq-default ispell-program-name (executable-find "hunspell"))
executable-find
, if successful, has no side effects, so in your case it doesn't make sense to call it the way you did. – wvxvw Jul 19 '15 at 11:47aspell
so I don't know wherehunspell
keeps its personal dictionary, but judging fromaspell
personal dictionary location I'd be looking in the home directory for a file with a.dic
suffix. (Theaspell
dictionary would normally be something like~/.aspell.en.pws
). Also, you can runhunspell -D
to ask it to show all known dictionaries, yours will be one of those). – wvxvw Jul 20 '15 at 12:26