Emacs Comment Region
Submitted by Nathan Ertner
When editing a C, C++, or Java file in Emacs, you can comment out a selected region.
To mark the beginning of a region you would like to comment out, press C-SPACE (ctrl-SPACE).
Now move your cursor to the end of the region you would like to comment out and press C-c C-c (ctrl-c twice).
To un-comment the selected region press C-u C-c C-c (ctrl-u then ctrl-c twice).
Emacs Query-Replace
Submitted by Nathan Ertner
To begin query-replace in Emacs, type ESC then %.
At the prompt, enter the expression you would like to replace, then press RETURN.
Now type the expression you would like to replace it with and press RETURN.
Emacs will highlight each occurrnece of your expression individually and ask if you would like it replaced.
To replace the selected instance type either y or SPACE.
To skip replacement and go to the next instance, type either n or DEL.
To exit query-replace type RETURN or q.