-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issues with flyspell mode in code blocks #311
Comments
Thanks for the report, however, I can't reproduce this. I tried first with my usual local configuration, which enables flyspell during my markdown-mode hook. Then I tried starting from |
I would assume (maybe I'm wrong), that when you type the code block symbol-by-symbol (instead copying and pasting is as a whole), then until the closing ticks have matched the opening ticks, it is still not recognized as a code block by Font Lock, and the corresponding text properties (e.g., My suggestion is to define a function like (defun markdown-remove-flyspell-overlays-in (begin end)
"Remove Flyspell overlays in region between BEGIN and END."
(and (bound-and-true-p flyspell-mode)
(fboundp 'flyspell-delete-region-overlays)
(flyspell-delete-region-overlays begin end))) This function should be plugged into the Font Lock machinery and called after a code block (or other constructs, which should not be spell-checked) is fontified with the boundaries of this block. |
I yanked the code block in, so it was recognized immediately, so this is probably why I couldn’t reproduce. I’ll double check. Thanks Dmitry for the function. |
I use a similar function in the TaskPaper mode (sorry for the shameless plug) to remove Flyspell overlays from the hashtags after their fontification. It does the job without any fuss. |
I have merged #501. Please check latest version. |
Code in code blocks is incorrectly treated as spelling error by Flyspell.
Expected Behavior
Code in code blocks is never treated as spelling error.
Actual Behavior
Code in code blocks is occasionally treated as spelling error (see reproduction steps below).
Steps to Reproduce
"aaa" and "bbb" will now get the red Flyspell underline because they are spelling errors, but Flyspell should ignore code. Interestingly,
markdown-flyspell-check-word-p
returns nil inside the code block, i.e. it's detected correctly. Saving and then reverting the buffer using M-x revert-buffer doesn't help. Only turning Flyspell mode off and on again (by hitting M-x flyspell-mode twice) works.Software Versions
The text was updated successfully, but these errors were encountered: