From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Karl Chen Newsgroups: gmane.emacs.devel Subject: bug/patch: python.el python-beginning-of-statement Date: Sun, 27 Jun 2004 02:34:52 -0700 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1088328925 10439 80.91.224.253 (27 Jun 2004 09:35:25 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 27 Jun 2004 09:35:25 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Sun Jun 27 11:35:17 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BeW4D-0001qL-00 for ; Sun, 27 Jun 2004 11:35:17 +0200 Original-Received: from lists.gnu.org ([199.232.76.165]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BeW4D-0004t4-00 for ; Sun, 27 Jun 2004 11:35:17 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BeW5l-0001zJ-DH for emacs-devel@quimby.gnus.org; Sun, 27 Jun 2004 05:36:53 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1BeW5d-0001zD-Pf for emacs-devel@gnu.org; Sun, 27 Jun 2004 05:36:45 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1BeW5b-0001yz-S9 for emacs-devel@gnu.org; Sun, 27 Jun 2004 05:36:45 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1BeW5b-0001yw-JS for emacs-devel@gnu.org; Sun, 27 Jun 2004 05:36:43 -0400 Original-Received: from [128.32.47.228] (helo=hkn.eecs.berkeley.edu) by monty-python.gnu.org with esmtp (TLSv1:DES-CBC3-SHA:168) (Exim 4.34) id 1BeW3r-0002FN-MC for emacs-devel@gnu.org; Sun, 27 Jun 2004 05:34:55 -0400 Original-Received: from quarl by hkn.eecs.berkeley.edu with local id 1BeW3o-00069h-00; Sun, 27 Jun 2004 02:34:52 -0700 Original-To: Emacs Developement List X-Quack-Archive: 1 X-Payment: hashcash 1.2 0:040627:emacs-devel@gnu.org:064a62e03f968f99ca8754d1 X-Hashcash: 0:040627:emacs-devel@gnu.org:064a62e03f968f99ca8754d1 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:25271 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:25271 BUG: emacs -q /tmp/a.py ) RET TAB If you have invalid syntax (such as unmatched ")") and try to indent, python-mode will go into an infinite loop until you C-g. The bug is in python-beginning-of-statement. Index: python.el =================================================================== --- python.el (revision 6526) +++ python.el (working copy) @@ -710,16 +710,17 @@ expressions." (beginning-of-line) (python-beginning-of-string) - (while (python-continuation-line-p) - (beginning-of-line) - (if (python-backslash-continuation-line-p) - (while (python-backslash-continuation-line-p) - (forward-line -1)) - (python-beginning-of-string) - ;; Skip forward out of nested brackets. - (condition-case () ; beware invalid syntax - (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t) - (error (end-of-line))))) + (block nil + (while (python-continuation-line-p) + (beginning-of-line) + (if (python-backslash-continuation-line-p) + (while (python-backslash-continuation-line-p) + (forward-line -1)) + (python-beginning-of-string) + ;; Skip forward out of nested brackets. + (condition-case () ; beware invalid syntax + (progn (backward-up-list (syntax-ppss-depth (syntax-ppss))) t) + (error (return)))))) (back-to-indentation)) (defun python-end-of-statement ()