Sams Teach Yourself Emacs in 24 Hours |
||||||||||||||||||||||
Hour 4: Basic Editing |
||||||||||||||||||||||
|
Now it's finally time to get started learning the basic editing skills of Emacs. When you finish this hour, you will have learned enough to use Emacs as effectively as you might use any simple editor.
In this hour, you'll learn how to insert and delete text, move around in Emacs, cut and paste, and load and save files. Although it is a bit beyond the scope of this book, this hour also tells you about several functions that are very useful when you need to read in a new file.
Inserting and deleting text in Emacs is as simple as typing on a typewriter. You simply type the text. If you wonder why I'm telling you this, you're obviously not a vi user (vi is an alternative editor in UNIX). In vi you must be in a special insertion mode to insert text, which is not the case in Emacs.
Caution - If you see the text C-h (Type ? for further options)-- in the minibuffer when you press the backspace key, your backspace key is misconfigured. This is beyond the scope of this book, but consult section 7.0, "Emacs Backspace Binding Problem," at the following URL: ftp://cs.uta.fi/pub/ssjaaa/ema-keys.html or look at items 112 and 113 in the Emacs FAQ (available on this book's CD-ROM). |
In Emacs there are several different ways to delete text. The simplest way is to press the Backspace or the Delete key. In most newer Emacs installations running on X or in Windows, Backspace deletes the previous character, whereas Delete erases the following character. If neither of them delete the following character, you can press C-d (delete-char) instead, which does it. In Figure 4.1 you can see which key deletes what.
There are several other ways to delete text in the buffers. This will be described later in this hour.
When you reach the end of the line, Emacs does not break the line for you; instead it indicates that the line continues onto the next one and lets the text continue there. The indication is located in the last column of the text with a backslash in GNU Emacs and a newline arrow in XEmacs (see Figures 4.2 and 4.3).
After all I've told you about Emacs so far, it shouldn't surprise you that you can configure Emacs to do automatic line breaking when you reach a given column. This is described in detail in Hour 12, "Using Visible Means," but until then, it might help you a lot to know that you enable this by pressing M-x and typing auto-fill-mode (this is a minor mode).
Sams Teach Yourself Emacs in 24 Hours |
||||||||||||||||||||||
Hour 4: Basic Editing |
||||||||||||||||||||||
|
© Copyright Macmillan USA. All rights reserved.