-->
Previous | Table of Contents | Next |
You edit text by creating new text or by modifying existing text. When creating new text, you place the text in a file with an ordinary Linux filename. When you modify existing text, you use the existing filename to call a copy of the file into the editing session. In either case, as you use the editor, the text is held in the systems memory in a storage area called a buffer.
Using a buffer prevents you from directly changing the contents of a file until you decide to save the buffer. This is to your benefit if you decide you want to forget the changes youve made and start over.
emacs allows you to edit multiple buffers at once. This way, you can cut and paste text from one buffer to another, compare text from different files, or merge one file into another file. emacs even uses a special buffer to accept commands and report information to the user. This buffer, the mini-buffer, appears at the bottom of the screen.
emacs also lets you display the contents of various buffers in their own windows; thus, you can see several files at once, even if you arent using a graphical user interface.
Figure 28.1 shows a typical emacs screen. The top portion displays the contents of various buffers, sometimes in multiple windows. Then a mode line is displayed at the bottom of the screen. This line, usually displayed in reverse video, provides users with information about the buffer, such as the buffers name, the major and minor mode, and the amount of text displayed in the buffer. Under the mode line is the one-line mini-buffer, where you enter emacs commands and where emacs reports the outcome of various commands.
FIG. 28.1 A typical emacs screen shows the buffer and mini-buffer areas.
The current position in the buffer is shown by a cursor. emacs refers to the cursor as the point, especially in the online help system, so its important to remember this term for the cursor.
The following instructions show how to edit your first emacs file. If you run into difficulties, you can quit and start over by pressing <Ctrl-x><Ctrl-c>. Follow these steps:
Things to do today. a. Practice emacs. b. Sort sales data and print the results.
NOTE: Notice the mini-buffer at the bottom of the screen. Your keystrokes appear there because youre typing commands to the emacs editor.
Wrote /root/emacs-pract.1
NOTE: Notice the number of characters in the filename. Unlike MS-DOS and Windows, Linux allows you to enter more than eight characters and a three-character extension for a filename.
TROUBLESHOOTING:
emacs is placing the characters I type into the mini-buffer and attempting to perform strange actions with the characters. If you press the <Esc> key twice, emacs enters a LISP programming environment. LISP is the original language that Stallman used to program emacs, and its through LISP that programmers can extend and customize emacs. If you press <Esc><Esc>, emacs enters the eval-expression mode and expects the user to enter a LISP command; simply press <Return> to exit this mode.
Previous | Table of Contents | Next |