Presently TAB is bound to indent/cycle the current line.
No problem to make it call `(auto) indent-region' too.
However, I'm afraid some confusion will result from this.
auto-indent always takes the outmost reasonable indent.
It would work for your example, but in case an `if' is between,
it would indent the last line
x = 4
if True:
y *= 23
return x + y
IMHO binding auto-indent to TAB would just move the problem, also creating unexpected actions.
If you want to re-indent the region after a change, C-M-\ is the key.
Anyway, no a great thing to do.
Should you not be convinced yet, please drop a note again and I'll bind it as an option.
Presently TAB is bound to indent/cycle the current line.
No problem to make it call `(auto) indent-region' too.
However, I'm afraid some confusion will result from this.
auto-indent always takes the outmost reasonable indent.
It would work for your example, but in case an `if' is between,
it would indent the last line
x = 4
if True:
y *= 23
return x + y
IMHO binding auto-indent to TAB would just move the problem, also creating unexpected actions.
If you want to re-indent the region after a change, C-M-\ is the key.
Anyway, no a great thing to do.
Should you not be convinced yet, please drop a note again and I'll bind it as an option.