And now for the best feature of emacs EVER. Emacs will automatically indent your code for you. Yes. No more hitting spaces and fussing with margins. No other IDE does it as well as emacs.
To layout a line, just hit the tab key on the line you wish to adjust. Download the file called TestLayout.java --a little program written for this demonstration. You don't have to know the file works yet.
To open it, type:
C-x C-f TestLa < TAB >
Hit the Tab key to have emacs finish typing the file name for you. Or, type the whole
file name. Looks pretty messed up, eh? Lines everywhere. This kind of program would lose a
few style points if it were handed in. Put your cursor on each line, starting at the top
and working down, hitting TAB. WHAMMO! Emacs knows how to layout your document. Note you
can do this to the entire document at once by typing:
C-x h < RETURN > This is like "Select All", it captures your entire
document. Then, type in:
M-x indent-region < RETURN > Remember, the M above means "ESC".
This auto-indent will save you time and points on programs. Don't forget
to save your file with C-x C-s <RETURN> (If it saves you lots of extra
time, you can watch the towers of hanoi to pass the time. Type in M-x hanoi < RETURN
> while your fellow class mates struggle to layout their code. Part of being an
emacs user is being very lazy, and doing things that save you
time. When's the last time you saw notepad solve the towers of hanoi
puzzle? That's what I thought. Had enough with this
demo? Close or kill off this buffer with C-x k < RETURN >)