Properly fix ispell

I didn't want to have to deal with ispell's refusal to work with
anything but a plaintext word list, but it seems like there's no other option.
This commit is contained in:
Kiana Sheibani 2024-06-13 14:30:24 -04:00
parent 38af445c33
commit 86b37adf96
Signed by: toki
GPG key ID: 6CB106C25E86A9F7

View file

@ -2091,6 +2091,44 @@ I like having ophints for vim editing so that I don't get lost when making large
'(evil-goggles-change-face :inherit evil-goggles-delete-face)))
#+end_src
** Spell Checking
#+call: confpkg("Pkg: ispell")
Doom Emacs sets up spell-checking with ~ispell~ (Emacs-internal tool) and =aspell= (external tool) for us, which is nice. We just need to set which dictionary to use:
#+begin_src emacs-lisp
(after! ispell
(setq ispell-dictionary "en_US"))
#+end_src
We also need to generate a plain-text dictionary for some ~ispell~ functionality, which is annoying, but I haven't figured out a way around it. I could use my automated nix-build system for this, but I want to have access to my =aspell= config file, so it's easier to just put it in the usual location.
#+begin_src emacs-lisp
(defvar ~/plaintext-dict (expand-file-name "ispell/dict.plain" doom-data-dir)
"File location of a plaintext wordlist for spellchecking.")
(unless (file-readable-p ~/plaintext-dict)
(shell-command-to-string
(concat
"aspell -l en_US dump master > " ~/plaintext-dict ";"
"aspell -d en-computers.rws dump master >> " ~/plaintext-dict ";"
"aspell -d en_US-science.rws dump master >> " ~/plaintext-dict ";")))
(after! ispell
(setq ispell-alternate-dictionary ~/plaintext-dict))
#+end_src
Now that we have this word list, we can also plug it into ~cape-dict~ and get proper spelling completion!
#+begin_src emacs-lisp
(after! cape
(setq cape-dict-file ~/plaintext-dict))
(add-hook! text-mode
(add-hook! 'completion-at-point-functions :local :depth 40 #'cape-dict))
#+end_src
** Snippets
#+call: confpkg("Pkg: yasnippet")