# HG changeset patch # User Chong Yidong # Date 1176749729 0 # Node ID 3ae6fc8b3d2c53d154efed9fc7ce696a85396b3d # Parent 832f3a05910ac706ccf1fdd81c705d3c704e59a3 (python-end-of-block): Avoid looping forever if python-next-statement fails. diff -r 832f3a05910a -r 3ae6fc8b3d2c lisp/progmodes/python.el --- a/lisp/progmodes/python.el Mon Apr 16 18:55:18 2007 +0000 +++ b/lisp/progmodes/python.el Mon Apr 16 18:55:29 2007 +0000 @@ -981,11 +981,15 @@ (_ (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)