Subject: Re: bug#50766: Regexp paren pairs in query-replace-regexp prompt should be highlighted

From: martin rudalics <[email-masked]>
Date: Thu, 30 Sep 2021 18:18:02 +0200

> Indeed.  I wondered whether we had code that did the right syntax
 > marking for regexps so that this would work, but I guess not?

It's not entirely trivial: With "\(" you normally want to put the syntax
table property on the "\" but inside a character alternative you want to
put it on the "(".  So you have to re-parse the minibuffer after each
editing change.

Which means we'd have to, at the beginning of 'show-paren--default',

- check whether this is a minibuffer where we want that feature enabled,

- enable 'parse-sexp-lookup-properties' for it,

- syntactically propertize parens, brackets, braces and backslashes
   according to their positions within the regexp typed.

That's all.  What it would get us are regexps with properly highlighted
parens and proper sexp navigation.

I have written such code for Elisp buffers and can convert and simplify
it to make it work for minibuffers.  I suppose it would amount to about
100 lines to add to paren.el and would do it only if you are convinced
that it's worth the effort.  It would not handle 'blink-matching-open'.

martin