From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#42319: 28.0.50; c-mode issue with electric-pair-mode Date: Sun, 12 Jul 2020 10:54:59 +0000 Message-ID: <20200712105459.GA10951@ACM> References: <20200711102653.35732.qmail@mail.muc.de> <20200711131512.gur5wyzn5nlhibst@ergus> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12780"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 42319@debbugs.gnu.org To: Ergus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jul 12 12:56:13 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1juZeW-0003DF-9R for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Jul 2020 12:56:12 +0200 Original-Received: from localhost ([::1]:42864 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1juZeU-0004sH-U5 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 12 Jul 2020 06:56:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1juZeM-0004s9-Ol for bug-gnu-emacs@gnu.org; Sun, 12 Jul 2020 06:56:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:33923) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1juZeM-0002Lx-Fw for bug-gnu-emacs@gnu.org; Sun, 12 Jul 2020 06:56:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1juZeM-0007uX-Dc for bug-gnu-emacs@gnu.org; Sun, 12 Jul 2020 06:56:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 12 Jul 2020 10:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 42319 X-GNU-PR-Package: emacs Original-Received: via spool by 42319-submit@debbugs.gnu.org id=B42319.159455130930347 (code B ref 42319); Sun, 12 Jul 2020 10:56:02 +0000 Original-Received: (at 42319) by debbugs.gnu.org; 12 Jul 2020 10:55:09 +0000 Original-Received: from localhost ([127.0.0.1]:45469 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1juZdV-0007tP-0U for submit@debbugs.gnu.org; Sun, 12 Jul 2020 06:55:09 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:38592 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1juZdT-0007sm-48 for 42319@debbugs.gnu.org; Sun, 12 Jul 2020 06:55:07 -0400 Original-Received: (qmail 4646 invoked by uid 3782); 12 Jul 2020 10:55:00 -0000 Original-Received: from acm.muc.de (p4fe15904.dip0.t-ipconnect.de [79.225.89.4]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Sun, 12 Jul 2020 12:54:59 +0200 Original-Received: (qmail 11018 invoked by uid 1000); 12 Jul 2020 10:54:59 -0000 Content-Disposition: inline In-Reply-To: <20200711131512.gur5wyzn5nlhibst@ergus> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:182940 Archived-At: Hello, Ergus. On Sat, Jul 11, 2020 at 15:15:12 +0200, Ergus wrote: > On Sat, Jul 11, 2020 at 10:26:53AM -0000, Alan Mackenzie wrote: > >This happens because of the missing semicolon after the class. CC Mode > >indents the otherwise empty line as a 'topmost-intro-cont line, > I supposed so. > >since it appears still to be within the class. > But this is an issue right? because after that } it is already out of > the class; ... even without the `;` there is not a class scope to indent > right? The same applies to nested classes. The same also applies to structs and unions. Each of these constructs is incomplete without the closing semicolon. > Actually AFAIK without the `;` there is a syntax error if we insert > anything else except for inline class/variable declarations like: Precisely! > class A { > } var; > or > typedef class A { > } type_A; > But then the new line after the } should never be added? You could well be right, here. I'd have to check carefully all the things that can generate a 'class-close syntax before changing the defaults. > >One workaround for this is to > >configure CC Mode not to insert a newline after this particular type of > >brace. For example > >(push '(class-close before) c-hanging-braces-alist) > >, to try it out (it's a buffer local variable). > This works, thanks. I think that this should be the default as it is the > most general/expected behavior and doesn't insert extra > newline/spaces. This work around seems to be a cleaner solution than the > cleanup ;p because it works easier for: > ========= > For: }; > class A { > }; > # > ========= > And for: } var; > class A { > } var; > # > I think the user never wants this: > ========== > class A { > } > ; > # > ========= > or > ========= > class A { > } > var; > # > And for sure not this: > ========= > class A { > } > var; > # > ========= > But I am probably wrong. My experience is that there's virtually _no_ form of indentation which no user wants. But I think I'll look at changing that default. > >> The problem is actually worst if defun-close-semi is in c-cleanup-list > >> because it doesn't work. > >That surprises me. It works for me, here. What happens/fails to happen > >in these circumstances? > Ohh, my bad. I forgot to add defun-close-semi when using -Q for > reporting. So please forget it and forgive me. No problems! Far better than there actually being a bug. ;-) > >> I need to remove the extra spaces first to make it work. > >That indeed feels like a bug. Could you perhaps post your CC Mode > >configuration (generated by C-c C-b), please, which should help me to > >reproduce the bug. > I discovered myself error with this... very useful. Thanks. > So probably if you don't think that the extra indentation is an issue > you can close this bug. I think that indentation is correct, even if a bit awkward. That's why that cleanup is available. So, yes, I'll close the bug, thanks. > Off-topic: > I reported another issue (bug#42270) related with attributes and > indentation. did you see it? Yes, I started working on it on Thursday. Most of that time, I've "just been an hour away from finishing it", so it didn't feel necessary to acknowledge the bug. That was a mistake, sorry. Actually, there're quite a few tricky things in there to sort out and clean up, so it could take a few days yet. > Very Thanks, > Ergus -- Alan Mackenzie (Nuremberg, Germany).