diff --git a/modules/lang/markdown/autoload.el b/modules/lang/markdown/autoload.el index c4f6b8d8f..81d0185d3 100644 --- a/modules/lang/markdown/autoload.el +++ b/modules/lang/markdown/autoload.el @@ -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))) ;;