0

I try to get flyspell working with hunspell on Linux with German de_DE_frami dictionary from LibreOffice Extensions. The setup works ... more or less. (English dictionarys work perfectly fine.)

But for some reason flyspell-buffer is not marking the words in some org-mode or latex documents.

Could please someone help me to fix this annoying problem? (I'm out of ideas right now) I put all files you need to check this yourself, below.

More detailed problem description: Sometimes when loading a file (it happens with *.org and *.latex, as far as I tested). Then enabling flyspell with M-x flyspell-mode having the german dictionary de_DE_frami selected. Then check the whole buffer with M-x flyspell-buffer, flyspell does not mark wrong words. See this screenshot: enter image description here Also I get a lot Messages like this:

 -> ----------- - 908: word not found
 -> ------------ - 896: word not found
 -> ---------- - 883: word not found
 -> ------------ - 872: word not found
 -> ------------ - 859: word not found
 -> ---------- - 846: word not found
 -> ------------ - 835: word not found
 -> -------- - 822: word not found
 -> ------------ - 813: word not found
 -> ------------ - 800: word not found
 -> ---- - 787: word not found
 -> elitr - 782: word not found
 -> sadipscing - 776: word not found
 -> consetetur - 765: word not found
 -> amet - 754: word not found
 -> sit - 749: word not found
 -> dolor - 745: word not found
 -> ipsum - 739: word not found
 -> Lorem - 733: word not found
 -> RA - 727: word not found

But selecting an english dictionary en_US and doing the same everything works fine. See screenshot: enter image description here

This happens only on some files, but most files I have to deal with, so flyspell is unusable to me. Therefore I'd like to fix this problem.

I put both files you need to check this yourself, below. I used dictionary directly from LibreOffice website. no other Spellcheckers (like aspell or ispell) are installed and no other Dictionarys (besides de_DE_frami and en_US) are installed on system.

Emacs Version is: GNU Emacs 24.5.1 (i586-pc-linux-gnu, X toolkit, Xaw3d scroll bars) of 2016-03-23 on babin, modified by Debian

Emacs is run with:

#> emacs -Q -l my-flyspell.el foo.org 

Config-File my-flyspell.el:

(require 'flyspell)

(setq-default ispell-program-name "hunspell")

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

(defun switch-dictionary-de-en ()
  "Switch german and english dictionaries."
  (interactive)
  (let* ((dict ispell-current-dictionary)
         (new (if (string= dict "de_DE_frami") "en_US"
                "de_DE_frami")))
    (ispell-change-dictionary new t)
    (trilo-setze-fly-mode-string)
    ;;(flyspell-buffer)
    (message "Switched dictionary from %s to %s" dict new)))

(defun trilo-setze-fly-mode-string ()
  "show used dictionary string in modeline"   
  (setq flyspell-mode-line-string 
        (concat " \[" (substring (if ispell-current-dictionary ispell-current-dictionary ispell-dictionary) 0 2) "\]")))


(setq flyspell-issue-message-flag nil)


(add-hook 'flyspell-mode-hook '(lambda()
                                 (trilo-setze-fly-mode-string)))

Text-File foo.org with flycheck problems:

| ST | Lorem      | ipsum      | dolor  | sit        | amet,    | consetetur | sadipscing | elitr,   |            |           |    |        |
|----+------------+------------+--------+------------+----------+------------+------------+----------+------------+-----------+----+--------|
| RA | sed        | diam       | nonumy | eirmod     | tempor   | invidunt   | ut         | labore   | et         | dolore    |    |        |
| RA | magna      | aliquyam   | erat,  | sed        | diam     | voluptua.  | At         | vero     | eos        | et        |    |        |
| RA | accusam    | et         | justo  | duo        | dolores  | et         | ea         | rebum.   | Stet       | clita     |    |        |
| RA | kasd       | gubergren, | no     | sea        | takimata | sanctus    | est        | Lorem    | ipsum      |           |    |        |
| RA | dolor      | sit        | amet.  | Lorem      | ipsum    | dolor      | sit        | amet,    | consetetur |           |    |        |
| RA | sadipscing | elitr,     | sed    | diam       | nonumy   | eirmod     | tempor     | invidunt |            |           |    |        |
| RA | ut         | labore     | et     | dolore     | magna    | aliquyam   | erat,      | sed      | diam       | voluptua. |    |        |
| RA | At         | vero       | eos    | et         | accusam  | et         | justo      | duo      | dolores    | et        | ea | rebum. |
| RA | Stet       | clita      | kasd   | gubergren, | no       | sea        | takimata   | sanctus  | est        |           |    |        |
| RA | Lorem      | ipsum      | dolor  | sit        | amet.    |            |            |          |            |           |    |        |
| RA | Lorem      | ipsum      | dolor  | sit        | amet,    | consetetur | sadipscing | elitr,   |            |           |    |        |
|----+------------+------------+--------+------------+----------+------------+------------+----------+------------+-----------+----+--------|
| RA | sed        | diam       | nonumy | eirmod     | tempor   | invidunt   | ut         | labore   | et         | dolore    |    |        |
| RA | magna      | aliquyam   | erat,  | sed        | diam     | voluptua.  | At         | vero     | eos        | et        |    |        |
| RA | accusam    | et         | justo  | duo        | dolores  | et         | ea         | rebum.   | Stet       | clita     |    |        |
| RA | kasd       | gubergren, | no     | sea        | takimata | sanctus    | est        | Lorem    | ipsum      |           |    |        |
| RA | dolor      | sit        | amet.  | Lorem      | ipsum    | dolor      | sit        | amet,    | consetetur |           |    |        |
| RA | sadipscing | elitr,     | sed    | diam       | nonumy   | eirmod     | tempor     | invidunt |            |           |    |        |
| RA | ut         | labore     | et     | dolore     | magna    | aliquyam   | erat,      | sed      | diam       | voluptua. |    |        |
| RA | At         | vero       | eos    | et         | accusam  | et         | justo      | duo      | dolores    | et        | ea | rebum. |
| RA | Stet       | clita      | kasd   | gubergren, | no       | sea        | takimata   | sanctus  | est        |           |    |        |
| RA | Lorem      | ipsum      | dolor  | sit        | amet.    |            |            |          |            |           |    |        |
| RA | Lorem      | ipsum      | dolor  | sit        | amet,    | consetetur | sadipscing | elitr,   |            |           |    |        |
| RA |            |            |        |            |          |            |            |          |            |           |    |        |
|----+------------+------------+--------+------------+----------+------------+------------+----------+------------+-----------+----+--------|
| RA | sed        | diam       | nonumy | eirmod     | tempor   | invidunt   | ut         | labore   | et         | dolore    |    |        |
| RA | magna      | aliquyam   | erat,  | sed        | diam     | voluptua.  | At         | vero     | eos        | et        |    |        |
| RA | accusam    | et         | justo  | duo        | dolores  | et         | ea         | rebum.   | Stet       | clita     |    |        |
| RA | kasd       | gubergren, | no     | sea        | takimata | sanctus    | est        | Lorem    | ipsum      |           |    |        |
| RA | dolor      | sit        | amet.  | Lorem      | ipsum    | dolor      | sit        | amet,    | consetetur |           |    |        |
| RA | sadipscing | elitr,     | sed    | diam       | nonumy   | eirmod     | tempor     | invidunt |            |           |    |        |
| RA | ut         | labore     | et     | dolore     | magna    | aliquyam   | erat,      | sed      | diam       | voluptua. |    |        |
| RA | At         | vero       | eos    | et         | accusam  | et         | justo      | duo      | dolores    | et        | ea | rebum. |
| RA | Stet       | clita      | kasd   | gubergren, | no       | sea        | takimata   | sanctus  | est        |           |    |        |
| RA | Lorem      | ipsum      | dolor  | sit        | amet.    |            |            |          |            |           |    |        |

variable: ispell-dictionary-alist:

Value: (("brasileiro" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-d" "pt_BR")
  nil utf-8)
 ("british" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-B" "-d" "en_GB")
  nil utf-8)
 ("castellano" "[[:alpha:]]" "[^[:alpha:]]" "[-]" nil
  ("-B" "-d" "es_ES")
  "~tex" utf-8)
 ("castellano8" "[[:alpha:]]" "[^[:alpha:]]" "[-]" nil
  ("-B" "-d" "es_ES")
  "~latin1" utf-8)
 ("czech" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-B" "-d" "cs_CZ")
  nil utf-8)
 ("dansk" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-C" "-d" "da_DK")
  nil utf-8)
 ("esperanto" "[[:alpha:]]" "[^[:alpha:]]" "[-']" t
  ("-C" "-d" "eo")
  "~latin3" utf-8)
 ("esperanto-tex" "[[:alpha:]]" "[^[:alpha:]]" "[-'`\"]" t
  ("-C" "-d" "eo")
  "~tex" utf-8)
 ("finnish" "[[:alpha:]]" "[^[:alpha:]]" "[:]" nil
  ("-C" "-d" "fi_FI")
  "~list" utf-8)
 ("francais7" "[[:alpha:]]" "[^[:alpha:]]" "[`'^-]" t
  ("-d" "fr_FR")
  nil utf-8)
 ("francais" "[[:alpha:]]" "[^[:alpha:]]" "[-'.@]" t
  ("-d" "fr_FR")
  "~list" utf-8)
 ("francais-tex" "[[:alpha:]]" "[^[:alpha:]]" "[-'^`\".@]" t
  ("-d" "fr_FR")
  "~tex" utf-8)
 ("italiano" "[[:alpha:]]" "[^[:alpha:]]" "[-.]" nil
  ("-B" "-d" "it_IT")
  "~tex" utf-8)
 ("nederlands" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C" "-d" "nl_NL")
  nil utf-8)
 ("nederlands8" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C" "-d" "nl_NL")
  nil utf-8)
 ("norsk" "[[:alpha:]]" "[^[:alpha:]]" "[\"]" nil
  ("-d" "nn_NO")
  "~list" utf-8)
 ("norsk7-tex" "[[:alpha:]]" "[^[:alpha:]]" "[\"]" nil
  ("-d" "nn_NO")
  "~plaintex" utf-8)
 ("polish" "[[:alpha:]]" "[^[:alpha:]]" "[.]" nil
  ("-d" "pl_PL")
  nil utf-8)
 ("portugues" "[[:alpha:]]" "[^[:alpha:]]" "[']" t
  ("-C" "-d" "pt_PT")
  "~latin1" utf-8)
 ("russian" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-d" "ru_RU")
  nil utf-8)
 ("russianw" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-d" "ru_RU")
  nil utf-8)
 ("slovak" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-B" "-d" "sk_SK")
  nil utf-8)
 ("slovenian" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-B" "-d" "sl_SI")
  nil utf-8)
 ("svenska" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil
  ("-C" "-d" "sv_SE")
  "~list" utf-8)
 ("hebrew" "[[:alpha:]]" "[^[:alpha:]]" "" nil
  ("-B" "-d" "he_IL")
  nil utf-8)
 (nil "[[:alpha:]]" "[^[:alpha:]]" "[.ß-]" t
      ("-d" "de_DE")
      nil utf-8)
 ("american")
 ("deutsch")
 ("deutsch8")
 ("english")
 ("german")
 ("german8")
 ("de_DE_frami" "[[:alpha:]]" "[^[:alpha:]]" "[.ß-]" t
  ("-d" "de_DE_frami")
  nil utf-8)
 ("en_US")
 ("de_DE" "[[:alpha:]]" "[^[:alpha:]]" "[.ß-]" t
  ("-d" "de_DE")
  nil utf-8))

Hunspell output (note, that de_DE is just a symbolic link to de_DE_frami):

#>hunspell -D
SEARCH PATH:
.::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/home/trilo/.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/en_US
/usr/share/hunspell/de_DE_frami
/usr/share/myspell/dicts/hyph_de_LI
/usr/share/myspell/dicts/hyph_de_LU
/usr/share/myspell/dicts/hyph_de_BE
/usr/share/myspell/dicts/hyph_en_US
/usr/share/myspell/dicts/hyph_de_DE
/usr/share/myspell/dicts/hyph_de_CH
/usr/share/myspell/dicts/hyph_de_AT
LOADED DICTIONARY:
/usr/share/hunspell/de_DE.aff
/usr/share/hunspell/de_DE.dic
Hunspell 1.3.3
  • I would suggest narrowing down your test to only the problematic dictionary in the buffer where the problem occurred, instead of running multiple tests back-to-back with different dictionaries in the same buffer without cleaning out buffer-local variables and/or the existing running spell check process -- M-x list-processes. E.g., (1) set up the dictionary you want to test; (2) open the problematic buffer without any flyspell; (3) manually start flyspell and run your test without switching dictionaries. After you narrow things down, then yes, play with switching dictionaries and so forth. – lawlist May 24 '17 at 18:43
  • Hello, thanks for your suggestion. Steps 1 to 3, I have done with the problematic dictionary and text, multiple times, restarting emacs (this destroys ispell-processes). The switch to the other dictionary should demonstrate that hunspell and flyspell has been set up correctly and are able to handle the buffer. – jue May 24 '17 at 18:56

Your Answer

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

Browse other questions tagged or ask your own question.