checkers/spell: fix z=, zq, zw & personal dictionary

+ Fixes ispell not noticing allowed words in your personal dictionary.
  So +spell/correct would sometimes correct words that spell-fu wasn't
  highlighting as incorrect, and sometimes wouldn't correct words that
  were.
+ Fixes spell-fu refusing to read or write to the personal dictionary if
  the file didn't already exist beforehand (for zq and zw).
+ Change ispell-dictionary fallback from "en_US" (which aspell won't
  always recognize) to "en".
+ Moved ispell-personal-dictionary to ~/.emacs.d/.local/etc/ispell/ by
  default.
This commit is contained in:
Henrik Lissner 2020-08-23 02:32:58 -04:00
parent a8b7c00426
commit c497cdabc7
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 33 additions and 2 deletions

View file

@ -49,6 +49,15 @@
(defun +spell/correct ()
"Correct spelling of word at point."
(interactive)
;; We fake awareness for our personal dictionary by stopping short if spell-fu
;; hasn't highlighted the current word. This is necessary because
;; ispell/aspell struggles to find our `ispell-personal-dictionary' if it's
;; not in $HOME.
(unless (memq 'spell-fu-incorrect-face (face-at-point nil t))
(user-error "%S is correct" (thing-at-point 'word t)))
(ispell-set-spellchecker-params)
(save-current-buffer
(ispell-accept-buffer-local-defs))
(if (not (or (featurep! :completion ivy)
(featurep! :completion helm)))
(call-interactively #'ispell-word)