bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


From: Yuan Fu
Subject: bug#19080: 24.4; wish: enable show-paren-mode to highlight matching same-level keywords
Date: Thu, 12 May 2022 15:52:14 -0700


> On May 11, 2022, at 10:36 PM, Eli Zaretskii <eliz@gnu.org> wrote:
> 
>> Cc: 19080@debbugs.gnu.org
>> From: Lars Ingebrigtsen <larsi@gnus.org>
>> 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?

That sounds interesting, and it should be easy. But what do we want the API be? 
First of all, should we make a separate mode or extend show-paren-mode? 
Extending show-paren-mode entails doing some non-trivial refactoring to 
paren.el. That is also kind of the situation for many existing packages, I 
think, that adding tree-sitter “backend” needs refactoring existing code 
non-trivially.

Yuan






reply via email to

[Prev in Thread] Current Thread [Next in Thread]