Merge pull request #4262 from iwahbe/spell-fix-without-aspell

Fix behaviour without aspell
This commit is contained in:
Henrik Lissner 2020-11-14 15:06:27 -05:00 committed by GitHub
commit 2d40264158
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 7 deletions

View file

@ -50,12 +50,14 @@
(defun +spell/correct () (defun +spell/correct ()
"Correct spelling of word at point." "Correct spelling of word at point."
(interactive) (interactive)
;; HACK Fake awareness for our personal dictionary by stopping short if ;; spell-fu fails to initialize correctly if it can't find aspell or a similar
;; spell-fu hasn't highlighted the current word. This is necessary ;; program. We want to signal the error, not tell the user that every word is
;; because ispell/aspell struggles to find our ;; spelled correctly.
;; `ispell-personal-dictionary' if it's not in $HOME. (unless (;; This is what spell-fu uses to check for the aspell executable
(unless (memq 'spell-fu-incorrect-face (face-at-point nil t)) or (and ispell-really-aspell ispell-program-name)
(user-error "%S is correct" (thing-at-point 'word t))) (executable-find "aspell"))
(user-error "Aspell is required for spell checking"))
(ispell-set-spellchecker-params) (ispell-set-spellchecker-params)
(save-current-buffer (save-current-buffer
(ispell-accept-buffer-local-defs)) (ispell-accept-buffer-local-defs))

View file

@ -74,7 +74,7 @@
:when (executable-find "aspell") :when (executable-find "aspell")
:hook (text-mode . spell-fu-mode) :hook (text-mode . spell-fu-mode)
:general ([remap ispell-word] #'+spell/correct) :general ([remap ispell-word] #'+spell/correct)
:init :preface
(defvar +spell-correct-interface (defvar +spell-correct-interface
(cond ((featurep! :completion ivy) (cond ((featurep! :completion ivy)
#'+spell-correct-ivy-fn) #'+spell-correct-ivy-fn)
@ -83,6 +83,7 @@
(#'+spell-correct-generic-fn)) (#'+spell-correct-generic-fn))
"Function to use to display corrections.") "Function to use to display corrections.")
:init
(defvar +spell-excluded-faces-alist (defvar +spell-excluded-faces-alist
'((markdown-mode '((markdown-mode
. (markdown-code-face . (markdown-code-face