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

From: Stefan Monnier <[email-masked]>
Date: Mon, 30 Sep 2013 14:23:55 -0400

> I'm not familiar enough with these other modes to be able to say.  But
> what exactly are you saying here?  Even if CC Mode is not different from
> the other modes, that doesn't change the fact that electricity must be
> enabled by default in CC Mode.

I don't see anything that requires electric-indent to be enabled by
default in cc-mode.  Most major modes don't enable electric-layout by
default (and AFAICT most users care more about "indent after newline",
which cc-mode doesn't enable anyway).

So, yes, I do think that the default behavior of cc-mode should be changed.

> Perhaps not, but there is a good deal of thinking and scheming needed
> before this can be done.  For CC Mode simply to `and' in the variable
> electric-indent-mode when testing c-electric-flag would cause breakage,
> confusion and bug reports.  Or perhaps should CC Mode set a buffer-local
> copy of e-i-m to t at initialisation?  Should C-c C-l be extended also
> to toggle e-i-m?  And so on....

There are several separate issues, and they can be handled somewhat
separately.  First, let's see what we'd ultimately want to have as
behavior, disregarding backward compatibility and preservation of
previous behaviors.  For me, I'd like cc-mode to do as little as
possible besides adding ?\;, ?\{, and ?\} to electric-indent-chars.
I'm not convinced there's a real need for a key binding that toggles
electric-indent buffer-locally, but if there is, then I don't see why
cc-mode needs it more than any other mode.

        Stefan