Indent region

If you need to indent all of the lines in a region correctly (mainly useful for writing code), then select a region and use C-M-\ to indent it. TAB will often work too, but may behave differently in some modes.

Remember you can select the whole buffer with C-x h or use expand region to semantically expand your selection.