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#2703: 23.0.91; Error in Python indenter Date: Wed, 09 Nov 2011 10:01:25 -0500 Message-ID: References: <20090318012449.3D66D4858E@rgr.rgrjr.com> <20111001131910.GA862@staatsfeind.sperrbezirk.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1320850933 6096 80.91.229.12 (9 Nov 2011 15:02:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Nov 2011 15:02:13 +0000 (UTC) Cc: 2703@debbugs.gnu.org To: Marcus Dreier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Nov 09 16:02:09 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RO9fF-0005zH-BX for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Nov 2011 16:02:09 +0100 Original-Received: from localhost ([::1]:60106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RO9fE-0004Pk-NA for geb-bug-gnu-emacs@m.gmane.org; Wed, 09 Nov 2011 10:02:08 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:51625) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RO9f9-0004Pc-Jw for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2011 10:02:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RO9f3-0007MB-0M for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2011 10:02:03 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:41748) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RO9f2-0007M7-V7 for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2011 10:01:56 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1RO9f7-0008Na-T5 for bug-gnu-emacs@gnu.org; Wed, 09 Nov 2011 10:02:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 09 Nov 2011 15:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 2703 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 2703-submit@debbugs.gnu.org id=B2703.132085090332184 (code B ref 2703); Wed, 09 Nov 2011 15:02:01 +0000 Original-Received: (at 2703) by debbugs.gnu.org; 9 Nov 2011 15:01:43 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RO9el-0008Mz-7k for submit@debbugs.gnu.org; Wed, 09 Nov 2011 10:01:42 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1RO9ej-0008Mk-0H for 2703@debbugs.gnu.org; Wed, 09 Nov 2011 10:01:37 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EAEKVuk5MCoYy/2dsb2JhbABCp36CH4EGgXIBAQQBViMFCwsOJhIUGA0kiBW4O4l/BIgMmWGESA X-IronPort-AV: E=Sophos;i="4.69,484,1315195200"; d="scan'208";a="147147161" Original-Received: from 76-10-134-50.dsl.teksavvy.com (HELO pastel.home) ([76.10.134.50]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 09 Nov 2011 10:01:25 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 77B945936A; Wed, 9 Nov 2011 10:01:25 -0500 (EST) In-Reply-To: <20111001131910.GA862@staatsfeind.sperrbezirk.net> (Marcus Dreier's message of "Sat, 1 Oct 2011 15:19:10 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.91 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 09 Nov 2011 10:02:01 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) 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:53747 Archived-At: > The position check in the outer loop makes no sense to me. Indeed it makes no sense. I think the intention is to prevent inf-looping, but it's done incorrectly. I'm not 100% convinced that your patch avoids inf-looping, so I reworked the code some more to make the termination more clear. It's also simpler. Thanks for digging into it and finding the culprit. Stefan === modified file 'lisp/progmodes/python.el' *** lisp/progmodes/python.el 2011-09-10 21:15:28 +0000 --- lisp/progmodes/python.el 2011-11-09 14:53:11 +0000 *************** *** 948,969 **** "Go to start of current statement. Accounts for continuation lines, multi-line strings, and multi-line bracketed expressions." ! (beginning-of-line) ! (python-beginning-of-string) ! (let (point) ! (while (and (python-continuation-line-p) ! (if point ! (< (point) point) ! t)) ! (beginning-of-line) (if (python-backslash-continuation-line-p) ! (progn ! (forward-line -1) ! (while (python-backslash-continuation-line-p) ! (forward-line -1))) ! (python-beginning-of-string) ! (python-skip-out)) ! (setq point (point)))) (back-to-indentation)) (defun python-skip-out (&optional forward syntax) --- 948,959 ---- "Go to start of current statement. Accounts for continuation lines, multi-line strings, and multi-line bracketed expressions." ! (while (if (python-backslash-continuation-line-p) ! (progn (forward-line -1) t) ! (beginning-of-line) ! (or (python-beginning-of-string) ! (python-skip-out)))) (back-to-indentation)) (defun python-skip-out (&optional forward syntax)