diff options
author | Vinicius Jose Latorre <viniciusjl@ig.com.br> | 2007-08-01 00:47:25 +0000 |
---|---|---|
committer | Vinicius Jose Latorre <viniciusjl@ig.com.br> | 2007-08-01 00:47:25 +0000 |
commit | 47968e06dabbd4d8f77036cb9cf5d633d728d241 (patch) | |
tree | ababf2bf0c27824a9ddacc60525f683096b6be7a /lisp/progmodes | |
parent | 65a9c8e243ee1b950927ee9af46ea511e14c5211 (diff) | |
download | emacs-47968e06dabbd4d8f77036cb9cf5d633d728d241.tar.gz |
Fix infinite loop in python.el
Diffstat (limited to 'lisp/progmodes')
-rw-r--r-- | lisp/progmodes/python.el | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index c3caa7e397c..9bef41a0878 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1005,7 +1005,7 @@ don't move and return nil. Otherwise return t." (set-text-properties 0 (length function-name) nil function-name) function-name)) - + ;;;; Imenu. (defvar python-recursing) @@ -1828,21 +1828,25 @@ of current line." (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) + (let ((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)))))) + (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 "..")) |