Emacs: Indenting Python Code
in the default python mode shipped with emacs 24.2, you can do this to shift the indentation.
You can also use
kill-rectangle and related rectangle commands [see Emacs: Edit Column Text, Rectangle Commands], but that's more manual work and less accurate.
Note: if you have
cua-mode on, the keys won't work (because C-c does copy.). One solution is to press the complete key sequence within a fraction of a second. Another solution is to hold Shift down, but this method won't work in terminal. Better is to assign it another key.
[see Emacs: How to Define Keys]
Here's a dummy code you can play with.
# dummy code for testing indentation for x in my_list: if len(x) != 2: sys.exit("Error.") if len(x) != 2: sys.exit("Error.")
( thx to boostjam, Matthew Fidler)
Or Buy Xah Emacs Tutorial
Or buy a nice keyboard: Best Keyboard for Emacs
Ask me question on patreon