[Python-checkins] python/dist/src/Misc python-mode.el,4.27,4.28

bwarsaw@users.sourceforge.net bwarsaw@users.sourceforge.net
2002年10月21日 08:58:32 -0700


Update of /cvsroot/python/python/dist/src/Misc
In directory usw-pr-cvs1:/tmp/cvs-serv28187
Modified Files:
	python-mode.el 
Log Message:
(py-parse-state-re): Remove the "if" from the regular expression.
This fixes an indentation bug reported by Jeremy when seeing multiple
list comprehensions like so:
 [x for x in seq
 if blah(x)]
 # ...
 [y for y in seq
 if blah(y)]
The reason this broke is because this regexp caused the "find a safe
parsing start location higher up in the file" test to erroneously find
the if in the listcomp. I think the other keywords in this regexp are
fine and good enough.
After a weekend of testing, I can't find any adverse effects.
Index: python-mode.el
===================================================================
RCS file: /cvsroot/python/python/dist/src/Misc/python-mode.el,v
retrieving revision 4.27
retrieving revision 4.28
diff -C2 -d -r4.27 -r4.28
*** python-mode.el	28 Sep 2002 18:17:56 -0000	4.27
--- python-mode.el	21 Oct 2002 15:58:29 -0000	4.28
***************
*** 3149,3153 ****
 (defvar py-parse-state-re
 (concat
! "^[ \t]*\\(if\\|elif\\|else\\|while\\|def\\|class\\)\\>"
 "\\|"
 "^[^ #\t\n]"))
--- 3149,3153 ----
 (defvar py-parse-state-re
 (concat
! "^[ \t]*\\(elif\\|else\\|while\\|def\\|class\\)\\>"
 "\\|"
 "^[^ #\t\n]"))

AltStyle によって変換されたページ (->オリジナル) /