unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: Christoph <cschol2112@googlemail.com>, 7327@debbugs.gnu.org
Subject: bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs
Date: Thu, 3 Jun 2021 11:38:37 +0000	[thread overview]
Message-ID: <YLi/Pdi02GNd1rWx@ACM> (raw)
In-Reply-To: <87wnrcd54k.fsf@gnus.org>

Hello, Lars

On Wed, Jun 02, 2021 at 10:48:11 +0200, Lars Ingebrigtsen wrote:
> Christoph <cschol2112@googlemail.com> 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).





  reply	other threads:[~2021-06-03 11:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-03 23:25 bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs Christoph
2016-09-08  4:57 ` Alex
2021-06-02  8:48 ` Lars Ingebrigtsen
2021-06-03 11:38   ` Alan Mackenzie [this message]
2021-06-04  8:32     ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YLi/Pdi02GNd1rWx@ACM \
    --to=acm@muc.de \
    --cc=7327@debbugs.gnu.org \
    --cc=cschol2112@googlemail.com \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).