Python whitespace slowed me down when I tried to add a conditional around something similar to the following block in emacs22:
cat = ""
list = ['foo', 'bar', 'baz']
for thing in list:
cat += thing + ','
print cat
I indented everything the entire block under the conditional and ended up with:
if (1):
cat = ""
list = ['foo', 'bar', 'baz']
for thing in list:
cat += thing + ','
print cat
instead of (the last line became part of the loop):
if (1):
cat = ""
list = ['foo', 'bar', 'baz']
for thing in list:
cat += thing + ','
print cat
I'm used to just doing an M-x indent-region when coding and not having to see the details of the block I'm indenting. This is handy when I'm wrapping a block in a conditional and don't want to think of the details of the block at that moment.
Perhaps this has been solved so I'll read more about
Python Mode.
[FIX]: Don't
indent the region,
shift the region. Shifting preserves other indentations.
C-c <: Shift the region to the left
C-c >: Shift the region to the right
No comments:
Post a Comment