From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Paul Pogonyshev Newsgroups: gmane.emacs.devel Subject: Re: fix infinite loop in python.el Date: Tue, 31 Jul 2007 16:56:53 +0300 Message-ID: <200707311656.54091.pogonyshev@gmx.net> References: <200707211549.54650.pogonyshev@gmx.net> <200707221945.38881.pogonyshev@gmx.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1185889309 12339 80.91.229.12 (31 Jul 2007 13:41:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 31 Jul 2007 13:41:49 +0000 (UTC) To: emacs-devel@gnu.org, rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 31 15:41:42 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IFryj-0005Bg-LO for ged-emacs-devel@m.gmane.org; Tue, 31 Jul 2007 15:41:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IFryj-00081G-85 for ged-emacs-devel@m.gmane.org; Tue, 31 Jul 2007 09:41:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IFryV-0007qt-Ax for emacs-devel@gnu.org; Tue, 31 Jul 2007 09:41:23 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IFryS-0007pm-Kq for emacs-devel@gnu.org; Tue, 31 Jul 2007 09:41:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IFryS-0007pe-Bp for emacs-devel@gnu.org; Tue, 31 Jul 2007 09:41:20 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1IFryR-0000nv-Oi for emacs-devel@gnu.org; Tue, 31 Jul 2007 09:41:20 -0400 Original-Received: (qmail invoked by alias); 31 Jul 2007 13:41:16 -0000 Original-Received: from unknown (EHLO [80.94.230.100]) [80.94.230.100] by mail.gmx.net (mp019) with SMTP; 31 Jul 2007 15:41:16 +0200 X-Authenticated: #16844820 X-Provags-ID: V01U2FsdGVkX18CJ7VcC6ECm+oX0vEweoMCZDQ2h638vy31u80GwR FRB9uc555JUQcg User-Agent: KMail/1.7.2 In-Reply-To: Content-Disposition: inline X-Y-GMX-Trusted: 0 X-detected-kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:75858 Archived-At: Richard Stallman wrote: > I guess we may as well install the change in Emacs 22. > > If nobody installs it in a few days, would you please remind people > until they do? Can someone install this? 2007-07-21 Paul Pogonyshev * progmodes/python.el (python-current-defun): Adjust to never fall into infinite loop. *** python.el 12 Jul 2007 22:55:32 +0300 1.63 --- python.el 21 Jul 2007 15:46:18 +0300 *************** *** 1828,1848 **** (save-excursion ;; Move up the tree of nested `class' and `def' blocks until we ;; get to zero indentation, accumulating the defined names. ! (let ((start t) ! (accum) (length -1)) ! (while (and (or start (> (current-indentation) 0)) ! (or (null length-limit) ! (null (cdr accum)) ! (< length length-limit))) ! (setq start nil) ! (python-beginning-of-block) ! (end-of-line) ! (beginning-of-defun) ! (when (looking-at (rx (0+ space) (or "def" "class") (1+ space) ! (group (1+ (or word (syntax symbol)))))) ! (push (match-string 1) accum) ! (setq length (+ length 1 (length (car accum)))))) (when accum (when (and length-limit (> length length-limit)) (setcar accum "..")) --- 1828,1852 ---- (save-excursion ;; Move up the tree of nested `class' and `def' blocks until we ;; get to zero indentation, accumulating the defined names. ! (let ((accum) (length -1)) ! (catch 'done ! (while (or (null length-limit) ! (null (cdr accum)) ! (< length length-limit)) ! (setq start nil) ! (let ((started-from (point))) ! (python-beginning-of-block) ! (end-of-line) ! (beginning-of-defun) ! (when (= (point) started-from) ! (throw 'done nil))) ! (when (looking-at (rx (0+ space) (or "def" "class") (1+ space) ! (group (1+ (or word (syntax symbol)))))) ! (push (match-string 1) accum) ! (setq length (+ length 1 (length (car accum))))) ! (when (= (current-indentation) 0) ! (throw 'done nil)))) (when accum (when (and length-limit (> length length-limit)) (setcar accum ".."))