From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#15478: cc-mode does not obey electric-indent-mode Date: Mon, 7 Oct 2013 10:30:42 +0000 Message-ID: <20131007103041.GB3859__39533.2875581973$1381142449$gmane$org@acm.acm> References: <20130929091017.GA3161@acm.acm> <20131002200737.GA3895@acm.acm> <524CDA92.1030107@dancol.org> <20131003094543.GA3211@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1381142439 8095 80.91.229.3 (7 Oct 2013 10:40:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 7 Oct 2013 10:40:39 +0000 (UTC) Cc: gnu-emacs-bug@moderators.isc.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Oct 07 12:40:42 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VT8Ez-00067R-FP for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Oct 2013 12:40:41 +0200 Original-Received: from localhost ([::1]:58673 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT8Ey-0006HK-PX for geb-bug-gnu-emacs@m.gmane.org; Mon, 07 Oct 2013 06:40:40 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60156) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT8Ei-0006FC-7z for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 06:40:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT8EY-0005gW-8t for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 06:40:24 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:51169) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT8EN-0005Uo-8Y; Mon, 07 Oct 2013 06:40:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VT8EM-0003do-7R; Mon, 07 Oct 2013 06:40:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Mon, 07 Oct 2013 10:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15478 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.138114238513952 (code B ref -1); Mon, 07 Oct 2013 10:40:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 7 Oct 2013 10:39:45 +0000 Original-Received: from localhost ([127.0.0.1]:59461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT8E3-0003cr-Uh for submit@debbugs.gnu.org; Mon, 07 Oct 2013 06:39:44 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:58288) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VT8E1-0003ci-24 for submit@debbugs.gnu.org; Mon, 07 Oct 2013 06:39:41 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT8Dq-0005Jb-Qx for submit@debbugs.gnu.org; Mon, 07 Oct 2013 06:39:40 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:50875) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT8Dq-0005JX-Np for submit@debbugs.gnu.org; Mon, 07 Oct 2013 06:39:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59996) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT8Di-00063B-KQ for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 06:39:30 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VT8Da-0005Fk-GA for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 06:39:22 -0400 Original-Received: from xvm-90.mit.edu ([18.181.2.90]:55985 helo=mod-relay.xvm.mit.edu) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VT8Da-0005Fd-9Y for bug-gnu-emacs@gnu.org; Mon, 07 Oct 2013 06:39:14 -0400 Original-Received: by mod-relay.xvm.mit.edu (Postfix) id 8125A1EF4E; Mon, 7 Oct 2013 06:39:13 -0400 (EDT) Original-Received: from mail.muc.de (colin.muc.de [193.149.48.1]) by mod-relay.xvm.mit.edu (Postfix) with ESMTP id 2D7C91EDEA for ; Mon, 7 Oct 2013 06:39:12 -0400 (EDT) Original-Received: (qmail 41713 invoked by uid 3782); 7 Oct 2013 10:32:29 -0000 Original-Received: from acm.muc.de (pD951B381.dip0.t-ipconnect.de [217.81.179.129]) by colin.muc.de (tmda-ofmipd) with ESMTP; Mon, 07 Oct 2013 12:32:29 +0200 Original-Received: (qmail 4098 invoked by uid 1000); 7 Oct 2013 10:30:42 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:78981 Archived-At: 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).