Make paren-matching work in pretty-printed Core
When debugging GHC I spend a lot of time looking at Core, and sometimes really big (100M+) files full of pretty-printed Core.
So it is absolutely essential that the "find matching bracket" algorithm in Emacs works -- often the matching brace or bracket might be thousand of lines away.
And it usually does. But it can be confused by literal strinngs. I have lost several hours this morning puzzling over what appeared to be mis-matched brackets, but was actually to do with literal strings. Here is an example:
case x_XcM of wild_XcN a{
__DEFAULT ->
eta_smeo
(TrivialError
@Text
@MMarkErr
(I# bx_Xcz)
eta1_sjTA)
wild_Xcx;
']'# ->
eta_smel
((o_siBs, dlabel_smeh), eta_smei)
(State
@Text
@MMarkErr
cs_XcK
(+# bx_Xcz 1#)
pst_XcA
de_XcB)
lvl_smhd
}
That literal character ']'
totally messes up the bracket-matching algorithm.
It took me a ridiculously long time to figure out what was going wong, because the matching parens were very far apart. Arrgh!
It's simple to fix: just add an escape: '\]'
. We'd have to make this part of GHC's
pretty-printing of strings and characters.
Would this be acceptable? If so could anyone help me get it done?