1

My .emacs file contains the following code to make hunspell work, however I get the following error message when starting flyspell-mode:

Starting new Ispell process hunspell with deutsch-hunspell dictionary...
Error enabling Flyspell mode:
(ispell-phaf: No matching entry for deutsch-hunspell.
)

Any idea of how to fix this?

(add-to-list 'ispell-local-dictionary-alist '("deutsch-hunspell"
                                              "[[:alpha:]]"
                                              "[^[:alpha:]]"
                                              "[']"
                                              t
                                              ("-d" "de_DE"); Dictionary file name
                                              nil
                                              iso-8859-1))

(add-to-list 'ispell-local-dictionary-alist '("english-hunspell"
                                              "[[:alpha:]]"
                                              "[^[:alpha:]]"
                                              "[']"
                                              t
                                              ("-d" "en_US")
                                              nil
                                              iso-8859-1))

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

hunspell -D gives:

 hunspell -D
SEARCH PATH:
.::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/home/dw/.openoffice.org/3/user/wordbook:.openoffice.org2/user/wordbook:.openoffice.org2.0/user/wordbook:Library/Spelling:/opt/openoffice.org/basis3.0/share/dict/ooo:/usr/lib/openoffice.org/basis3.0/share/dict/ooo:/opt/openoffice.org2.4/share/dict/ooo:/usr/lib/openoffice.org2.4/share/dict/ooo:/opt/openoffice.org2.3/share/dict/ooo:/usr/lib/openoffice.org2.3/share/dict/ooo:/opt/openoffice.org2.2/share/dict/ooo:/usr/lib/openoffice.org2.2/share/dict/ooo:/opt/openoffice.org2.1/share/dict/ooo:/usr/lib/openoffice.org2.1/share/dict/ooo:/opt/openoffice.org2.0/share/dict/ooo:/usr/lib/openoffice.org2.0/share/dict/ooo
AVAILABLE DICTIONARIES (path is not mandatory for -d option):
/usr/share/hunspell/de_DE
/usr/share/hunspell/de_LU
/usr/share/hunspell/de_BE
/usr/share/hunspell/en_US
/usr/share/myspell/dicts/hyph_lt_LT
Can't open affix or dictionary files for dictionary named "en_AU".

I am working on an ubuntu 15.10 box with emacs 24.5.1

2

Insert below code into ~/.emacs or ~/.emacs.d/init,

(setq ispell-program-name "hunspell")
(setq ispell-local-dictionary "de_DE")
(setq ispell-local-dictionary-alist
      '(("de_DE" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)))

AFTER above setup, you need turn on flyspell-mode by (flyspell-mode 1).

Please make sure your dictionary is loaded properly. This is hunspell setup instead of Emacs setup.

At Linux, you don't need extra setup (if your dictionaries are installed in a standard location).

At other operating systems, here is the easiest way to hint hunspell where to search the dictionary.

You only need setup environment variable DICPATH by export DICPATH=/usr/share/hunspell/de_DE in Bash (At windows, you can setup environment variable through "Control Panel"). Both de_DE.dic and de_DE.aff should exist in that directory.

Or you just change your locale to de_DE

  • With this I get: Error enabling Flyspell mode: (ispell-phaf: No matching entry for nil. ) – student Feb 1 '16 at 8:51
  • set environment variable DICPATH – chen bin Feb 1 '16 at 12:42
  • I have set the DICTPATH in my .profile file and checked it in my emacs session via getenv. The directory /usr/share/hunspell/ contains the file de_DE.aff and de_DE.dic. Howver I get the same error. – student Feb 2 '16 at 18:00
  • what's your OS? emacs version? – chen bin Feb 2 '16 at 22:51
  • DICPATH is only needed for non-Linux OS. In your case, my original answer is enough. what you can do is re-install hunspell-de-de (maybe dictionary is broken?). Then use my setup at github.com/redguardtoo/emacs.d (maybe you mistakenly override emacs default setup?) – chen bin Feb 4 '16 at 1:44
2

I compiled Emacs today (March 14, 2016) from git, version 25.1.50.1 for Windows 8.1, 64-bit. Run into the same issue. Found this answer by the indefatigable Eli Zaretskii and shortened the code for hunspell to this lines in my .emacs:

(add-to-list 'exec-path "C:/cygwin64/usr/local/bin")
(setq ispell-program-name (executable-find "hunspell"))
(ispell-change-dictionary "de_DE" t)

OK, you see, hunspell was installed at the given path. I set the DICPATH variable to this locations as well. I set the DICTIONARY variable to "de_DE".

It was hard to find where hunspell stored the personal dictionary. I found it eventually at $HOME, the name of the file was hunspell_de_DE.

So it seems the whole installation is a lot easier nowadays.

0

What causes the error ispell-phaf: No matching entry ... is the name deutsch-hunspell. By some reason ispell.el assumes that this is a real dictionary name and tries to locate corresponding files, namely deutsch-hunspell.dic and deutsch-hunspell.aff under /usr/share/hunspell directory.

That said, you should use only names found under /usr/share/hunspell/ and only those of them that have an affix file (.aff) that are base dictionaries in hunspell terms (man hunspell for more details).

This does not mean however that if you specify de_DE hunspell will use /usr/share/hunspell/de_DE.{dic,aff} only. You can customize the exact set of dictionaries by means of -d option that will be passed to hunspell. For example, like this:

(setq ispell-local-dictionary-alist
      '(("de_DE" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
         ("-d" "de_DE,de_med") nil iso-8859-1)))

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.