Subject: bug#36006: electric-pair-mode fails to balance in certain cases

From: Noam Postavsky <[email-masked]>
Date: Thu, 06 Jun 2019 19:39:57 -0400

found 36006 27.0.50
tags 36006 + confirmed
quit

Dario Gjorgjevski <[email-masked]> writes:

>> I'm having trouble reproducing this; what's the exact sequence of input
>> starting from 'emacs -Q'?
>
> Run 'emacs -Q'; it opens up with the *scratch* buffer.  Now:
>
> 1. M-x electric-pair-mode <RET>
> 2. M-x html-mode <RET>
> 3. <div>

Ah, got it now, I think I was inserting before starting html-mode before.

> From my debugging, the culprit seems to be an unnecessary (or mistaken?)
> use of electric-pair--with-uncached-syntax.  I am not sure *why* exactly
> it happens, and would appreciate further insight.

It doesn't happen in emacs-26, which has the same
electric-pair--with-uncached-syntax call, so it's not just that alone.
I suspect this could be related to the recent changes to mark ">"
outside of tags with punctuation syntax (technically, <foo>a > b</foo>
is valid, only "<" needs to be escaped as &lt;).

This is kind of a pain to debug, when I stepped with edebug, it worked,
I think because stepping gives time for syntax-propertize to run.