Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matching escaped bracket in Wolfram-mode #14

Closed
johngarg opened this issue May 12, 2015 · 2 comments
Closed

Matching escaped bracket in Wolfram-mode #14

johngarg opened this issue May 12, 2015 · 2 comments

Comments

@johngarg
Copy link

In Wolfram Mathematica code, special symbols (such as the Greek letters) are encoded as \[kappa]. The rainbow-delimiters package correctly identifies the ending ] as a closing bracket; however, as the first one is 'escaped' it fails to match the open bracket. This causes rainbow-delimiters to highlight nearly all unbalanced brace/brackets.

Short of disabling rainbow-delimiters entirely, is it possible to get rainbow-delimiters to ignore the matching brackets in this case? For example, get it to ignore any \[...] pattern?

@Fanael
Copy link
Owner

Fanael commented May 12, 2015

is it possible to get rainbow-delimiters to ignore the matching brackets in this case? For example, get it to ignore any \[...] pattern?

Yes. It requires, however, one of the following:

  1. Cooperation from the major mode, in the form of making it so the closing bracket is not seen by parse-partial-sexp as one, for example, by using syntax-table text properties. This is the best way, and will make all other code relying on parse-partial-sexp and similar functions just work.
  2. A workaround that sets the relevant text properties while not being a part of the major mode, but behaves more or less the same as if it were. Should be easy to write, but don't expect it to be merged into rainbow-delimiters: I realized long ago that adding hacks that work around major mode issues is a fool's errand. There's just too many ways a major mode can be subtly broken.
  3. If you want it to be done entirely within rainbow-delimiters, you can help with Ignore blacklisted delimiters altogether. #1. Beware: dragons abound.

@ghost
Copy link

ghost commented Jul 10, 2021

Hi I'm trying to figure out how to make rainbow-delimiters work for latex-mode (not auctex), where braces have to be escaped.

For example:

P(\{a, b\}) = \{ \{\}, \{a\}, \{b\}, \{a, b\} \}

You can imagine when writing even more complicated sets it can get gnarly.

If you could point me towards learning more about syntax-table and such it would be a huge help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants