I have some lines of code in a python script opened under Py Outl mode:
last=-1
for i in range(len(page_nos)-1, -1, -1):
if page_nos[i] != 'NULL':
last = i
break
if last == -1:
page_nos[0] = 1
last = 0
I want to put them into a function, so I add a line of function definition in front of them:
def fillnull(page_nos):
last=-1
for i in range(len(page_nos)-1, -1, -1):
if page_nos[i] != 'NULL':
last = i
break
if last == -1:
page_nos[0] = 1
last = 0
I then want to indent the original lines so that they can become the body of the function. By selecting the region and M-x indent-region, the region becomes:
def fillnull(page_nos):
last=-1
for i in range(len(page_nos)-1, -1, -1):
if page_nos[i] != 'NULL':
last = i
break
if last == -1:
page_nos[0] = 1
last = 0
Why does it put extra indents in front of the second if block?
How can I indent the original lines correctly? Thanks.
M-x indent-rigidly