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