1

Here I am on a GNU/Linux machine.

I have installed hunspell 1.7.0-3 and hunspell-es_MX and a lot of the english dictionaries as well. If I type

hunspell -D

I get, along others:

/usr/share/hunspell/es_MX

And if i check the files I can see that I have a aff file in the mentioned directory. In my .emacs file I have:

(setenv
  "DICPATH"
  "/usr/share/hunspell")
;; Tell ispell-mode to use hunspell.
(setq
  ispell-program-name
  "hunspell")

(setq ispell-local-dictionary "es_MX")
(setq ispell-local-dictionary-alist
     '(("es_MX" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil nil nil utf-8)))

as I saw in other questions here.

But If i run the spell checker it fails, printing:

Can't find Hunspell dictionary with a .aff affix file

I am completely lost here.

More info: My Emacs is 27.2 and the output of the command pointed by rplium, hunspell -D -a /dev/null, is:

SEARCH PATH:
.::/usr/share/hunspell:/usr/share/myspell:/usr/share/myspell/dicts:/Library/Spelling:/home/karel/.openoffice.org/3/user/wordbook:/home/karel/.openoffice.org2/user/wordbook:/home/karel/.openoffice.org2.0/user/wordbook:/home/karel/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/en_SG
/usr/share/hunspell/en_AG
/usr/share/hunspell/en_US
/usr/share/hunspell/en_BS
/usr/share/hunspell/en_GB
/usr/share/hunspell/es_MX
/usr/share/hunspell/en_HK
/usr/share/hunspell/en_NG
/usr/share/hunspell/en_GB-large
/usr/share/hunspell/en_BZ
/usr/share/hunspell/en_ZA
/usr/share/hunspell/en_NZ
/usr/share/hunspell/en_NA
/usr/share/hunspell/en_ZW
/usr/share/hunspell/en_IN
/usr/share/hunspell/en_GH
/usr/share/hunspell/en_JM
/usr/share/hunspell/en_BW
/usr/share/hunspell/en_TT
/usr/share/hunspell/en_DK
/usr/share/hunspell/en_IE
/usr/share/hunspell/en_US-large
/usr/share/myspell/dicts/en_SG
/usr/share/myspell/dicts/en_AG
/usr/share/myspell/dicts/en_US
/usr/share/myspell/dicts/en_BS
/usr/share/myspell/dicts/en_GB
/usr/share/myspell/dicts/es_MX
/usr/share/myspell/dicts/en_HK
/usr/share/myspell/dicts/en_NG
/usr/share/myspell/dicts/en_GB-large
/usr/share/myspell/dicts/en_BZ
/usr/share/myspell/dicts/en_ZA
/usr/share/myspell/dicts/en_NZ
/usr/share/myspell/dicts/en_NA
/usr/share/myspell/dicts/en_ZW
/usr/share/myspell/dicts/en_IN
/usr/share/myspell/dicts/en_GH
/usr/share/myspell/dicts/en_JM
/usr/share/myspell/dicts/en_BW
/usr/share/myspell/dicts/en_TT
/usr/share/myspell/dicts/en_DK
/usr/share/myspell/dicts/en_IE
/usr/share/myspell/dicts/en_US-large
Can't open affix or dictionary files for dictionary named "es_ES"
3
  • 1
    Telling us the version of Emacs helps. What does hunspell -D -a /dev/null output?
    – rpluim
    Mar 31, 2022 at 8:05
  • Ok. Last line seems to be pointing to something important.
    – wpkzz
    Mar 31, 2022 at 16:24
  • OK, looks like your default hunspell dictionary is set to 'es_ES', which is not installed. See if DICTIONARY=es_MX hunspell -D -a /dev/null lists a .aff file (and if so, see if you can change the default dictionary for hunspell to be "es_MX")
    – rpluim
    Mar 31, 2022 at 17:30

1 Answer 1

1

Ok. It has to do with something that is not obvious and is not easily found online or on the hunspell entry in the Emacs documentation. The es_MX dictionary (Mexican Spanish) is only a complement of the es_ES or es_any dictionaries, that act as the base. So I needed to put one of these for the es_MX to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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