emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fix infinite loop in python.el


From: Paul Pogonyshev
Subject: Re: fix infinite loop in python.el
Date: Tue, 31 Jul 2007 16:56:53 +0300
User-agent: KMail/1.7.2

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  <address@hidden>

        * 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 ".."))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]