Subject: bug#36423: 27.0.50; electric-pair-mode not working properly depending of file content.

From: Alan Mackenzie <[email-masked]>
Date: Tue, 2 Jul 2019 13:36:41 +0000

Hello, Ergus.

On Fri, Jun 28, 2019 at 21:01:31 +0200, Ergus wrote:
> In electric-pair-mode there are some files where inserting one " does
> not insert the pair ". But on the other hand when I try to insert a
> second " it inserts a pair for it so it ends with """.

> It does not happen when the file is empty but for me it happens with
> this file content.

> ---------------------------------------
> #ifndef _SparseMatrix_functions_hpp_
> #define _SparseMatrix_functions_hpp_

> #endif
> --------------------------------------- 

I've just committed a fix to master which fixes some of the problem.
(For the rest of the problem, see bug #36474.)

> The behavior changes sometimes inserting a new line instead of the first
> ", or just not inserting any pair at all. This looks like an issue in a
> backward search for a pair or something. Because it changes if withing
> the define region or not.

Yes.

> When a region is active there is not issue and the quotes are inserted
> in pairs around the region as expected.

Also yes.

> This was reproduced with:

> emacs -Q file.hpp
> M-x electric-pair-modes

> In GNU Emacs 27.0.50 (build 4, x86_64-pc-linux-gnu, GTK+ Version 3.24.9)
>  of 2019-06-28 built on Ergus
> Repository revision: cb182ce6f8d2fa6e1509252fecc2b0e504e36d63
> Repository branch: master
> System Description: Arch Linux

Thanks for taking the trouble to report this.  It should be somewhat
better, now.  Just a small point: it would have been helpful if you'd
mentioned C++ Mode in the Subject: (or even explicitly in the message).

-- 
Alan Mackenzie (Nuremberg, Germany).