comparison lisp/progmodes/python.el @ 77272:3ae6fc8b3d2c

(python-end-of-block): Avoid looping forever if python-next-statement fails.
author Chong Yidong <cyd@stupidchicken.com>
date Mon, 16 Apr 2007 18:55:29 +0000
parents e359709ed895
children ca9519bf5703 e6fdae9180d4
comparison
equal deleted inserted replaced
77271:832f3a05910a 77272:3ae6fc8b3d2c
979 (while (and (> arg 0) 979 (while (and (> arg 0)
980 (let* ((point (point)) 980 (let* ((point (point))
981 (_ (if (python-comment-line-p) 981 (_ (if (python-comment-line-p)
982 (python-skip-comments/blanks t))) 982 (python-skip-comments/blanks t)))
983 (ci (current-indentation)) 983 (ci (current-indentation))
984 (open (python-open-block-statement-p))) 984 (open (python-open-block-statement-p))
985 opoint)
985 (if (and (zerop ci) (not open)) 986 (if (and (zerop ci) (not open))
986 (not (goto-char point)) 987 (not (goto-char point))
987 (catch 'done 988 (catch 'done
988 (while (zerop (python-next-statement)) 989 (setq opoint (point))
990 (while (and (zerop (python-next-statement))
991 (not (= opoint (point))))
992 (setq opoint (point))
989 (when (or (and open (<= (current-indentation) ci)) 993 (when (or (and open (<= (current-indentation) ci))
990 (< (current-indentation) ci)) 994 (< (current-indentation) ci))
991 (python-skip-comments/blanks t) 995 (python-skip-comments/blanks t)
992 (beginning-of-line 2) 996 (beginning-of-line 2)
993 (throw 'done t))))))) 997 (throw 'done t)))))))