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#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs Date: Thu, 3 Jun 2021 11:38:37 +0000 Message-ID: References: <86y69a9ei4.fsf@gmail.com> <87wnrcd54k.fsf@gnus.org> 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="25660"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Christoph , 7327@debbugs.gnu.org To: Lars Ingebrigtsen Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 03 13:39:20 2021 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 1lolh1-0006Qq-HP for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Jun 2021 13:39:19 +0200 Original-Received: from localhost ([::1]:40794 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lolh0-0000UR-EB for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 03 Jun 2021 07:39:18 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48122) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lolgk-0000Rw-GC for bug-gnu-emacs@gnu.org; Thu, 03 Jun 2021 07:39:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59461) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lolgj-00044l-MP; Thu, 03 Jun 2021 07:39:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lolgj-0001D0-Ju; Thu, 03 Jun 2021 07:39:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 03 Jun 2021 11:39:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7327 X-GNU-PR-Package: emacs,cc-mode Original-Received: via spool by 7327-submit@debbugs.gnu.org id=B7327.16227203274623 (code B ref 7327); Thu, 03 Jun 2021 11:39:01 +0000 Original-Received: (at 7327) by debbugs.gnu.org; 3 Jun 2021 11:38:47 +0000 Original-Received: from localhost ([127.0.0.1]:42774 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lolgU-0001CR-QB for submit@debbugs.gnu.org; Thu, 03 Jun 2021 07:38:47 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:14800 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1lolgS-0001CE-Qb for 7327@debbugs.gnu.org; Thu, 03 Jun 2021 07:38:45 -0400 Original-Received: (qmail 63089 invoked by uid 3782); 3 Jun 2021 11:38:37 -0000 Original-Received: from acm.muc.de (p4fe15a45.dip0.t-ipconnect.de [79.225.90.69]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Thu, 03 Jun 2021 13:38:37 +0200 Original-Received: (qmail 8261 invoked by uid 1000); 3 Jun 2021 11:38:37 -0000 Content-Disposition: inline In-Reply-To: <87wnrcd54k.fsf@gnus.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) 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:207943 Archived-At: Hello, Lars On Wed, Jun 02, 2021 at 10:48:11 +0200, Lars Ingebrigtsen wrote: > Christoph writes: > > Start with `emacs -Q'. Start new .c file. > > Type `typedef enum' then hit `C-j', then `{'. > > The code is indented like this: > > typedef enum > > { > > blabla > > Then try `typedef struct', `C-j', '{'. > > The code is indented like this: > > typedef struct > > { > > blabla > This behaviour is still present in Emacs 28. > Alan, is this behaving as designed, or is it a bug? It's kind of both. The issue came up on 2014-02-19 in a post from Xue Fuqiao on the CC Mode list. This behaviour has been in place since at least 2000-01-16, and I decided in 2014 that to fix the bug would result in too much chaos, with "typedef enum"s, lots of them, suddenly becoming mis-indented. The root of the problem is that the CC Mode syntactic symbol brace-list-open is used for both typedef enums (as above) and for the initialisation of structs with literals. This economy was a mistake, with the benefit of hindsight. So I think I would still rather not fix this bug, since it has at least two decades' standing. Sorry! > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no -- Alan Mackenzie (Nuremberg, Germany).