From 86b37adf96152de372026b20278f2f4ca9e5c717 Mon Sep 17 00:00:00 2001 From: Kiana Sheibani Date: Thu, 13 Jun 2024 14:30:24 -0400 Subject: [PATCH] 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. --- config.org | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/config.org b/config.org index 67645ec..1c3cfad 100644 --- a/config.org +++ b/config.org @@ -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")