Ticket #403 (closed enhancement: fixed)
Ignore comments when reindenting in python mode
| Reported by: | rob | Owned by: | rob |
|---|---|---|---|
| Priority: | minor | Milestone: | 0.7.3 |
| Component: | application | Keywords: | |
| Cc: |
Description
Chris Barker noted the following:
for i in list: # a commented line This line indents wrong!
I wrote the following to the mailing list: I've noticed that problem. Interestingly, (x)emacs has the same issue with a single comment char at column zero. However, in emacsland, if the comment starts with two comment chars, that comment is placed outside the normal flow of indenting:
for i in list:
## a commented line
print i
Emacs indents the print correctly, but a single comment char causes emacs to treat that line as valid and so indents the print to column zero. Also, I'm not sure that comments should be ignored completely, for instance:
for i in list:
print i
# first comment -- at the level of the for statement
# second comment
I'd like the second comment to be indented to the same level as the first comment when I press the tab key, but if the indenting ignores all comments it would be indented to the print statement.
Maybe just ignore comments that start at column zero? Or, maybe implement the emacs thing (double comment chars)? I think the emacs thing might be better. Double comments to indicate block comments that are outside the flow of indenting.
