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

From: Ergus <[email-masked]>
Date: Wed, 3 Jul 2019 21:32:00 +0200

Hi Alan:

Sorry for the bother again. After the fix you did, the "" issue is
better, but now there are new issues with the {} when I use pragmas for
example.

I attached you a picture (because this is the easier way to explain it)

As you can see it does not recognize the pairs correctly in one
case. And in the other it does not recognize the () at all. (Maybe the
second is not exactly the same issue) 

The main problem is that because of this the automatic indentation is
affected.

An interesting thing is that in the line 136 out(vout[0; size]) it works
correctly. Maybe it has to do with the \ in the pragmas?

Thanks for the previous patch and in advance for the next ;)
Ergus

On Tue, Jul 02, 2019 at 01:36:41PM +0000, Alan Mackenzie wrote:
>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).