From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Woodcraft Newsgroups: gmane.emacs.bugs Subject: bug#22661: 25.0.91; python.el electric-indent misbehaviour with 'else:' and nested 'if:' Date: Sun, 14 Feb 2016 17:09:31 +0000 Message-ID: <87a8n3z0ac.fsf@golux.woodcraft.me.uk> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1455469826 4436 80.91.229.3 (14 Feb 2016 17:10:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Feb 2016 17:10:26 +0000 (UTC) To: 22661@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Feb 14 18:10:14 2016 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 1aV0BZ-0007EM-T2 for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Feb 2016 18:10:14 +0100 Original-Received: from localhost ([::1]:52147 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0BV-0004Vw-RK for geb-bug-gnu-emacs@m.gmane.org; Sun, 14 Feb 2016 12:10:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0BR-0004R9-79 for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2016 12:10:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aV0BO-00018C-1Y for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2016 12:10:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48215) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0BN-000180-VT for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2016 12:10:01 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aV0BN-0000za-Sn for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2016 12:10:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Matthew Woodcraft Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 14 Feb 2016 17:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 22661 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.14554697973799 (code B ref -1); Sun, 14 Feb 2016 17:10:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Feb 2016 17:09:57 +0000 Original-Received: from localhost ([127.0.0.1]:38990 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aV0BJ-0000zC-F7 for submit@debbugs.gnu.org; Sun, 14 Feb 2016 12:09:57 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:41980) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aV0BH-0000yz-N2 for submit@debbugs.gnu.org; Sun, 14 Feb 2016 12:09:56 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aV0BB-00017I-Fn for submit@debbugs.gnu.org; Sun, 14 Feb 2016 12:09:50 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:55880) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0BB-00017E-DB for submit@debbugs.gnu.org; Sun, 14 Feb 2016 12:09:49 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:32950) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0BA-0004LY-BH for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2016 12:09:49 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aV0B7-000174-5L for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2016 12:09:48 -0500 Original-Received: from hark.woodcraft.me.uk ([213.138.109.203]:33159) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aV0B6-000163-VM for bug-gnu-emacs@gnu.org; Sun, 14 Feb 2016 12:09:45 -0500 Original-Received: from cpc92308-cmbg19-2-0-cust726.5-4.cable.virginm.net ([82.24.250.215] helo=golux.woodcraft.me.uk) by hark.woodcraft.me.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84) (envelope-from ) id 1aV0Ay-0005mN-Oz; Sun, 14 Feb 2016 17:09:36 +0000 Original-Received: from mjw by golux.woodcraft.me.uk with local (Exim 4.84) (envelope-from ) id 1aV0At-0002tk-8o; Sun, 14 Feb 2016 17:09:31 +0000 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.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:113022 Archived-At: If I have the following code and add the colon after the 'else', python.el's electric-indent moves the 'else' to align with the inner 'if'. def foo() if aaa: if bbb: x = 1 y = 1 else I think it would be much better to leave the else alone in this situation (ie, when its current position matches an outer 'if'), for two reasons: - it's generally better to leave things alone than to make a guess which is quite likely to be wrong; - if the user has typed the whole thing in one go, then to reach this situation they must have explicitly dedented the 'else' already. (Seen in emacs 25.1 pretest; 24.5 is the same; checked with 'emacs -Q'.) In GNU Emacs 25.0.91.1 (i586-pc-linux-gnu, GTK+ Version 3.14.5) of 2016-02-14, modified by Debian built on golux Windowing system distributor 'The X.Org Foundation', version 11.0.11604000 System Description: Debian GNU/Linux 8.3 (jessie) Configured using: 'configure --build i586-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/25.0.91/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.0.91/site-lisp:/usr/share/emacs/site-lisp --build i586-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs-snapshot:/etc/emacs:/usr/local/share/emacs/25.0.91/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/25.0.91/site-lisp:/usr/share/emacs/site-lisp --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall -fno-omit-frame-pointer' CPPFLAGS=-D_FORTIFY_SOURCE=2 LDFLAGS=-Wl,-z,relro' Configured features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 Important settings: value of $LC_CTYPE: en_GB.UTF-8 locale-coding-system: utf-8-unix