Subject: bug#19080: 24.4; wish: enable show-paren-mode to highlight matching same-level keywords

From: Eli Zaretskii <[email-masked]>
Date: Thu, 12 May 2022 08:36:18 +0300

> Cc: [email-masked]
> From: Lars Ingebrigtsen <[email-masked]>
> Date: Thu, 12 May 2022 03:44:43 +0200
> 
> > This starts a fresh emacs, loads the tuareg mode, enables
> > show-paren-mode, enters some ocaml code, and puts the point on a 'let'
> > keyword.
> >
> > In this situation, it would be helpful if the 'let' and corresponding
> > 'in' were highlighted in 'show-paren-match-face'.  And similarly for
> > "fun", "if", "match", and "try".
> 
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
> 
> I think this is rather beyond the scope of show-paren-mode (which is a
> pretty simple mode that just blinks parentheses, and not much more).

Indeed.

> A new different mode that relies on language semantics to identify
> these things would be nice, but I don't think there's anything
> actionable to be done here, so I'm closing this bug report.

We could perhaps add a new feature, based on tree-sitter, to highlight
a block of code, where the block is defined by PL rules, not by
parens, braces, and similar simple syntactic elements.

Yuan, WDYT?  Can this be added to the tree-sitter branch perhaps?