Subject: bug#50236: 27.2; electric-pair-mode is inconvenient in comint

From: Augusto Stoffel <[email-masked]>
Date: Sat, 28 Aug 2021 12:17:29 +0200

In comint buffers, electric pair mode should only look at the current
input region to decide whether to skip over a closing bracket or add a
new one.  Otherwise, it gets confused about mismatched delimiters in
previous inputs or outputs.

To give an example, if I enter, in a fresh shell

    X='('

at the first prompt, and then type “())” in the second prompt, I get
the following sequence of states (where | indicates the point)

    |
    (|)
    ()|)
    ())|

where I would instead expect the obvious:

    |
    (|)
    ()|
    ())|