1

ispell-init-process fails

When I try to correct a word with ispell, I got the following error:

ispell-init-process: Error: The encoding "nil" is not known. This could also mean that the file "/nix/store/pj0ivrsxk2hik5hv7pdywdxxga0m1wvv-aspell-0.60.8/lib/aspell/nil.cset" could not be opened for reading or does not exist.

I dug into this a bit. ispell-init-process internally sets variable ispell-library-directory

        (setq ispell-library-directory (ispell-check-version)
              ;; Assign a non-nil value to ispell-process-directory
              ;; before calling ispell-start-process, since that
              ;; function needs it to set default-directory when
              ;; ispell-async-processp is nil.
          ispell-process-directory default-directory
          ispell-process (ispell-start-process)
          ispell-filter nil
          ispell-filter-continue nil)

The full source code here

and I confirmed that this is indeed nil on my Emacs.

I guess this is because (ispell-check-version) returns nil. But I don't have a good idea why that happens. Could someone give me pointers, or any idea why this happens?

The definition of (ispell-check-version) here

Some more info

  1. aspell exists in the $PATH and Emacs can see it
(executable-find "aspell") => "/nix/store/lzphgp0k1cm7sz27f59jqaa57r13mlc2-aspell-env/bin/aspell"
  1. aspell version seems correct:
$ aspell -vv
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.8)
  1. Dictionaries seem available
$ aspell dump dicts
en
...
en_US
...
  1. I'm using DoomEmacs doom/version below:
GNU Emacs     v28.2            nil
Doom core     v3.0.0-pre       HEAD -> master, origin/master, origin/HEAD b66ad7703 2023-03-17 00:33:32 -0400
Doom modules  v23.03.0-pre     HEAD -> master, origin/master, origin/HEAD b66ad7703 2023-03-17 00:33:32 -0400
4
  • In my setup (using aspel 0.60.8 as well), my ispell-library-directory is also nil and (ispell-check-version) returns nil and yet I don't have any problem checking a word.
    – NickD
    Commented Mar 22, 2023 at 2:23
  • That's good to know! Indeed I found that ispell-library-directory does not need to be set if ispell-async-processp is non-nil. Commented Mar 23, 2023 at 2:22
  • @NickD Could you also tell me what you get when you evaluate (ispell-get-coding-system)? I got nil and am wondering if that's the issue. Commented Mar 23, 2023 at 2:27
  • I get utf-8, coming from (assoc ispell-current-dictionary ispell-dictionary-alist) which returns (nil "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-B") nil utf-8).
    – NickD
    Commented Mar 23, 2023 at 4:08

1 Answer 1

1

Actually just adding this to a config file (In my case ~/.doom.d/config.el) solved it.

(after! ispell
  (setq ispell-dictionary "en_US")
  (setq ispell-local-dictionary "en_US")
  (setq ispell-local-dictionary-alist
        '(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8)
          )))

I was expecting either ispell-dictionary or ispell-local-dictionary-alist to be set automatically.

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.