aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Jose Latorre2007-08-01 00:47:25 +0000
committerVinicius Jose Latorre2007-08-01 00:47:25 +0000
commit47968e06dabbd4d8f77036cb9cf5d633d728d241 (patch)
treeababf2bf0c27824a9ddacc60525f683096b6be7a
parent65a9c8e243ee1b950927ee9af46ea511e14c5211 (diff)
downloademacs-47968e06dabbd4d8f77036cb9cf5d633d728d241.tar.gz
emacs-47968e06dabbd4d8f77036cb9cf5d633d728d241.zip
Fix infinite loop in python.el
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/progmodes/python.el34
2 files changed, 24 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index c295150db71..fceef2353de 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-07-31 Paul Pogonyshev <pogonyshev@gmx.net>
2
3 * progmodes/python.el (python-current-defun): Adjust to never fall
4 into infinite loop.
5
12007-07-31 Stefan Monnier <monnier@iro.umontreal.ca> 62007-07-31 Stefan Monnier <monnier@iro.umontreal.ca>
2 7
3 * pcvs.el (cvs-vc-command-advice): Handle the new fileset case. 8 * pcvs.el (cvs-vc-command-advice): Handle the new fileset case.
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."
1005 (set-text-properties 0 (length function-name) nil function-name) 1005 (set-text-properties 0 (length function-name) nil function-name)
1006 function-name)) 1006 function-name))
1007 1007
1008 1008
1009;;;; Imenu. 1009;;;; Imenu.
1010 1010
1011(defvar python-recursing) 1011(defvar python-recursing)
@@ -1828,21 +1828,25 @@ of current line."
1828 (save-excursion 1828 (save-excursion
1829 ;; Move up the tree of nested `class' and `def' blocks until we 1829 ;; Move up the tree of nested `class' and `def' blocks until we
1830 ;; get to zero indentation, accumulating the defined names. 1830 ;; get to zero indentation, accumulating the defined names.
1831 (let ((start t) 1831 (let ((accum)
1832 (accum)
1833 (length -1)) 1832 (length -1))
1834 (while (and (or start (> (current-indentation) 0)) 1833 (catch 'done
1835 (or (null length-limit) 1834 (while (or (null length-limit)
1836 (null (cdr accum)) 1835 (null (cdr accum))
1837 (< length length-limit))) 1836 (< length length-limit))
1838 (setq start nil) 1837 (setq start nil)
1839 (python-beginning-of-block) 1838 (let ((started-from (point)))
1840 (end-of-line) 1839 (python-beginning-of-block)
1841 (beginning-of-defun) 1840 (end-of-line)
1842 (when (looking-at (rx (0+ space) (or "def" "class") (1+ space) 1841 (beginning-of-defun)
1843 (group (1+ (or word (syntax symbol)))))) 1842 (when (= (point) started-from)
1844 (push (match-string 1) accum) 1843 (throw 'done nil)))
1845 (setq length (+ length 1 (length (car accum)))))) 1844 (when (looking-at (rx (0+ space) (or "def" "class") (1+ space)
1845 (group (1+ (or word (syntax symbol))))))
1846 (push (match-string 1) accum)
1847 (setq length (+ length 1 (length (car accum)))))
1848 (when (= (current-indentation) 0)
1849 (throw 'done nil))))
1846 (when accum 1850 (when accum
1847 (when (and length-limit (> length length-limit)) 1851 (when (and length-limit (> length length-limit))
1848 (setcar accum "..")) 1852 (setcar accum ".."))