I found this piece of code to change org-mode list elements from dashes (-) to circles (•):
(font-lock-add-keywords 'org-mode
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region (match-beginning 1) (match-end 1) "•"))))))
It works wonderfully, but I cannot figure out how to change the color of the circle to red. I tried reading the documentation of font-lock-add-keywords, but the syntax seems quite cryptic to me. Any help, pointers towards more information, or suggestions on how to achieve what I want would be most welcome.
EDIT:
Based on NickD's comment and on a blog post by Kitchin on colorizing strings, I ended up with the following:
(font-lock-add-keywords
'org-mode
'(("^ *\\([-]\\) "
(0 (prog1 () (compose-region
(match-beginning 1)
(match-end 1)
(propertize "•" 'font-lock-face '(:foreground "red"))))))))
But that doesn't seem to do the trick. I guess the compose-region
function must be ignoring any text properties, as inserting the propertized string directly in the buffer does work.
Any help is highly appreciated.