Fanael / rainbow-delimiters

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

Mismatched parenthesis in latex-mode #51

Closed haji-ali closed 3 years ago

haji-ali commented 4 years ago

I noticed the following behaviour when having an expression like:

( ] ( ) { { } } { } [ { [ ] } ]

in latex-mode. Here the first ( is mismatched with ] and helpfully has the face rainbow-delimiters-unmatched-face (denoted in bold). However, after this expression all subsequent first level { and [ has the unmatched face, even though they should be matched, while ( are correctly matched.

Is this intentional? Is there a way to avoid this? I sometimes have to have an unmatched parenthesis in the middle of the document making rainbow-delimiters useless for the rest of the document.

I am using Emacs 26.3 and the latest commit of auctex.

Fanael commented 3 years ago

I'm very sorry for missing this issue report. I only saw it a year later after somebody else mentioned it.

Is this intentional? Is there a way to avoid this?

It's what the Emacs syntax engine — the same syntax engine that's used by {backward,forward}-sexp and show-paren-mode and everything that calls syntax-ppss and so on — tells rainbow-delimiters what it thinks the current syntactical state of parentheses is. As for why it thinks so, I honestly have no idea. It appears it's caused by AUCTeX itself: I can't reproduce it in other major modes, nor in tex-mode without AUCTeX loaded.