Open ghost opened 10 years ago
I'll leave it to @Fanael to comment authoritatively, but I believe that the syntax table will know the truth about how to interpret a particular occurrence of ?)
. rainbow-delimiters
already uses info from the syntax table to help do the right thing: this is probably a case where a simple regexp is being relied upon too heavily.
I believe that the syntax table will know the truth about how to interpret a particular occurrence of
?)
.
It won't. Go ahead and see what syntax-ppss
returns at
(foo? ?) ?\))
^^^^ ^
In fact, (aref (syntax-table) ?\?)
is (3)
, which means )
is just a symbol, with no additional flags. From syntax table POV, ?
is basically the same as, say, -
.
When I tried to solve this problem to fix Fanael/highlight-quoted#1, I came to the conclusion that to handle everything correctly you need to implement pretty much the Emacs Lisp reader, working in reverse.
I'm afraid that unless somebody can show me I'm wrong and there's no need for the reader in reverse, all I can do is to wait for a patch to magically appear.
Note to self: my Lisp shall use #"a"
as the character literal syntax.
My guess would be that if it is possible to check for ' ?)' versus '?)' then it would work, but i'm by no means sure.
Not really, consider:
;; I know ?\( is recommended instead, but ?( is still pretty commonly used.
(pcase foo
(?(
(bar))
(?)
(qux)))
Development has moved to https://github.com/Fanael/rainbow-delimiters. If the issue still persists, please report it there.
Alright, so I took a quick look at why this is happening and I don't know if there is an easy fix. Basically, if you do(in emacs lisp):
Rainbow delimiters reads ?) as emacs lisp's character syntax and doesn't treat the ) as a pair, causing the color highlighting to break.
This may be hard to fix, I am not familiar enough with emacs lisp to know all the rules of when ?) should be interpreted as the character ) and when it should be interpreted as a delimiter.
My guess would be that if it is possible to check for ' ?)' versus '?)' then it would work, but i'm by no means sure. Basically the idea would be in perl regex form that you'd ignore
but not