From 699e18b7f1b83f3a612a349ab95889487e7f22e6 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Sat, 27 Mar 2021 22:05:54 -0400 Subject: [PATCH] Fix excluded faces being spell-fu checked anyway Due to spell-fu--faces-at-point conducting face detection that doesn't penetrate overlays. This should be PRed/reported upstream at some point. --- modules/checkers/spell/config.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/modules/checkers/spell/config.el b/modules/checkers/spell/config.el index f72713b26..0423872a0 100644 --- a/modules/checkers/spell/config.el +++ b/modules/checkers/spell/config.el @@ -135,7 +135,22 @@ (cmds! (memq 'spell-fu-incorrect-face (face-at-point nil t)) #'+spell/correct)) + ;; TODO PR this fix upstream! + (defadvice! +spell--fix-face-detection-a (orig-fn &rest args) + "`spell-fu--faces-at-point' uses face detection that won't penetrary +overlays (like `hl-line'). This makes `spell-fu-faces-exclude' demonstrably less +useful when it'll still spellcheck excluded faces on any line that `hl-line' is +displayed on, even momentarily." + :around #'spell-fu--faces-at-point + (letf! (defun get-char-property (pos prop &optional obj) + (or (plist-get (text-properties-at pos) prop) + (funcall get-char-property pos prop obj))) + (apply orig-fn args))) + (defadvice! +spell--create-word-dict-a (_word words-file _action) + "Prevent `spell-fu--word-add-or-remove' from throwing non-existant +directory errors when writing a personal dictionary file (by creating the +directory first)." :before #'spell-fu--word-add-or-remove (unless (file-exists-p words-file) (make-directory (file-name-directory words-file) t)