From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: fgallina@gnu.org (=?UTF-8?Q?Fabi=C3=A1n?= Ezequiel Gallina) Newsgroups: gmane.emacs.bugs Subject: bug#18228: 24.4.50; electrict-indent-mode bad indentation in python-mode Date: Mon, 01 Sep 2014 20:11:31 -0300 Message-ID: <87oauz6in0.fsf@gnu.org> References: <87egwqgezc.fsf@loki.jorgenschaefer.de> <53E86C87.4080007@easy-emacs.de> <53E8FAFA.9060902@easy-emacs.de> <53E9BCCB.5020304@easy-emacs.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1409613207 25590 80.91.229.3 (1 Sep 2014 23:13:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 1 Sep 2014 23:13:27 +0000 (UTC) To: 18228@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Sep 02 01:13:20 2014 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 1XOamk-0005Xh-OA for geb-bug-gnu-emacs@m.gmane.org; Tue, 02 Sep 2014 01:13:18 +0200 Original-Received: from localhost ([::1]:34355 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOamk-0004u3-67 for geb-bug-gnu-emacs@m.gmane.org; Mon, 01 Sep 2014 19:13:18 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47096) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOama-0004lb-ND for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 19:13:14 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOamU-0002ad-Hu for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 19:13:08 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36236) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOamU-0002aZ-Ew for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 19:13:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XOamU-0000op-3c for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 19:13:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: fgallina@gnu.org (=?UTF-8?Q?Fabi=C3=A1n?= Ezequiel Gallina) Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 Sep 2014 23:13:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18228 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.14096131223064 (code B ref -1); Mon, 01 Sep 2014 23:13:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Sep 2014 23:12:02 +0000 Original-Received: from localhost ([127.0.0.1]:56033 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XOalV-0000nF-HS for submit@debbugs.gnu.org; Mon, 01 Sep 2014 19:12:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:45139) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XOalS-0000mx-Ti for submit@debbugs.gnu.org; Mon, 01 Sep 2014 19:11:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOalH-0002Qi-Pg for submit@debbugs.gnu.org; Mon, 01 Sep 2014 19:11:53 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:57249) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOalH-0002Qd-Mj for submit@debbugs.gnu.org; Mon, 01 Sep 2014 19:11:47 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46846) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOalB-0004Rs-Jr for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 19:11:47 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOal5-0002P5-JD for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 19:11:41 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:45517) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOal5-0002P1-FY for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 19:11:35 -0400 Original-Received: from 222-99-245-190.fibertel.com.ar ([190.245.99.222]:57490 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1XOal4-0000Tk-RL for bug-gnu-emacs@gnu.org; Mon, 01 Sep 2014 19:11:35 -0400 In-Reply-To: <53E9BCCB.5020304@easy-emacs.de> ("Andreas =?UTF-8?Q?R=C3=B6hler?="'s message of "Tue, 12 Aug 2014 09:05:47 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). 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:92950 Archived-At: Andreas R=C3=B6hler writes: > On 12.08.2014 04:40, Stefan Monnier wrote: >>>>> But what should electric-indent do than? >>>> No re-indent upon : when it's not 100% sure of the result. >>> Which sums up to switch it off. >> >> Not to switch off electric-indent, no (it's enabled globally). > > Python modes should switch it off by default. > No, it shouldn't. The electric cases can be controlled in such way in that the feature is still useful. >> >> And presumably the : was made to re-indent because in some/many cases >> there is only 1 correct indentation (and the code is able to find it). >> I don't know if the code is also able to detect when it's correct and >> when it's not, > > In Python indent is meaning - at least sometimes. > A reliable electric-indent must know what the programmer wants to write, = predict his decision. > That's what I'm aiming to and the code is pretty much there, believe it or not. > There are some special cases, where its possible. > In a lot of other cases not. > Name impossible ones and let's see. > Alltogether, when digging in here, you run in a complex matter where > artificial intelligence might deliver some progress indeed - which > seems fairly out of scope giving the resources when > maintaining/developing Emacs' python-modes. > > IMO it would be a waste of time investing here. > If because something it's "hard" we should drop any hopes of developing further, let's go back to abacuses. And no, electric indent is not that hard, really. Andreas R=C3=B6hler writes: > If inside a nested block, there is no way for Emacs to determine whereto = such > "else" should belong. > I.o.w, don't see a difference between these both cases. Well, you'd be surprised at how smart the current implementation of electric indent for python is. Even if there's no sure shot, Emacs would let you cycle between the possible indentations. I invite you to see `python-indent-dedenters-*' tests to understand what I'm talking about. Regards, Fabi=C3=A1n