Report a Problem:
Phone: 503-725-5420
Location: FAB 82-01
Home Students Fac/Staff CS Tutors Guidelines Windows Linux Mac Mail Network Software Web TheCAT Sitemap Contact
arrowHome arrow CS Tutors arrow Tips & Tricks arrow Emac Tips Archive Wednesday, 16 August 2017  
Tips & Tricks
Emacs Tips Archive Print
Monday, 01 May 2006
Archived Tip Title
Submitted by
Emacs Comment Region Nathan Ertner
Emacs Query-Replace
Nathan Ernter

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

Last Updated ( Tuesday, 03 April 2007 )

©1999 - 2017 TheCAT