Fix #4407: regression in +markdown-flyspell-word-p

Preventing misspelled words from being highlighted.

May address #4420
This commit is contained in:
Henrik Lissner 2020-12-13 00:19:36 -05:00
parent fc955f4100
commit 2e61fbbf08
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -2,31 +2,37 @@
;;;###autoload
(defun +markdown-flyspell-word-p ()
"Return t if `flyspell' should check work before point.
"Return t if `flyspell' should check word before point.
Used for `flyspell-generic-check-word-predicate'. Augments
`markdown-flyspell-check-word-p' to:
Used for `flyspell-generic-check-word-predicate'. Like
`markdown-flyspell-check-word-p', but also:
a) Do spell check in code comments and
b) Inhibit spell check in html markup"
(and (markdown-flyspell-check-word-p)
(save-excursion
(goto-char (1- (point)))
(if (or
;; Spell check in code comments
(not (and (markdown-code-block-at-point-p)
(markdown--face-p (point) '(font-lock-comment-face))))
;; Don't spell check in html markup
(markdown--face-p (point) '(markdown-html-attr-name-face
markdown-html-attr-value-face
markdown-html-tag-name-face)))
(prog1 nil
;; If flyspell overlay is put, then remove it
(when-let (bounds (bounds-of-thing-at-point 'word))
(cl-loop for ov in (overlays-in (car bounds) (cdr bounds))
when (overlay-get ov 'flyspell-overlay)
do (delete-overlay ov))))
t))))
a) Performs spell check in code comments and
b) Inhibits spell check in html markup"
(save-excursion
(goto-char (1- (point)))
(if (or (and (markdown-code-block-at-point-p)
(not (or (markdown-text-property-at-point 'markdown-yaml-metadata-section)
(markdown--face-p (point) '(font-lock-comment-face)))))
(markdown-inline-code-at-point-p)
(markdown-in-comment-p)
(markdown--face-p (point) '(markdown-reference-face
markdown-markup-face
markdown-plain-url-face
markdown-inline-code-face
markdown-url-face
markdown-html-attr-name-face
markdown-html-attr-value-face
markdown-html-tag-name-face)))
(prog1 nil
;; If flyspell overlay is put, then remove it
(let ((bounds (bounds-of-thing-at-point 'word)))
(when bounds
(cl-loop for ov in (overlays-in (car bounds) (cdr bounds))
when (overlay-get ov 'flyspell-overlay)
do
(delete-overlay ov)))))
t)))
;;