I want to make hunspell work with emacs24 and a german dictionary on a ubuntu 13.04-box.

To do so I installed hunspell and hunspell-de and added the following to my .emacs file:

(setq ispell-program-name "hunspell")
(setq ispell-dictionary "deutsch8")

When I open a file in emacs and start flyspell-buffer I get Starting new Ispell process [[hunspell::deutsch8]] but it blocks the emacs buffer (mouse becomes a rotating disk indicating to wait) and works for endless without showing any results. So there must be something wrong with my config.

Without the second line it works, but only for english texts.

So what's the best way to setup hunspell for emacs24 with a german dictionary on ubuntu 13.04? Are there any possible pitfalls?

  • Note that the dictonary names are different for hunspell compared to ispell. Instead of (setq ispell-dictionary "deutsch8"), you should use (setq ispell-dictionary "de_DE"). Note, however, that this requires emacs 24.4 or greater. For earlier versions you need add the definitions to ispell-local-dictionary-alist as provided in the accepted answer. – Christian Herenz Nov 26 '18 at 19:38

To check if the dictionary is listed in the path run hunspell -D. It should output something along those lines:


Next, add your preferred dictionaries to ispell-local-dictionary-alist in your .emacs file

(add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
                                              ("-d" "de_DE"); Dictionary file name

(add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
                                              ("-d" "en_US")

(setq ispell-program-name "hunspell"          ; Use hunspell to correct mistakes
      ispell-dictionary   "deutsch-hunspell") ; Default dictionary to use

In addition to that you can define a function to switch between the german and english dictionaries and bind it to C-c d for example

(defun switch-dictionary-de-en ()
  "Switch german and english dictionaries."
  (let* ((dict ispell-current-dictionary)
         (new (if (string= dict "deutsch-hunspell") "english-hunspell"
    (ispell-change-dictionary new)
    (message "Switched dictionary from %s to %s" dict new)))

(global-set-key (kbd "C-c d") 'switch-dictionary-de-en)
  • 5
    Thanks. I think you should add a (require 'ispell) before the (add-to-list 'ispell-local...) line. – student Apr 23 '14 at 21:07
  • 2
    I think it will not hurt if I add a little comment for those Windows users who might fall on this. In Windows Emacs has the LANG environment variable set to the regional settings. It is a good idea to add something like (setenv "LANG" "en_US") to your init file. This will be your initial dictionary, unless you change it. The default LANG value might be set to something possibly weird (say ENG), generating an ispell/hunspell error. – antonio Dec 26 '14 at 18:02
  • 1
    @antonio True, but in my case, (setenv "DICTIONARY" "en_GB") worked. – legends2k Oct 19 '15 at 14:59
  • The creation of custom dictionary entries for hunspell is not required for emacs > 24. – Christian Herenz Nov 26 '18 at 19:45

From https://passingcuriosity.com/2017/emacs-hunspell-and-dictionaries/


;; Set $DICPATH to "$HOME/Library/Spelling" for hunspell.
;; Tell ispell-mode to use hunspell.

into your ~/.emacs.

My dictionary files were at /usr/share/hunspell.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.