Chapter 3. Editing Files

Now that you know how to enter and exit Emacs as well as the basics of working with files, it’s time to learn how to move around in and edit files. Emacs offers lots of ways to move around in files. At first, you might find it confusing that there are so many ways to do the same thing. Be patient—as you learn, the confusion will lessen, and you’ll begin to appreciate the variety of Emacs commands. The more ways you learn, the fewer keystrokes you’ll need to get to the part of the file you want to edit.

If you want to practice commands while you’re reading--which will help you learn faster—start by typing a page or two from anything you happen to have handy; the newspaper is fine. That will give you some text to work with as you learn the editing skills described in this chapter. Don’t worry if you make mistakes; just keep on typing. You can correct any mistakes once you learn the basic editing skills outlined here. Learning any editor is primarily a matter of forming certain finger habits, rather than memorizing what the book says. You will learn the right finger habits only if you start typing.

When you are typing and you get to the right side of the display, you have two options. You can press RETURN to go to the next line, or you can keep typing. If you type a long line and don’t press RETURN, Emacs waits until you reach the end of the display. Then it puts a backslash (\) at the end of the line and moves to the next line. For example, the following ...

Get Learning GNU Emacs, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.