bug#81551: 31.0.91; Electric-pair-mode should support Java's text blocks in java-mode, java-ts-mode

João Távora <[email protected]> Wed, 5 Aug 2026 15:58:29 +0100
Newsgroups gmane.emacs.bugs
Message-ID <CALDnm53R4KMkXOmH5BZXJ8aY_2=gnnG3swUzeRjhLYmBBt6gQQ@mail.gmail.com>
João Távora

On Wed, Aug 5, 2026, 14:12 Sean Whitton <[email protected]> wrote:

> Rudi Schlatte [05/Aug  3:06pm +02] wrote:
> > Something like this?  Code adapted from python.el.
>
> Ah, just a sec, we are adapting code from a non-tree sitter mode to a
> tree sitter mode, which is probably not right.  We should probably be
> doing this using data from the tree sitter parser.
>
> > (I still think adding (""" . """) to `electric-pair-pairs’ would be
> > more satisfying ;) )
>
> Possibly yes, but we'd need one of the electric-pair-mode people to
> review it.  João, does this seem likely to be okay to you?
>

I'm not maintaining this anymore, but this seems like a poor solution. That
variable has no support for balancing and if you add it to the default
value you probably break lots of stuff. I don't know the context though.

Major mode, TS or not, should contribute as much information as they can to
Emacs long-standing syntax tracking system, syntax-ppss and friends. Ask
Stefan about it. Anyway, that's what e-p-m draws on to make pairing and
skipping decisions and it's almost always the more correct approach.

Python has some extra quirks/hacks for very complex paired delimiters,
replicating those should be avoided.

Joao