-
Notifications
You must be signed in to change notification settings - Fork 163
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
match block constructs in single pass #95
match block constructs in single pass #95
Conversation
Thanks! I will take a closer look. I skimmed the patch and saw the new test called |
That's totally possible. I was never able to reproduce that one but it definitely makes sense. |
I wasn't able to reproduce that one either. "Static" font lock has always been pretty reliable, but sometimes I've noticed that "dynamic" font lock (updating on the fly while editing) occasionally does get confused about GFM code blocks. My sense is that these dynamic inconsistencies are the underlying source for that issue. I've been testing this patch and so far it seems very solid! |
I ran into an error with tilde fenced code blocks:
Upon
My best guess is that one of the matching functions isn't returning values according to the specs:
|
I made an assumption in |
Ok, this is a little bit more complete; I hadn't thought about the case where there was no newline in between fences:
And was also getting wonky behavior when there was a single newline in between fences. |
Great, that's fixed now. Thanks. One more thing related to typing in code blocks. Suppose I type in the following:
The face for the beginning and ending backquotes is set, but not for the contents (which should have |
I'm not sure I see what you're saying -- it seems to work on my end, on both my config and a bare emacs. Do you mean |
Sorry--it was late and my Markdown wasn't rendered correctly. The text to type should have been this (the backquotes were missing):
It matters that this is typed in, as opposed to using the GFM code block insertion command. After I type the third opening backquote, the opening is propertized and the correct face is applied. We have an I've tried to write test cases for such dynamic issues before, but I haven't managed to get them to work. If you open the file and run markdown-mode it would work fine, but as you're typing there is an issue. |
Sorry about that, I didn't understand the intricacy with "typing" it in. You're right that what you're describing currently does work on master. I think this is because the text properties for the end of code blocks don't extend to the newline after a code block. I will investigate and try to write a test case which measures this behavior. |
I'll squash these commits once you give the ok on this. I thought it would be easy to make a test case demonstrating that dynamic behavior, but it turns out font-lock is still halfway a mystery to me. In any case, what was happening was that although syntax propertizing was happening correctly using |
This works for me now. Thanks for sorting this out. If you could squash and also rebase on the latest master, that would be perfect. |
20c3359
to
453055d
Compare
Improve on jrblevin#91 by increasing speed of matching block constructs, and allow them to be nested within each other, by matching all of them in a single pass. - Ensure font locking of block constructs is predicated solely on text properties. - Add "language" field to tilde fence opening regexp. - Make `test-markdown-font-lock/pandoc-yaml-metadata` pass. - Add `markdown-font-lock-extend-region-function` and rework `markdown-syntax-propertize-extend-region` to stretch repropertization/refontification to all of a code block. - Add test cases for fenced block conditions.
453055d
to
e72bd3f
Compare
Done. |
Improve on #91 by increasing speed of matching block constructs, and
allow them to be nested within each other, by matching all of them in a
single pass.
properties.
test-markdown-font-lock/pandoc-yaml-metadata
pass.It's a lot of code, sorry. I tried to cut it down as much as possible, since what I'm trying to do isn't actually too hard. If you can see ways to slim it, I'll spend some time cutting it down.