summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2007-04-16 18:55:29 +0000
committerChong Yidong <cyd@stupidchicken.com>2007-04-16 18:55:29 +0000
commit003586aae6fa91f374dd92329efb8ff7653e46bd (patch)
tree0703aeca105455dea89151110e25d00888f488e0
parent80dce3a4b7715f39bef2f32ca6b0846d3b0a844f (diff)
downloademacs-003586aae6fa91f374dd92329efb8ff7653e46bd.tar.gz
(python-end-of-block): Avoid looping forever if python-next-statement
fails.
-rw-r--r--lisp/progmodes/python.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 1709428a611..e57c7e639c9 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -981,11 +981,15 @@ don't move and return nil. Otherwise return t."
(_ (if (python-comment-line-p)
(python-skip-comments/blanks t)))
(ci (current-indentation))
- (open (python-open-block-statement-p)))
+ (open (python-open-block-statement-p))
+ opoint)
(if (and (zerop ci) (not open))
(not (goto-char point))
(catch 'done
- (while (zerop (python-next-statement))
+ (setq opoint (point))
+ (while (and (zerop (python-next-statement))
+ (not (= opoint (point))))
+ (setq opoint (point))
(when (or (and open (<= (current-indentation) ci))
(< (current-indentation) ci))
(python-skip-comments/blanks t)