When writing code in C++ or Java using emacs I notice that I can get the code all nicely aligned and indented correctly by simply adding a comment at the end of each line of code. As you enter the //, the line of code moves to its correct alignment. What I have been doing is writing my code and periodically tidying it up by adding // at the end of every line of code. My question is, can I speed this aligning and indenting process up by formatting the entire file using one command? Emacs obviously knows how much each line should be indented, but doing it one line at a time by adding // is laborious.