From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#17658: Python mode has odd indentation behavior Date: Sat, 31 May 2014 22:47:59 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1401590970 14616 80.91.229.3 (1 Jun 2014 02:49:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 1 Jun 2014 02:49:30 +0000 (UTC) Cc: "=?UTF-8?Q?Fabi=C3=A1n?= E. Gallina" , 17658@debbugs.gnu.org To: Adam Connor Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Jun 01 04:49:22 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 1Wqvpp-0003d4-5l for geb-bug-gnu-emacs@m.gmane.org; Sun, 01 Jun 2014 04:49:21 +0200 Original-Received: from localhost ([::1]:33599 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wqvpo-0004oE-NO for geb-bug-gnu-emacs@m.gmane.org; Sat, 31 May 2014 22:49:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41839) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wqvpe-0004o6-PW for bug-gnu-emacs@gnu.org; Sat, 31 May 2014 22:49:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WqvpX-000813-9V for bug-gnu-emacs@gnu.org; Sat, 31 May 2014 22:49:10 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40464) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WqvpX-00080z-6K for bug-gnu-emacs@gnu.org; Sat, 31 May 2014 22:49:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1WqvpW-0007yz-KD for bug-gnu-emacs@gnu.org; Sat, 31 May 2014 22:49:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 01 Jun 2014 02:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 17658 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 17658-submit@debbugs.gnu.org id=B17658.140159088930597 (code B ref 17658); Sun, 01 Jun 2014 02:49:02 +0000 Original-Received: (at 17658) by debbugs.gnu.org; 1 Jun 2014 02:48:09 +0000 Original-Received: from localhost ([127.0.0.1]:39341 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wqvof-0007xQ-Dq for submit@debbugs.gnu.org; Sat, 31 May 2014 22:48:09 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:60094) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Wqvob-0007wu-T0 for 17658@debbugs.gnu.org; Sat, 31 May 2014 22:48:07 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArUGAIDvNVPO+IOj/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOAEDqRmBaoNMIYEsJA X-IPAS-Result: ArUGAIDvNVPO+IOj/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCws0EhQYDSSIBAjSGReOegeEOAEDqRmBaoNMIYEsJA X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="65211043" Original-Received: from 206-248-131-163.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([206.248.131.163]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 31 May 2014 22:47:59 -0400 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 3DDB8AE0BC; Sat, 31 May 2014 22:47:59 -0400 (EDT) In-Reply-To: (Adam Connor's message of "Sat, 31 May 2014 20:49:09 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux) 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:89844 Archived-At: > ------------------------------ snip ------------------------------ > from django.conf.urls import patterns, include, url > from django.contrib import admin > from myapp import views > urlpatterns =3D patterns('', > url(r'^$', views.index), > ) > ------------------------------ snip ------------------------------ > When I try to change the "url..." line to > ------------------------------ snip ------------------------------ > url(r'^$', views.index, name=3D"myapp_index"), > ------------------------------ snip ------------------------------ > the moment I type the comma, the whole line bounces way over to the left. Indeed, I can reproduce this in Emacs-24.3.91. The important detail is not to hit "," but to insert a char right before the inner close paren. The problem seems to be in python-indent-post-self-insert-function, where the "still in parenthesis" check doesn't realize that it's within a different pair of parens. > Is this a bug? Looks like it, yes. Fabi=E1n, can you take care of it? > Is there a way to turn this off? A temporary workaround could be (add-hook 'python-mode-hook (lambda () (remove-hook 'post-self-insert-hook #'python-indent-post-self-insert-function 'local))) -- Stefan