0

I am having some difficulty getting flyspell/aspell to run on emacs 27.2, MacOS 12.01. I think I need to install or enable a dictionary, but no ideas on how to do this.

If I type 'M-x flyspell-mode' I get the following error:

Starting new Ispell process /usr/local/bin/aspell with default dictionary...done
Error enabling Flyspell mode:
(Error: No word lists can be found for the language "en_GB".)

Sounds like a dictionary is missing. I have the following in my init.el

    ;; Spell-check
(require 'flyspell)
(setq flyspell-issue-message-flag nil
      ispell-local-dictionary "en_GB"
      ispell-program-name "/usr/local/bin/aspell")

(add-hook 'text-mode-hook 'flyspell-mode)
(add-hook 'prog-mode-hook 'flyspell-prog-mode)

If I type which aspell in Terminal it returns /usr/local/bin/aspell

1 Answer 1

2

You need make sure aspell command line program is installed. If it's not installed, run brew install aspell, see https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/aspell.rb

To specify the dictionary which aspell uses,

(setq ispell-extra-args '("--lang=en_US"))

I answered lots of questions about flyspell, see https://emacs.stackexchange.com/search?q=user:202+[flyspell]

You can also read my article, http://blog.binchen.org/posts/what-s-the-best-spell-check-set-up-in-emacs/

Or uses my package wucuo (https://github.com/redguardtoo/wucuo) to replace flyspell-mode and flyspell-prog-mode.

Most people are confused on spell checking in Emacs, so let me clarify a few things,

  • In good old days, people use ispell.el. These days, people use flyspell.el. flyspell does use a few APIs from ispell, but they are basically two independent packages. Setting up other ispell variables (except ispell-extra-args and ispell-program-name) might have no effect on flyspell at all.

  • flyspell needs cli program to do the actual spell checking thing. The cli program could be aspell or hunspell.

  • Setting up the options passed to aspell (the cli program) is straight forward. One variable ispell-extra-args is enough.

  • Setting up the options passed to hunspell (the cli program) is more complicated. You can see my other answers for details.

1
  • Thank you Chen, very helpful. I would only add that after brew install Aspell I had to change the location of Aspell to ispell-program-name "/opt/homebrew/bin/aspell". Trivial, but I thought I better record that for posterity.
    – Lindsay
    Dec 1, 2021 at 21:14

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.