[Top][All Lists]

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

Re: enum indentation in GNU style in c-mode is inconsistent

From: Alan Mackenzie
Subject: Re: enum indentation in GNU style in c-mode is inconsistent
Date: Mon, 27 Jul 2015 10:55:15 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

Hello, David.

On Sun, Jul 26, 2015 at 04:35:43PM -0500, David McMackins wrote:
> As pointed out in an e-mail from last year, the GNU style C indentation
> in Emacs is wrong for enumerated types. The user who wrote it said that
> the bug should not be fixed because it would case creeping changes in
> the GNU code base over a long period of time.

That would almost certainly have been me.

> While that is true, one large problem is inconsistency. I have gotten
> Emacs into a state where the enum indentation would actually be true to
> GNU coding standards through some messing about with opening and closing
> braces in a header file, ....

Sorry, but there're too many prepositions in that paragraph for me to be
sure of your meaning.

By "gotten Emacs into a state where ..." do you mean that you've got the
indentation in a particular buffer to be standards-correct, or that
you've configured C Mode to indent standards-correctly when it does
indentation (e.g. with <tab>)?

> ...., but if I reload c-mode, it goes back to the way it was before.

Restarting C Mode doesn't change any existing indentation, so by "it",
do you mean "the C mode configuration of indentation operations"?

> I do think this should be fixed, since one of the primary reasons I use
> Emacs is its correct indentation in many C styles.

As I explained last year, I don't want to correct this bug in GNU style
indentation, because that would make a (very) large quantity of existing
source code's indentation unstable.

I'm guessing here, but I think what you've done is, after starting C
Mode, you've configured indentation of enums to be standards-correct
on-the-fly.  And that each time C Mode is (re-)started, this on-the-fly
configuration is lost.  This is naturally irritating and tedious.

What I think the best thing for you to do here is to create a CC Mode
style of your own, which "inherits" from the GNU style, and sets its own
indentation for enums.  This would be in your .emacs, and once set up,
would work without further tedium.  The setting up of styles is
described in the CC Mode manual, in particular you should read the pages
"Config Basics", "Styles" and some of its subpages, and there is an
example of setting up a style in "Sample .emacs file".

Alternatively, you could clarify the points here, then ask me to create
the style for you.  :-)

> Happy Hacking,

and yourself too, Sir!

> David E. McMackins II
> Associate, Free Software Foundation (#12889)

> www.mcmackins.org www.delwink.com
> www.gnu.org www.fsf.org

Alan Mackenzie (Nuremberg, Germany).

reply via email to

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