I am trying to figure out how how to replace structural elements in org-mode with glyphs/abbreviations to make them more readable. Unfortunately, I'm getting stuck on replacing a simple checkbox
(font-lock-add-keywords 'org-mode `( ("^\s*\\**\\(-\\|\\+\|[0-9]+\\|\\)\s\\(\\[X\\]\\)" (3 (progn (compose-region (match-beginning 1) (match-end 1) "") nil))) ) )
My goal is to replace the checkbox capturing group with the glyph, but no matter which group index I pick, I either get a pre-pended glyph or no glyph at all. More disturbingly, this messes with the rest of Org-mode's fontification when you toggle to
fundamental-mode and then back to
org-mode. Is this is breaking the syntax table or something? How do you avoid this happening?
I think the problem is with the complex regex capture groups. I you just code this for the
- [X] case (no OR expressions needed, one capture group), everything works and the other font-locks do not get messed up.