bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typede


From: Alan Mackenzie
Subject: bug#7327: 24.0.50; cc-mode: default indentation inconsistent with typedefs
Date: Thu, 3 Jun 2021 11:38:37 +0000

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 via email to

[Prev in Thread] Current Thread [Next in Thread]