Improve flyspell support

+ Make flyspell more selective about what to scan in markdown buffers.
+ Don't mark duplicates when proseline or langtool are present.
+ Add set-flyspell-predicate! for seeing mode-specific word predicates.
This commit is contained in:
Henrik Lissner 2019-02-26 16:46:26 -05:00
parent d83ba452ef
commit db2949ff32
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
4 changed files with 57 additions and 6 deletions

View file

@ -20,3 +20,23 @@
(if (thing-at-point-looking-at +markdown--regex-del)
(markdown-unwrap-thing-at-point nil 2 4)
(markdown-wrap-or-insert delim delim 'word nil nil)))))
;;;###autoload
(defun +markdown-flyspell-word-p ()
"Return t if point is on a word that should be spell checked.
Return nil if on a link url, markup, html, or references."
(let ((faces (doom-enlist (get-text-property (point) 'face))))
(or (and (memq 'font-lock-comment-face faces)
(memq 'markdown-code-face faces))
(not (cl-loop with unsafe-faces = '(markdown-reference-face
markdown-url-face
markdown-markup-face
markdown-comment-face
markdown-html-attr-name-face
markdown-html-attr-value-face
markdown-html-tag-name-face
markdown-code-face)
for face in faces
if (memq face unsafe-faces)
return t)))))