From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478. Date: Wed, 19 Mar 2014 22:42:31 +0000 Message-ID: <20140319224231.GB4783@acm.acm> References: <20140228195051.GA3446@acm.acm> <20140302115118.GA3768@acm.acm> <20140308225820.GB2726@acm.acm> <20140309123711.GA2615@acm.acm> <20140316223509.GD3854@acm.acm> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1395269182 20276 80.91.229.3 (19 Mar 2014 22:46:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 19 Mar 2014 22:46:22 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 19 23:46:31 2014 Return-path: Envelope-to: ged-emacs-devel@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 1WQPFm-0005bI-QA for ged-emacs-devel@m.gmane.org; Wed, 19 Mar 2014 23:46:31 +0100 Original-Received: from localhost ([::1]:44098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQPFm-0001u4-Fb for ged-emacs-devel@m.gmane.org; Wed, 19 Mar 2014 18:46:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQPFc-0001hV-GV for emacs-devel@gnu.org; Wed, 19 Mar 2014 18:46:27 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WQPFV-0005Qt-6Z for emacs-devel@gnu.org; Wed, 19 Mar 2014 18:46:20 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:53275 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WQPFU-0005Qn-R5 for emacs-devel@gnu.org; Wed, 19 Mar 2014 18:46:13 -0400 Original-Received: (qmail 95309 invoked by uid 3782); 19 Mar 2014 22:46:10 -0000 Original-Received: from acm.muc.de (pD95197C1.dip0.t-ipconnect.de [217.81.151.193]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 19 Mar 2014 23:46:09 +0100 Original-Received: (qmail 5022 invoked by uid 1000); 19 Mar 2014 22:42:31 -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: FreeBSD 8.x X-Received-From: 193.149.48.1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:170579 Archived-At: Hello, Stefan. On Mon, Mar 17, 2014 at 11:48:16AM -0400, Stefan wrote: > >> Right. But I don't see what is so special about the C language that > >> makes c-electric-flag (aka electric-indent-mode) indispensable in c-mode. > > CC Mode modes don't indent correctly automatically without electric > > indentation. > And the same holds true for all other programming modes. No it doesn't. We both agree that Emacs Lisp Mode has no use whatsoever for electric indentation. Clearly, only languages where a line's indentation is dependent on the contents of that line can benefit from electric indentation. > Nothing special here. > I don't know of any mode where electric behavior of something else than > the newline character is needed for the "typical case where lines of > code are being typed in, line by line". Then I suggest you think hard about the disadvantages of RET as an electric indentation key. If there weren't such disadvantages, CC Mode would have been using it for 20 years. > But since this "typical case" is not that typical, several major modes > elect to make a few other keys electric so as to try and maintain > indentation even when code is being modified rather than just being > written linearly. Yes. > Maybe the special part of c-mode is that you used a set of electric > chars which is sufficient and yet does not include newline. Newline is a poor choice for an electric indentation key. > > Not quite. I want the default for CC Mode modes to be t, regardless of > > any system wide default. > I know you steadfastly refuse to recognize that this is your personal > preference rather than a requirement of the languages you support. You're not going to accept reasoned argument here, so I think there's no point continuing this line of discussion. > > I think you are wrong in your tacit assumption that liking of e-i-m is > > person dependent rather than major mode dependent. > There are details about *how* e-i-m works which depend on the mode. > Yes. That's why e-i-m has mode-local settings (e.g. which keys are > electric, or whether the indentation algorithm can reliably reindent). Any "indentation algorithm" can reliably reindent. It is the context in which the algorithm is used which is important, not the algorithm itself. > But the global e-i-m setting is about deciding whether the user wants > his code to be automatically indented as he types (to the extent > possible). It is *defined* as a person-dependent preference. Clearly. I am pointing out that this definition is perhaps a suboptimal one. Your scheme makes it difficult for a user to set up a major mode as being non e-i-m, or even an individual buffer. > > The way electric-indent-mode was implemented seems optimised to maximise > > the difficulty of integrating CC Mode with it. > Of course, my main objective was to piss you off and make your > life miserable. It hasn't worked as well as planned, but this is not > quite over yet ;-) Not even that. You were in so much of a hurry to reinvent the wheel, that you were oblivious of perfectly round wheels with smooth bearings which had been in existence for ~20 years. > Stefan -- Alan Mackenzie (Nuremberg, Germany).