Subject: bug#15478: cc-mode does not obey electric-indent-mode

From: Stefan Monnier <[email-masked]>
Date: Sat, 05 Oct 2013 21:10:01 -0400

> The default for CC Mode must be on, otherwise automatic indentation
> is broken.

IIUC your notion of "automatic indentation" is that the text is kept
indented without the user hitting TAB, just as a side-effect of editing
the text.

Emacs has never provided this feature in any mode that I know, cc-mode
included.  Some major modes (such as CC-mode) try to provide some vague
approximation of it, using "electric keys" that trigger indentation
"often enough" that it works more or less OK in some common cases.

But while CC-mode has been doing that for "ever", it's not nearly as
important as you claim, as demonstrated by all the other major modes
that don't even try to do that.  *You* like this feature, and indeed
you're not alone.  But it has nothing to do with the language being
edited (other than the fact that the language doesn't make it completely
impossible, as is the case in Python).

For people who don't like electric-indent-mode, CC-mode's
c-electric-flag sucks just as much.

> > Please, let's keep this bug-report's focus: making cc-mode obey
> > electric-indent-mode.  Discussion of default setting of
> > electric-indent-mode belongs elsewhere.
> These two things are inextricably entangled.

No they're not.  And I think it's blatantly obvious, even to you.
I understand that simply to mean that you do not want CC-mode's default
behavior to change.

So, for the sake of it, from here on, let's please continue this
discussion under the premise that electric-indent-mode will be enabled
by default.

The core is then: how should we make cc-mode integrate better with Emacs
and use the generic electric-*-mode functionality instead of
rolling its own.

For the record: CC-mode is not the only major mode in this boat.
I've already converted several major modes to use electric-indent-mode,
and for some of them this also involved changing the default behavior.
I delayed touching at cc-mode mostly because I know you're
very opinionated ;-)

        Stefan