Languages like Erlang and Elixir use << >> for binaries and bit-string syntax, but they also use the classical < and > for comparison operators as well as -> and <- in list comprehensions.
Emacs syntax-table has the ability to identify pairs of characters. The ( ), [ ] and { } character pairs are identified in the syntax table as character pairs.
This allows the following very handy behaviours:
forward-sexpandbackward-sexpcommands to navigate to the matching pair,er/expand-regionto quickly mark all text with the pair.
Adding the < > pair in the syntax table causes problems with the other uses of the < and > characters because Emacs will see unbalanced pairs in statements such as if (a < 3).
Question:
Is there a way to solve this problem and get the ability to use commands such as forward-sexp and er/expand-region to see the << >> as balanced pairs when they are working on them, without adding balanced pair-syntax to < and >?
For instance, to overcome the problem, would it be a good idea to dynamically change the syntax of < and > by modifying the syntax table just around the execution of these commands when they are applied on those characters (using advice or re-writing a function that calls them)?