I get this error message when I try to load "german8" spelling dictionary while using flyspell-mode in text-mode:
Error in post-command-hook (flyspell-post-command-hook): (error "Error: The file "/usr/lib/aspell/deutsch\" can not be opened for reading.")
I've checked and there is no /usr/lib/aspell/deutsch. Ubuntu synaptic package manager offered me "aspell-de" and that didn't clear it.
Here's the code in my .emacs that started the trouble:
;;switch dictionaries between German and English with F8 key
(defun fd-switch-dictionary()
(interactive)
(let* ((dic ispell-current-dictionary)
(change (if (string= dic "deutsch8") "english" "deutsch8")))
(ispell-change-dictionary change)
(message "Dictionary switched from %s to %s" dic change)
))
(global-set-key (kbd "<f8>") 'fd-switch-dictionary)
I can repeat this same error by simply starting flyspell-mode then trying to do ispell-change-dictionary. german8 is offered, but the message appears again:
Error enabling Flyspell mode:
(Error: The file "/usr/lib/aspell/german" can not be opened for reading.)
I was having exactly the same problem, but I have found a very simple workaround. I assume
your Emacs spell checker is set to aspell, i.e., (setq-default ispell-program-name "aspell")
the appropriate aspell dictionary is installed, for example by apt-get install aspell-de
.
For some reason there seems to be a bug in the list of dictionaries that ispell "sees", i.e., the list of dictionaries that are available when you perform ispell-change-dictionary
. When selecting "deutsch" it tries to load "/usr/lib/aspell/deutsch\"
. However it looks like the aspell dictionary names have changed, since aspell-de
now contains dictionaries called de_DE*
. I guess the idea of @Daniel Ralston's answer is to fix this, but this didn't work for me. I also tried to pass the actual dictionary names to ispell-change-dictionary
, but somehow it insisted on getting a dictionary from its own list and I never could convince it that my dictionary is indeed correct.
What is working for me though is a simple symlink fix. At first I wasn't sure what I'm supposed to symlink, because the error looks like it was trying to load the dictionary from a directory called "deutsch". But it turned out that it is actually looking for a typical aspell .alias
file. So by using this symlink
sudo ln -s /usr/lib/aspell/de_DE.alias /usr/lib/aspell/deutsch.alias
I can now simply chose "deutsch" in ispell-change-dictionary
.
Recently, some old and oft-used dictionary aliases seem to have been removed from the German aspell package. This has made emacs' German dictionary definitions obsolete. Try adding this to your .emacs
:
(eval-after-load "ispell"
'(add-to-list 'ispell-dictionary-alist
'("deutsch8"
"[a-zA-ZäöüßÄÖÜ]" "[^a-zA-ZäöüßÄÖÜ]" "[']" t
("-C" "-d" "de_DE-neu.multi")
"~latin1" iso-8859-1)))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With