polymode / poly-org

Polymode for org-mode
57 stars 13 forks source link

General blocks support #23

Closed akater closed 4 years ago

akater commented 4 years ago

Currently, only src blocks are recognised by poly-org-innermode. Org by default applies e.g. lang's font-lock to the blocks with headers example lang. I use example lisp and example elisp extensively. There's rarely a need to edit them in my case but not in general case. Regardless, with poly-org not recognising them, it breaks the default font-lock. This patch intends to fix that.

It's not just src and example though. Org is extremely vague on this part of its syntax. I added yet another label but that was not enough to make it complete. See in-code commentary for details; at least it's better than src only. Providing a complete solution will likely take indefinite amount of time because there's no spec and it looks like everyone is fine with that.

Another problem is, :tail-matcher should depend on :head-matcher. I did not try to look into polymode and see if this is supported. If it's not, it should; rx syntax will likely make this actually tractable, in contrast to string regexps.

I extended all three entries of src but I don't know if I should have.

String regexps are replaced with rx regexps due to my personal tastes. I'm not good at any of the two syntaxes and I don't see any comparison function in elisp to check for equivalence but a couple of days of regular use suggests that everything works fine.

I added .gitattributes setting because this particular diff is affected by bad default heuristic in a chunk in poly-org.el.