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#17658: Python mode has odd indentation behavior Date: Mon, 30 Jun 2014 23:33:10 -0300 Message-ID: <87ionh7qqh.fsf@gnu.org> References: 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 1404182054 22886 80.91.229.3 (1 Jul 2014 02:34:14 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 1 Jul 2014 02:34:14 +0000 (UTC) To: 17658@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jul 01 04:34:08 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 1X1ntY-00070W-8o for geb-bug-gnu-emacs@m.gmane.org; Tue, 01 Jul 2014 04:34:08 +0200 Original-Received: from localhost ([::1]:37947 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1ntX-0007rX-Pf for geb-bug-gnu-emacs@m.gmane.org; Mon, 30 Jun 2014 22:34:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43330) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1ntU-0007rH-62 for bug-gnu-emacs@gnu.org; Mon, 30 Jun 2014 22:34:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X1ntS-0003o5-N5 for bug-gnu-emacs@gnu.org; Mon, 30 Jun 2014 22:34:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:47321) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X1ntS-0003o1-Ka for bug-gnu-emacs@gnu.org; Mon, 30 Jun 2014 22:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1X1ntS-0003CX-AF for bug-gnu-emacs@gnu.org; Mon, 30 Jun 2014 22:34: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: Tue, 01 Jul 2014 02:34: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.140418199812236 (code B ref 17658); Tue, 01 Jul 2014 02:34:02 +0000 Original-Received: (at 17658) by debbugs.gnu.org; 1 Jul 2014 02:33:18 +0000 Original-Received: from localhost ([127.0.0.1]:38471 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X1nsj-0003BG-TH for submit@debbugs.gnu.org; Mon, 30 Jun 2014 22:33:18 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:57076 ident=Debian-exim) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1X1nsg-0003B4-UO for 17658@debbugs.gnu.org; Mon, 30 Jun 2014 22:33:15 -0400 Original-Received: from 222-99-245-190.fibertel.com.ar ([190.245.99.222]:54819 helo=localhost) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1X1nsg-000685-3X for 17658@debbugs.gnu.org; Mon, 30 Jun 2014 22:33:14 -0400 In-Reply-To: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (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:91031 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 ------------------------------ While this is a pretty recurrent style in Django's documentation, this indentation style goes against PEP8. http://legacy.python.org/dev/peps/pep-0008/#indentation Here's a nice answer on SO with an example similar to yours: http://stackoverflow.com/questions/15435811/what-is-pep8s-e128-continuation= -line-under-indented-for-visual-indent/15435837#15435837 > 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. Right, that was absolutely intended in the code. I'm now working in a variant that would prevent triggering the indentation in that particular case. Notice, that even with this fix, python.el will still use the first argument indentation as default value for further url definitions, so I would suggest to embrace the PEP8 way intead -- unless you are really contributing to Django and are forced to follow that convention. Regards, Fabi=C3=A1n