(Emacs) Python mode, version 1.02.01

Tim Peters (tim@ksr.com)
Thu, 20 Feb 92 14:01:07 EST

The new py-guess-indent-offset (C-c :) could get into an infinite loop
in the presence of some unusual comment or continuation lines. The
patch below fixes that.

send-me-a-bill-for-the-cycles-you-wasted<grin>-ly y'rs - tim

Tim Peters Kendall Square Research Corp
tim@ksr.com, ksr!tim@uunet.uu.net

Change log:

Thu Feb 20 13:20:59 1992 tim
version 1.02.01
fixed infinite loop in py-guess-indent-offset
have to restart re-search-forward where it left off in case
colon found at end of, e.g., a comment line

Patch:

*** python-mode.el Thu Feb 20 13:15:17 1992
--- python-mode.10201.el Thu Feb 20 13:39:45 1992
***************
*** 1,4 ****
! ;;; Major mode for editing Python programs, version 1.02
;; by: Michael A. Guravage
;; Guido van Rossum <guido@cwi.nl>
;; Tim Peters <tim@ksr.com>
--- 1,4 ----
! ;;; Major mode for editing Python programs, version 1.02.01
;; by: Michael A. Guravage
;; Guido van Rossum <guido@cwi.nl>
;; Tim Peters <tim@ksr.com>
***************
*** 349,363 ****
(interactive "P") ; raw prefix arg
(let ( new-value
(start (point))
(found nil)
colon-indent)
(py-goto-initial-line)
(while (not (or found (eobp)))
! (setq found
! (and
! (re-search-forward ":[ \t]*\\($\\|[#\\]\\)" nil 'move)
! (or (py-goto-initial-line) t) ; always true -- side effect
! (looking-at py-colon-line-re))))
(if found
()
(goto-char start)
--- 349,366 ----
(interactive "P") ; raw prefix arg
(let ( new-value
(start (point))
+ restart
(found nil)
colon-indent)
(py-goto-initial-line)
(while (not (or found (eobp)))
! (if (re-search-forward ":[ \t]*\\($\\|[#\\]\\)" nil 'move)
! (progn
! (setq restart (point))
! (py-goto-initial-line)
! (if (looking-at py-colon-line-re)
! (setq found t)
! (goto-char restart)))))
(if found
()
(goto-char start)

>>> END OF MSG