Wednesday, March 31, 2010

Configuring GNU Emacs 23 + Ispell + Russian Dictionary + Windows

Emacs ispell package is capable of running both Ispell and Aspell, but
as far as I've tried Aspell, it gives some nonsensical results. Maybe this
was due to some misconfiguration, but I wasn't eager to sort it out.

So I went with Ispell. Configuring it is also a bit of obscure process, so
I thought it would be good to have an installation guide step by step:


  1. Download Ispell from here.


  2. You should have Cygwin installed on your machine. Let's say, it is in folder c:\Programs\Cygwin.


  3. Unpack aforementioned Ispell to your Cygwin directory.


  4. Go to c:\Programs\Cygwin\usr\local\bin and copy ispell.exe to c:\Programs\Cygwin\bin. This is needed to run ispell directly from Windows, bypassing Cygwin shells.


  5. Download russian dictionaries from here and unpack them to some temporary folder. Let's say it would be d:\temp.


  6. Run Cygwin shell and perform the following commands (modify them appropriately):


    cd /cygdrive/d/temp
    make win
    mv russian.hash russianw.hash
    mv russian.aff russianw.aff
    mv russianw.* /usr/local/lib


    From now on, you sould be able to check files encoded in windows-1251 charset directly under Cygwin, like that:


    LANG=ru_RU ispell -drussianw file.txt


    Or, under cmd.exe:


    set LANG=ru_RU.CP1251
    c:\Programs\Cygwin\bin\ispell.exe -drussianw file.txt




  7. Now all we need to do is to configure Emacs correctly. Add the following lines to your dotemacs:


    (setq ispell-program-name "c:\\Programs\\cygwin\\bin\\ispell.exe")
    (setq ispell-dictionary "russianw")




  8. This should do the task. Now restart emacs and try running ispell on some file.


No comments: