Fanael/rainbow-delimiters

Customize highlighted delimiters (in Org files)

scolobb opened this issue · 5 comments

After an Emacs update, I realized that rainbow-delimiters started to highlight < and >. When I am writing math, this is rather inconvenient, because something like k > 1 highlights the > and all the following delimiters as mismatched.

Is there a way to customize which delimiters are highlighted?

I have just realized that this behavior seems to be specific to Org files. The characters < and > are not highlighted in text mode, Lisp interaction mode, Racket mode, etc.
2020-08-31_23-40

rainbow-delimiters relies solely on the syntax table information provided by the major mode. If org-mode incorrectly sets < and > as a bracket pair even when they're not, it's a bug in org-mode and should be fixed there, especially since it has the potential to break any code that uses syntax information directly or indirectly (e.g. through syntax-ppss).

There is an ancient, moribund branch, see #1, that lets you control what delimiters are considered by rainbow-delimiters, but it hasn't been updated for the past six years, and it's incomplete enough that it's highly unlikely it will ever land unless someone puts in the (serious!) effort require to make it fully functional.

Thank you @Fanael for the quick and detailed answer. I'll contact the maintainers of Org-mode.

One last question: when you say "Org-mode sets < and > as a bracket pair", do you mean that there is some variable which lists the bracket pairs? From the rest of your answer I understand that this is not so simple, but I would like to have a confirmation of my hypothesis.

It's controlled by syntax tables and syntax properties: https://www.gnu.org/software/emacs/manual/html_node/elisp/Syntax-Tables.html

Thank you @Fanael ! This part of the manual is what I needed, but didn't have the keywords.