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")