[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15478: cc-mode does not obey electric-indent-mode
From: |
Alan Mackenzie |
Subject: |
bug#15478: cc-mode does not obey electric-indent-mode |
Date: |
Mon, 7 Oct 2013 10:30:42 +0000 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Hello, Stefan.
On Sat, Oct 05, 2013 at 09:10:01PM -0400, Stefan Monnier wrote:
> > 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.
Yes.
> 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.
:-). I think CC Mode DTRT practically 100% of the time. There haven't
been bug reports asking for the details of the electric indentation to be
improved.
> 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.
There's a difference between a feature never having been implemented, and
taking it away (even the default value) after it has. Electric
indentation was in CC Mode in the very first version I have available,
from 1992. Somebody (RMS? Barry Warsaw?) clearly thought it very
important.
> > > 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.
You're not wrong there.
> 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.
OK.
> 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?
How about aliasing `c-electric-mode' and `electric-indent-mode' and
making them buffer-local in CC Mode buffers? Then setting CC Mode's
value of `electric-indent-chars' to nil, for now, and in the medium
future (once e-i-m has percolated through to old versions and XEmacs)
integrating CC Mode into electric-indent-mode properly?
How about introducing `global-electric-indent-mode' and redefining e-i-m
to be buffer-local? Or, alternatively, leaving e-i-m as it is and
defining `local-electric-indent-mode'? What about defining a property
`no-electric-indentation' which could be set on python-mode and others?
> 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.
Would you identify (some of) these modes, please, so I can go and have a
look.
> I delayed touching at cc-mode mostly because I know you're
> very opinionated ;-)
:-).
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).
- bug#15478: cc-mode does not obey electric-indent-mode, (continued)
- bug#15478: cc-mode does not obey electric-indent-mode, Alan Mackenzie, 2013/10/09
- bug#15478: cc-mode does not obey electric-indent-mode, Josh, 2013/10/10
- bug#15478: cc-mode does not obey electric-indent-mode, Stefan Monnier, 2013/10/06
- bug#15596: Let's improve the default workings of electric-indent-mode., Alan Mackenzie, 2013/10/12
- bug#15596: Let's improve the default workings of electric-indent-mode., Stefan Monnier, 2013/10/12
- bug#15596: Let's improve the default workings of electric-indent-mode., Alan Mackenzie, 2013/10/13
- bug#15596: Let's improve the default workings of electric-indent-mode., Stefan Monnier, 2013/10/13
- bug#15478: cc-mode does not obey electric-indent-mode,
Alan Mackenzie <=
- bug#15478: cc-mode does not obey electric-indent-mode, Stefan Monnier, 2013/10/07
- bug#15478: cc-mode does not obey electric-indent-mode, Alan Mackenzie, 2013/10/07
- bug#15478: cc-mode does not obey electric-indent-mode, Stefan Monnier, 2013/10/07
- Message not available
- Message not available
- bug#15478: cc-mode does not obey electric-indent-mode, Alan Mackenzie, 2013/10/03
- bug#15478: cc-mode does not obey electric-indent-mode, Andreas Röhler, 2013/10/03
bug#15478: cc-mode does not obey electric-indent-mode, Alan Mackenzie, 2013/10/03