0

OK I am at my wit's end on this. I have found various incantations on the internet for this, but nothing works so far. I am running emacs 29.2, the native windows build, on Windows 10. I want to spell check with hunspell. I decided to use msys2 to build it. I installed msys2, cloned hunspell from its git repo, and built it. The exe is C:\msys64\mingw64\bin\hunspell. "hunspell -D" lists C:\Hunspell as the 2nd dir (after .) where it looks for dictionaries. I downloaded en_US.{aff, dic} from LibreOffice website to C:\Hunspell. I added to my .emacs file:

(setq ispell-program-name "c:/msys64/mingw64/bin/hunspell")

At this point, if I try spell checking a buffer, I get the error

Hunspell error (is $LANG unset?): Can't open affix or dictionary files for dictionary named "default".

Some incantations will let me get beyond this and run a spell check, but every single word is marked as an error.

So - please - what do I do? The pain of getting a spellchecker working on emacs is a major annoyance. I opened my LaTeX document in TeXWorks (comes with MikTeX) and spellcheck just works out of the box. Come on emacs......

1 Answer 1

0

Try this

(use-package ispell
  :init
  (setenv "DICTIONARY" "en_US")
  (setenv "DICPATH" "C:\\Path\\to\\folder\\with\\dictionary")
  :if (eq system-type 'windows-nt)
  :custom ((ispell-program-name "c:/msys64/mingw64/bin/hunspell.exe")
           (ispell-local-dictionary "en_US")
           (ispell-local-dictionary-alist
            '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8)))))

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.