Fanael / rainbow-delimiters

Emacs rainbow delimiters mode
GNU General Public License v3.0
685 stars 33 forks source link

Rianbow Delimiters and semi-open set notation #64

Closed jsilve24 closed 3 years ago

jsilve24 commented 3 years ago

I love this package. However, I just ran into one annoying sticking point and I was looking for ideas.

I have a math equation that has a semi-open set $[0, \infty)$ and now everything below that point in the rest of the document is highlighted with mismatched delimiters...

Is there a way to tell rainbow delimiters to ignore that line? Or as issue #51 just fix it so that the mismatch is recognized to just be there and I don't get highighting in the rest of the document?

I would even be ok with just turning it off in math-environments but I have found it useful there to help me avoid mistakes so I would love to not have to part with it.

Thank you for creating/maintaining such a useful package!

Fanael commented 3 years ago

Is there a way to tell rainbow delimiters to ignore that line? Or as issue #51 just fix it so that the mismatch is recognized to just be there and I don't get highighting in the rest of the document?

Not easily, no, I'm afraid. Rainbow-delimiters is quite intentionally simply following what the Emacs syntax engine tells it — the same syntax engine that's used by {backward,forward}-sexp and show-paren-mode and everything that calls syntax-ppss and so on — both for simplicity reasons and consistency with the rest of the ecosystem. Changing that would require significant effort that's very similar to #1: not impossible, but very difficult to ensure correctness of, because there are approximately seventy five billion edge cases to consider.

However, this particular problem is at least in part caused by AUCTeX itself: I can't reproduce it in other major modes, nor in tex-mode without AUCTeX loaded.