13

After updating emacs to version 26.1 on a windows machine, I get the following error message from flyspell:

Error enabling Flyspell mode:
(c:/Program Files (x86)/Aspell/bin/aspell.exe release 0.60 or greater is required)

The problem is, even after installing a windows binary of aspell 0.6 from here, it still doesn't work because apparently

The Aspell 0.60 library is binary compatible with the Aspell 0.50 library. 
For this reason I chose _not_ to increment the major version number (so-name) of the shared library by default [...]

Has anybody else had this problem already? Are emacs users relying on aspell on windows, or rather using alternatives like hunspell?

3
  • 1
    I personally use hunspell on windows.
    – InHarmsWay
    Commented Jun 7, 2018 at 18:37
  • Do you build it yourself, or is there a good source of recent windows binaries?
    – B_old
    Commented Jun 8, 2018 at 8:11
  • I did not compile myself, I believe I got it from sourceforge.net/projects/hunspell
    – InHarmsWay
    Commented Jun 8, 2018 at 8:16

6 Answers 6

12

Yes, hunspell is THE spell-checker to use with emacs 26.1, as there's no windows binary of aspell 0.6 for the time being, and no one can foretell when there will be one. I tried hunspell this morning with emacs 26.1 on Windows 10 and it ran perfectly well. You will find some very useful tips on how to configure your .emacs file for hunspell here. Have a nice day !

1
  • 1
    I get error Error: ispell-check-version: Wrong type argument: stringp, nil
    – Didier A.
    Commented Aug 18, 2018 at 6:15
14

You can install aspell or hunspell with https://www.msys2.org/. MSYS2 has native binaries for aspell available which are compatible with Emacs 26.1. Note you can also install emacs using MSYS2 as well.

After installing, MSYS2 MinGW 64-bit should be in your start menu. Launch that, which brings up a terminal, and search for packages using pacman -Ss aspell.

There are several options. I ended up using the following two packages to install aspell and an English dictionary:

pacman -S mingw64/mingw-w64-x86_64-aspell
pacman -S mingw64/mingw-w64-x86_64-aspell-en

Now you can enter which aspell in the same terminal to find it's location. It'll probably be in C:\msys64\mingw64\bin.

Add that path to your "Path" environmental variable.

In your emacs config set (setq ispell-program-name "aspell").

If everything is setup correctly you should be able to enable flyspell-mode without getting an error like the following in your message buffer:

Error enabling Flyspell mode:
(Searching for program No such file or directory aspell)

All the above also applies to hunspell. Hunspell even provides instructions on their github page for building from source using MSYS2 on Windows.

4
  • This is a nice and straight-forward solution to use aspell without hurting your current configuration at all.
    – Dean Seo
    Commented Dec 6, 2018 at 3:15
  • An excellent post that shows a real understanding of the issues--and it works too!
    – Edman
    Commented Mar 29, 2019 at 4:02
  • This is the optimal solution. I did have to restart emacs on windows to get it working!
    – Hasan Sh
    Commented Jul 12, 2020 at 8:04
  • I'm updating from Emacs 25.2 to Emacs 27.1 and had the problem in the question. This answer was the way to go for me, although, I'm specifying the full program name instead of adding to the path, i.e., (setq ispell-program-name "<path-to-msys64>/usr/bin/aspell.exe"). It works without problems. Using MSys64 I also added dictionaries not available in MSYS2 package, compiled and installed them with success.
    – euluis
    Commented Dec 16, 2020 at 12:19
2

Win32/Win64 binaries for aspell-0.60.6.1 have always existed. You can obtain a standalone fully working with Emacs version of aspell-0.60.6.1 from Cygwin. Basically, all you need from Cygwin are the following files:

bin\aspell.exe

bin\cygaspell-15.dll

bin\cyggcc_s-seh-1.dll

bin\cygiconv-2.dll

bin\cygintl-8.dll

bin\cygncursesw-10.dll

bin\cygstdc++-6.dll

bin\cygwin1.dll

lib\aspell-0.60

share\doc\ aspell + aspell-LANG (Optional)

share\info\ files aspell.info.gz and dir

share\man\man1\aspell.1.gz

My windows 10, init.el is setup as follows:

;;; Use Aspell for spell checking

(setq-default ispell-program-name "C:/Emacs/bin/aspell.exe")


;; Custom hotkeys for spell checking in emacs.

(global-unset-key (kbd "M-$"))  ;unbind emacs default key for ispell-word

(global-set-key (kbd "<f7>") 'ispell-word)

(global-set-key (kbd "C-<f7>") 'flyspell-mode)

;;; Specify which dictionary to use at startup (english, ...). Uncomment one of the following lines:

;(setq ispell-dictionary "english")

I have tested flyspell with Aspell 0.60 and Emacs 26.1 yesterday. All I can say is that feature is slow and not working well. In my opinion not recommended because there are alternative faster Windows native programs. Despite the fact having fine tuned Emacs installation in windows 10 for several versions, I do think this program is not for me. For those using LaTeX source, TeXStudio is the recommended solution in Windows (and even in Linux).

1
  • You do not provide any link or resources to the binaries. It looks like you compiled it yourself for windows.
    – Welgriv
    Commented Apr 16, 2020 at 15:21
1

I avoid installing MSYS on Windows 10 because one can download Ubuntu from the MS store and use ispell and emacs inside the Ubuntu application (sudo apt-get install ispell). You have still access to the Windows files under the mount point /mnt/c.

1
  • 1
    Please consider elaborating your answer to point how how it answers the question.
    – Drew
    Commented Feb 4, 2019 at 15:09
1

To complete others answers, Install hunspell instead aspell this way:

  1. Download the hunspell win32 binairy here, look for hunspell-1.3.2-3-w32-bin.zip (ex: ctrl+F hunspell)
  2. Unzip it within a given repository path\to\my\repo (a smart one can be C:\Program Files (x86)\hunspell)
  3. Add this to your emacs init file : (setq-default ispell-program-name "C:/Program Files (x86)/hunspell/bin/hunspell.exe") note that the \ have change into /.

If you need more details, specially using other dictionaries, follow these instructions as previously mentioned, but beware there is NO need to add hunspell to your windows PATH.

0

The simplest solution that I found is to install aspell on wsl. Then create a aspell.cmd file with the following content

@echo off
wsl %~n0 %*

Put this file somewhere on your Path.

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.