Editing with Emacs
is the program that you use to edit source code. Lots of different editors are
available for Linux, but the most popular and full-featured editor is probably GNU
Emacs is much more than an editor. It is an incredibly powerful program, so much so that at
CodeSourcery, it is affectionately known as the One True Program, or just the OTP for short. You can read
and send email from within Emacs, and you can customize and extend Emacs in ways far too numerous
to discuss here. You can even browse the Web from within Emacs!
If you’re familiar with another editor, you can certainly use it instead. Nothing in the
rest of this book depends on using Emacs. If you don’t already have a favorite Linux
editor, then you should follow along with the mini-tutorial given here.
If you like Emacs and want to learn about its advanced features, you might consider
reading one of the many Emacs books available. One excellent tutorial,
, is written by Debra Cameron, Bill Rosenblatt, and Eric S. Raymond
Opening a C or C++ Source File
You can start Emacs by typing
in your terminal window and pressing the
Return key.When Emacs has been started, you can use the menus at the top to create
a new source file. Click the Files menu, choose Open Files, and then type the name of
the file that you want to open in the “minibuffer” at the bottom of the screen.
want to create a C source file, use a filename that ends in
. If you want to
create a C++ source file, use a filename that ends in