From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] trunk r116461: Connect electric-indent-mode up with CC Mode. Bug #15478. Date: Tue, 25 Mar 2014 16:44:38 +0900 Message-ID: <87ior2rac9.fsf@uwakimon.sk.tsukuba.ac.jp> References: <20140308225820.GB2726@acm.acm> <20140309123711.GA2615@acm.acm> <20140316223509.GD3854@acm.acm> <20140319224231.GB4783@acm.acm> <20140322131350.GA3163@acm.acm> <20140322231012.GB3562@acm.acm> <87wqfkgk02.fsf@uwakimon.sk.tsukuba.ac.jp> <871txsge04.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 X-Trace: ger.gmane.org 1395733557 21530 80.91.229.3 (25 Mar 2014 07:45:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 25 Mar 2014 07:45:57 +0000 (UTC) Cc: Alan Mackenzie , emacs-devel@gnu.org, Dmitry Gutov To: Stefan Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 25 08:46:06 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 1WSM3h-0008JY-DF for ged-emacs-devel@m.gmane.org; Tue, 25 Mar 2014 08:46:05 +0100 Original-Received: from localhost ([::1]:40018 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSM3g-0005ir-QY for ged-emacs-devel@m.gmane.org; Tue, 25 Mar 2014 03:46:04 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38654) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSM3W-0005Ry-Ju for emacs-devel@gnu.org; Tue, 25 Mar 2014 03:46:01 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WSM3P-0003cE-9N for emacs-devel@gnu.org; Tue, 25 Mar 2014 03:45:54 -0400 Original-Received: from mgmt2.sk.tsukuba.ac.jp ([130.158.97.224]:35080) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WSM3O-000383-OI for emacs-devel@gnu.org; Tue, 25 Mar 2014 03:45:47 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt2.sk.tsukuba.ac.jp (Postfix) with ESMTP id 0B209970A23; Tue, 25 Mar 2014 16:44:39 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id EC1591A28DC; Tue, 25 Mar 2014 16:44:38 +0900 (JST) In-Reply-To: X-Mailer: VM undefined under 21.5 (beta34) "kale" 2a0f42961ed4 XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 130.158.97.224 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:170951 Archived-At: Stefan writes: > > FWIW, effectively doing `reindent-then-newline-and-indent' on RET also > > seems gratuitous to me. When I reach the end of a line, usually text on > > that line is already indented correctly (automatically, or through me > > typing TAB manually), > > You might get used to "RET reindents" and stop hitting TAB that often ;-) I'm very unlikely to get used to it. Specifically, in the very annoying case where unconventional indentation gets blown away by it (TAB won't fix that!) > For me one of the reasons why it's not gratuitous is because of things like: > > begin > blabla > blibli > end > > Go to just before "blibli" and type "end RET": notice that hitting TAB > just before RET won't help you, because you need to reindent the line > after the newline is inserted. I wouldn't do that, because the right indentation for "blibli" depends on intended semantics. That is, if I started from syntactically valid code, after inserting "end" I now have invalid code ("end without begin"). Non-trivial edits are required to return the buffer to "well-formed" state, and I personally prefer the now-orphaned fragment to retain its indentation, indicating its previous semantics. Therefore I would go to the end of "blabla", and hit RET. Why would I care about the "no-op" reindent? Because it might not be a no-op. ("blabla" might not be conventionally indented.) > This is admittedly less serious for interactive editing than for > keyboard macros (and templates/skeletons/snippets), but I find the > behavior to be handy. In case of such things, I'd want to do C-x ( C-SPC ... macro keys ... C-x C-x M-x indent-region C-x ) (except in Python, where you're screwed because block structure is determined by indentation, so situations where determining the appropriate number of dedents requires knowing the intended semantics are common). > > For all others, just swapping C-j and RET bindings would've worked just > > as well, and I think it would result in simpler code. > > Again "just swapping" sounds simple, but I'm not sure what patch you > have in mind. I think it's important for the user to be able to easily > say something like (electric-indent-mode -1) (and/or its buffer-local > equivalent) to recover the Emacs-23 behavior. "Just swapping" is entirely independent of electric-indent-mode. It wouldn't change the Emacs-23 behavior, just have it on different keys.