home *** CD-ROM | disk | FTP | other *** search
- From: paul@cgh.UUCP (Paul Homchick)
- Newsgroups: comp.sources.misc
- Subject: MicroEMACS 3.8i Documentation (Scribe format) 1 of 2
- Message-ID: <2761@ncoast.UUCP>
- Date: 3 Jul 87 00:07:35 GMT
- Sender: allbery@ncoast.UUCP
- Lines: 1313
- Approved: allbery@ncoast.UUCP
- X-Archive: comp.sources.misc/8707/1
-
- MicroEmacs 3.8i Documentation in MicroSCRIBE format.
- +++ Part One of Two +++
- (Differs from the original uEmacs distribution by fixing some spelling
- errors and formattating problems)
- -----snip-----snip-----snip-----snip-----snip-----snip-----snip-----snip-----
- @style(indent 8 chars, linewidth 72 chars, spacing 1 lines)
- @pagefooting()
-
- @b(MicroEMACS)
-
- Full Screen Text Editor
- Reference Manual (preliminary draft)
-
- Version 3.8i
- April 27, 1987
-
- (C)opyright 1987 by Daniel M. Lawrence
- Reference Manual (C)opyright 1987
- by Brian Straight and Daniel M. Lawrence
- All Rights Reserved
-
- @i(MicroEMACS 3.8i can be copied and distributed freely
- for any non-commercial purposes. MicroEMACS 3.8i can
- only be incorporated into commercial software with
- the permission of the current author.)
- @newpage
- @flushleft(@b[Introduction])
-
- MicroEMACS is a tool for creating and changing documents,
- programs, and other text files. It is both relatively easy for the
- novice to use, but also very powerful in the hands of an expert.
- MicroEMACS can be extensively customized for the needs of the
- individual user.
-
- MicroEMACS allows several files to be edited at the same time.
- The screen can be split into different windows, and text may be moved
- freely from one window to the next. Depending on the type of file being
- edited, MicroEMACS can change how it behaves to make editing simple.
- Editing standard text files, program files and word processing documents
- are all possible at the same time.
-
- There are extensive capabilities to make word processing and
- editing easier. These include commands for string searching and
- replacing, paragraph reformatting and deleting, automatic word wrapping,
- word move and deletes, easy case controlling, and automatic word counts.
-
- For complex and repetitive editing tasks editing macros can be
- written. These macros allow the user a great degree of flexibility in
- determining how MicroEMACS behaves. Also any and all the commands can
- be used by any keystroke by changing, or rebinding, what commands
- various keys are connected, or bound, to.
-
- Special features are also available to perform a diverse set of
- operations such as file encryption, automatic backup file generation,
- entabbing and detabbing lines, executing of DOS commands and filtering
- of text through other programs (like SORT to allow sorting text).
-
- @flushleft(@b[History])
-
- EMACS was originally a text editor written by Richard Stahlman
- at MIT in the early 1970s for Digital Equipment computers. Various
- versions, rewrites and clones have made an appearance since.
-
- This version of MicroEMACS is derived from code written by Dave
- G. Conroy in 1985. Later modifications were performed by Steve Wilhite
- and George Jones. In December of 1985 Daniel Lawrence picked up the
- then current source (version 2.0) and has made extensive modifications
- and additions to it over the course of the next two years. Updates and
- support for the current version is still in progress. The current
- program author can be contacted by writing to:
-
- @begin(verbatim)
- USMAIL: Daniel Lawrence
- 617 New York St
- Lafayette, IN 47901
-
- UUCP: ihnp4!pur-ee!pur-phy!duncan!lawrence
- ARPA: nwd@@j.cc.purdue.edu
- FIDO: Fido 201/2 The Programmer's Room (317) 742-5533
- @end(verbatim)
- @string(ChapterTitle="")
- @set(page = 0)
- @pageheading(even, left "@title[Chapter]", right "MicroEMACS Reference Manual")
- @pageheading(odd, left "MicroEMACS Reference Manual", right "@title[Chapter]")
- @pagefooting(even, left="@value(page)")
- @pagefooting(odd, right="@value(page)")
- @chapter(Basic Concepts)
-
- The current version of MicroEMACS is 3.8i (Third major re-write,
- eighth public release, Ith (or ninth) minor release), and for the rest of
- this document, we shall simply refer to this version as "EMACS". Any
- modifications for later versions will be listed in the appendixes at the
- end of this manual.
-
- @section(Keys and the Keyboard)
-
- Many times throughout this manual we will be talking about
- @index(special keys) commands and the keys on the keyboard needed use
- them. There are a number of "special" keys which can be used and are
- listed here:
-
- @begin(description)
- <NL>@\NewLine which is also called RETURN or ENTER, this key is used to
- @index(newline) end different commands.
-
- ^@\The control key can be used before any alphabetic character and some
- symbols. For example, ^C means to hold down the <CONTROL> key and type
- @index(control key) the C key at the same time.
-
- ^X@\The CONTROL-X key is used at the beginning of many different
- @index(control-x) commands.
-
- META or M-@\This is a special EMACS key used to begin many commands as
- @index(meta key) well. This key is pressed, and then released before
- typing the next character. On most systems, this is the <ESC> key, but
- it can be changed. (consult appendix D to learn what key is used for
- META on your computer).
- @end(description)
-
- Whenever a command is described, the manual will list the actual
- keystrokes needed to execute it in @b(boldface) using the above
- conventions, and also the name of the command in @i(italics).
- @section(Getting Started)
-
- In order to use EMACS, you must call it up from your system's or
- computer's command prompt. On UNIX and MSDOS machines, just type
- "emacs" from the main command prompt and follow it with the <RETURN> or
- <ENTER> key (we will refer to this key as <NL> for "new-line" for the
- remainder of this manual). On the Macintosh, the Amiga, the ATARI ST
- and other icon based operating systems, double click on the uEMACS icon.
- Shortly after this, a screen similar to the one below should appear.
-
- @section(Parts and Pieces)
-
- The screen is divided into a number of areas or @b<windows>. On
- some systems the top window contains a function list of unshifted and
- @index(windows) shifted function keys. We will discuss these keys later.
- @index(mode line) Below them is an EMACS @b<mode line> which, as we will
- see, informs you of the present mode of operation of the editor--for
- example "(WRAP)" if you set EMACS to wrap at the end of each line.
- @index(text window) Under the mode line is the @b<text window> where text
- appears and is manipulated. Since each window has its own mode line,
- below the text window is it's mode line. The last line of the screen is
- the @b(command line) where EMACS takes commands and reports on what it
- is doing.
-
- @begin(verbatim)
- ===============================================================================
- f1 search f2 search back : F1 toggle function list F2 toggle help file
- f3 hunt f4 hunt back : F3 find command/apropos F4 describe key
- f5 next window f6 exec macro : F5 reformat paragraph F6 ref undented region
- f7 find file f8 exec file : F7 indent region F8 undent region
- f9 save file f10 exit emacs : F9 execute DOS command F10 shell up
- ===============================================================================
- -- MicroEMACS 3.8i () -- Function Keys ---------------------------------------
- ===============================================================================
-
- ===============================================================================
- -- MicroEMACS 3.8i () -- Main ------------------------------------------------
- ===============================================================================
- Fig 1: EMACS screen on an IBM-PC
- @end(verbatim)
-
- @section(Entering Text)
-
- Entering text in EMACS is simple. Type the following sentence fragment:
-
- @quotation<Fang Rock lighthouse, center of a series of mysterious and>
-
- @flushleft(The text is displayed at the top of the text window. Now type:)
-
- @quotation<terrifying events at the turn of the century>
-
- Notice the text to the left of the cursor disappears and a '$' sign
- appears. Don't panic--your text is safe!!! You've just discovered that
- EMACS doesn't "wrap" text to the next line like most word processors
- unless you hit <NL>. But since EMACS is used for both word processing,
- and text editing, it has a bit of a dual personality. You can change
- @index(modes) the way it works by setting various @b(modes). In this
- case, you need to set @b(WRAP) mode, using the @i(add-mode)
- @index(add-mode) command, by typing @b(^X-M). The command line at the
- base of the screen will prompt you for the mode you wish to add. Type
- @b<wrap> followed by the <NL> key and any text you now enter will be
- wrapped. However, the command doesn't wrap text already entered. To
- get rid of the truncated line, delete characters with the <BACKSPACE>
- key until the '$' goes away. Now type in the words you deleted, watch
- how EMACS goes down to the next line at the right time. @i{(In some
- versions of EMACS, @b<WRAP> is a default mode in which case you don't
- have to worry about the instructions relating to adding this mode.)}
-
- Now let's type a longer insert. Hit <NL> a couple of times to tab
- down from the text you just entered. Now type the following paragraphs.
- Press <NL> twice to indicate a paragraph break.
-
- @quotation<Fang Rock lighthouse, center of a series of mysterious and
- terrifying events at the turn of the century, is built on a rocky island
- a few miles of the Channel coast. So small is the island that wherever
- you stand its rocks are wet with sea spray.
-
- The lighthouse tower is in the center of the island. A steep flight of
- steps leads to the heavy door in its base. Winding stairs lead up to
- the crew room.>
-
- @section<Basic cursor movement>
-
- Now let's practice moving around in this text. To move the cursor back
- to the word "Winding," enter @b<M-B> @i(previous-word)
- @index(previous-word). This command moves the cursor backwards by one
- word at a time. Note you have to press the key combination every time
- the cursor steps back by one word. Continuously pressing META and
- toggling B produces an error message. To move forward to the word
- "stairs" enter @b<M-F>, which moves the cursor forward by one word at a
- time.
-
- Notice that EMACS commands are usually mnemonic--F for forward, B for
- backward, for example.
-
- To move the cursor up one line, enter @b<^P> @i(previous-line)
- @index(previous-line), down one line @b<^N> @i(next-line)
- @index(next-line). Practice this movement by moving the cursor to the
- word "terrifying" in the second line.
-
- The cursor may also be moved forward or backward in smaller increments.
- To move forward by one character, enter @b<^F> @i(forward-character)
- @index(forward-character), to move backward, @b<^B>
- @i(backward-character) @index(backward-character). EMACS also allows
- you to specify a number which is normally used to tell a command to
- execute many times. To repeat most commands, press META and then the
- number before you enter the command. Thus, the command META 5 ^F
- (@b<M-5^F>) will move the cursor forward by five characters. Try moving
- around in the text by using these commands. For extra practice, see how
- close you can come to the word "small" in the first paragraph by giving
- an argument to the commands listed here.
-
- Two other simple cursor commands that are useful to help us move around
- in the text are @b<M-N> @i(next-paragraph) @index(next-paragraph) which
- moves the cursor to the second paragraph, and @b<M-P>
- @i(previous-paragraph) @index(previous-paragraph) which moves it back to
- the previous paragraph. The cursor may also be moved rapidly from one
- end of the line to the other. Move the cursor to the word "few" in the
- second line. Press @b<^A> @i(beginning-of-line)
- @index(beginning-of-line). Notice the cursor moves to the word "events"
- at the beginning of the line. Pressing @b<^E> @i(end-of-line)
- @index(end-of-line) moves the cursor to the end of the line.
-
- Finally, the cursor may be moved from any point in the file to the end
- or beginning of the file. Entering @b{M->} @i(end-of-file)
- @index(end-of-file) moves the cursor to the end of the buffer, @b{M-<}
- @i(beginning-of-file) @index(beginning-of-file) to the first character
- of the file.
-
- @i(On the IBM-PC, the ATARI ST and many other machines, the cursor keys
- @index(cursor keys) can also be used to move the cursor about. Also, if
- there is one available, moving the mouse will move the cursor.)
-
- Practice moving the cursor in the text until you are comfortable with
- the commands we've explored in this chapter.
-
- @section(Saving your text)
-
- When you've finished practicing cursor movement, save your file. Your
- @index(buffer) file currently resides in a @b<BUFFER>. The buffer is a
- temporary storage area for your text, and is lost when the computer is
- turned off. You can save the buffer to a file by entering @b<^X-^S>
- @i(save-file) @index(save-file). Notice that EMACS informs you that
- your file has no name and will not let you save it.
-
- To save your buffer to a file with a different name than it's current
- one (which is empty), press @b<^X^W> @i(write-file) @index(write-file).
- EMACS will prompt you for the filename you wish to write. Enter the
- name @b<fang.txt> and press return. On a micro, the drive light will
- come on, and EMACS will inform you it is writing the file. When it
- finishes, it will inform you of the number of lines it has written to
- the disk.
-
- Congratulations!! You've just saved your first EMACS file!
- @newpage
- @heading(Chapter @value(chapter) Summary)
-
- In chapter @value(chapter), you learned how to enter text, how
- to use wrap mode, how to move the cursor, and to save a buffer. The
- following is a table of the commands covered in this chapter and their
- corresponding key bindings:
-
- @begin{verbatim}
- @u(Key Binding Keystroke Effect)
-
- abort-command @b<^G> aborts current command
-
- add-mode @b<^XM> allows addition of EMACS
- mode such as @b(WRAP)
-
- backward-character @b<^B> moves cursor left one character
-
- beginning-of-file @b{M-<} moves cursor to beginning of file
-
- beginning-of-line @b<^A> moves cursor to beginning of line
-
- end-of-file @b{M->} moves cursor to end of file
-
- end-of-line @b<^E> moves cursor to end of line
-
- forward-character @b<^F> moves cursor right one character
-
- next-line @b<^N> moves cursor to next line
-
- next-paragraph @b<M-N> moves cursor to next paragraph
-
- next-word @b<M-F> moves cursor forward one word
-
- previous-line @b<^P> moves cursor backward by one line
-
- previous-paragraph @b<M-P> moves cursor to previous paragraph
-
- previous-word @b<M-B> moves cursor backward by one word
-
- save-file @b<^X-^S> saves current buffer to a file
-
- write-file @b<^X-^W> save current buffer under a new name
- @end(verbatim)
- @newpage
- @chapter(Basic Editing--Simple Insertions and Deletions)
-
- @section<A Word About Windows, Buffers, Screens, and Modes>
-
- In the first chapter, you learned how to create and save a file in
- EMACS. Let's do some more editing on this file. Call up emacs by
- typing in the following command.
-
- @b<emacs fang.txt>
-
- @i(On icon oriented systems, double click on the uEMACS icon, usually a
- file dialog box of some sort will appear. Choose @b(FANG.TXT) from the
- appropriate folder.)
-
- Shortly after you invoke EMACS, the text should appear on the screen
- ready for you to edit. The text you are looking at currently resides in
- a @b<buffer>. A buffer is a temporary area of computer memory which is
- @index(buffer) the primary unit internal to EMACS -- this is the place
- where EMACS goes to work. The mode line at the bottom of the screen
- lists the buffer name, @b<FANG.TXT> and the name of the file with which
- this buffer is associated, @b<FANG.TXT>
-
- The computer talks to you through the use of its @b(screen). This
- @index(screen) screen usually has an area of 24 lines each of 80
- characters across. You can use EMACS to subdivide the screen into
- several separate work areas, or @b(windows), each of which can be
- @index(window) 'looking into' different files or sections of text. Using
- windows, you can work on several related texts at one time, copying and
- moving blocks of text between windows with ease. To keep track of what
- you are editing, each window is identified by a @b(mode line) on the
- @index(mode line) @index(buffer) last line of the window which lists the
- name of the @b(buffer) which it is looking into, the file from which the
- text was read, and how the text is being edited.
-
- An EMACS @b<mode> tells EMACS how to deal with user input. As we have
- already seen, the mode 'WRAP' controls how EMACS deals with long lines
- (lines with over 79 characters) while the user is typing them in. The
- 'VIEW' mode, allows you to read a file without modifying it. Modes are
- associated with buffers and not with files; hence, a mode needs to be
- explicitly set or removed every time you edit a file. A new file read
- into a buffer with a previously specified mode will be edited under this
- mode. If you use specific modes frequently, EMACS allows you to set
- the modes which are used by all new buffers, called @b<global> modes.
-
- @section<Insertions>
-
- Your previously-saved text should look like this:
-
- @quotation<Fang Rock lighthouse, center of a series of mysterious and
- terrifying events at the turn of the century, is built on a rocky island
- a few miles of the Channel coast. So small is the island that wherever
- you stand its rocks are wet with sea spray.
-
- The lighthouse tower is in the center of the island. A steep flight of
- steps leads to the heavy door in its base. Winding stairs lead up to
- the crew room.>
-
- Let's assume you want to add a sentence in the second paragraph after
- the word "base." Move the cursor until it is on the "W" of "Winding".
- Now type the following:
-
- @quotation<This gives entry to the lower floor where the big steam
- generator throbs steadily away, providing power for the electric
- lantern.>
-
- If the line fails to wrap and you end up with a '$' sign in the right
- margin, just enter @b{M-Q} @i(fill-paragraph) @index(fill-paragraph) to
- reformat the paragraph. This new command attempts to fill out a
- paragraph. Long lines are divided up, and words are shuffled around to
- make the paragraph look nicer.
-
- Notice that all visible EMACS characters are self-inserting -- all you
- had to do was type the characters to insert and the existing text made
- space for it. With a few exceptions discussed later, all non-printing
- characters (such as control or escape sequences) are commands. To
- insert spaces, simply use the space bar. Now move to the first line of
- the file and type @b{^O} @i(open-line) @index(open-line) (Oh, not zero).
- You've just learned how to insert a blank line in your text.
-
- @section<Deletions>
-
- EMACS offers a number of deletion options. For example, move the cursor
- until it's under the period at the end of the insertion you just did.
- Press the backspace key. Notice the "n" on "lantern" disappeared. The
- backspace implemented on EMACS is called a @b<destructive> backspace--it
- removes text immediately before the current cursor position from the
- buffer. Now type @b<^H> @i(delete-previous-character)
- @index(delete-previous-character). Notice that the cursor moves back
- and obliterates the "r"--either command will backspace the cursor.
-
- Type in the two letters you erased to restore your text and move the
- cursor to the beginning of the buffer @b{M->} @i(beginning-of-file)
- @index(beginning-of-file). Move the cursor down one line to the
- beginning of the first paragraph.
-
- To delete the forward character, type @b{^D} @i(delete-next-character)
- @index(delete-next-character). The "F" of "Fang" disappears. Continue
- to type @b{^D} until the whole word is erased EMACS also permits the
- deletion of larger elements of text. Move the cursor to the word
- "center" in the first line of text. Pressing @b{M-<backspace>}
- @i(delete-previous-word) @index(delete-previous-word) kills the word
- immediately before the cursor. @b{M-^H} has the same effect.
-
- Notice that the commands are very similar to the control commands you
- used to delete individual letters. As a general rule in EMACS, control
- sequences affect small areas of text, META sequences larger areas. The
- word forward of the cursor position can therefore be deleted by typing
- @b{M-D} @i(delete-next-word) @index(delete-next-word). Now let's take
- out the remainder of the first line by typing @b{^K}
- @i(kill-to-end-of-line) @index(kill-to-end-of-line). You now have a
- blank line at the top of your screen. Typing @b{^K} again or @b{^X-^O}
- @i(delete-blank-lines) @index(delete-blank-lines) deletes the blank line
- and flushes the second line to the top of the text. Now exit EMACS by
- typing @b{^X-^C} @i(exit-emacs) @index(exit-emacs). Notice EMACS
- reminds you that you have not saved your buffer. Ignore the warning and
- exit. This way you can exit EMACS without saving any of the changes you
- just made.
-
- @heading(Chapter @value(chapter) Summary)
-
- In Chapter @value(chapter), you learned about the basic 'building
- blocks' of an EMACS text file--buffers, windows, and files.
-
- @begin{verbatim}
- @u(Key binding Keystroke Effect)
- delete-previous-character
- @b{^H} deletes character immediately before
- the current cursor position
-
- delete-next-character @b{^D} deletes character immediately after
- current cursor position
-
- delete-previous-word @b{M-^H} deletes word immediately before
- current cursor position
-
- delete-next-word @b{M-D} deletes word immediately after
- current cursor position
-
- kill-to-end-of-line @b<^K> deletes from current cursor
- position to end of line
-
- insert-space @b<^C> inserts a space to right of cursor
-
- open-line @b{^O} inserts blank line
-
- delete-blank-lines @b{^X-^O} removes blank line
-
- exit-emacs @b{^X-^C} exits emacs
- @end(verbatim)
- @chapter(Using Regions)
-
- @section(Defining and Deleting a Region)
-
- At this point its time to familiarize ourselves with two more EMACS
- terms--the @b<point> and the @b<mark>. The point is located directly
- @index(point) @index(mark) behind the current cursor position. The mark
- (as we shall see shortly) is user defined. These two elements together
- are called the current @b(region) and limit the @b<region> of text on
- which EMACS performs many of its editing functions.
-
- Let's begin by entering some new text. Don't forget to add @b(wrap)
- mode if its not set on this buffer. Start EMACS and open a file called
- @b{PUBLISH.TXT}. Type in the following text:
-
- @quotation{One of the largest growth areas in personal computing is
- electronic publishing. There are packages available for practically
- every machine from elegantly simple programs for the humble Commodore 64
- to sophisticated professional packages for PC and Macintosh computers.
-
- Electronic publishing is as revolutionary in its way as the Gutenburg
- press. Whereas the printing press allowed the mass production and
- distribution of the written word, electronic publishing puts the means
- of production in the hands of nearly every individual. From the class
- magazine to the corporate report, electronic publishing is changing the
- way we produce and disseminate information.
-
- Personal publishing greatly increases the utility of practically every
- computer. Thousands of people who joined the computer revolution of
- this decade only to hide their machines unused in closets have
- discovered a new use for them as dedicated publishing workstations.}
-
- Now let's do some editing. The last paragraph seems a little out of
- place. To see what the document looks like without it we can cut it
- from the text by moving the cursor to the beginning of the paragraph.
- Enter @b(M-<space>) @i(set-mark) @index(set-mark). EMACS will respond
- with "[Mark set]". Now move the cursor to the end of the paragraph.
- You have just defined a region of text. To remove this text from the
- screen, type @b<^W> @i(kill-region) @index(kill-region). The paragraph
- disappears from the screen.
-
- On further consideration, however, perhaps the paragraph we cut wasn't
- so bad after all. The problem may have been one of placement. If we
- could tack it on to the end of the first paragraph it might work quite
- well to support and strengthen the argument. Move the cursor to the end
- of the first paragraph and enter @b<^Y> @i(yank) @index(yank). Your
- text should now look like this:
-
- @quotation{One of the largest growth areas in personal computing is
- electronic publishing. There are packages available for practically
- every machine from elegantly simple programs for the humble Commodore 64
- to sophisticated professional packages for PC and Macintosh computers.
- Personal publishing greatly increases the utility of practically every
- computer. Thousands of people who joined the computer revolution of
- this decade only to hide their machines unused in closets have
- discovered a new use for them as dedicated publishing workstations.
-
- Electronic publishing is as revolutionary in its way as the Gutenburg
- press. Whereas the printing press allowed the mass production and
- distribution of the written word, electronic publishing puts the means
- of production in the hands of nearly every individual. From the class
- magazine to the corporate report, electronic publishing is changing the
- way we produce and disseminate information.}
-
- @section(Yanking a Region)
-
- The text you cut initially didn't simply just disappear, it was cut into
- a buffer that retains the 'killed' text appropriately called the @b<kill
- buffer>. @b<^Y> "yanks" the text back from this buffer into the current
- buffer. If you have a long line (indicated, remember, by the "$"
- sign), simply hit @b{M-Q} to reformat the paragraph.
-
- There are other uses to which the kill buffer can be put. Using the
- @index(kill buffer) method we've already learned, define the last
- paragraph as a region. Now type @b<M-W> @i(copy-region)
- @index(copy-region). Nothing seems to have happened; the cursor stays
- blinking at the point. But things have changed, even though you may not
- be able to see any alteration.
-
- To see what has happened to the contents of the kill buffer, move the
- cursor down a couple of lines and "yank" the contents of the kill buffer
- back with @b<^Y>. Notice the last paragraph is now repeated. The
- region you defined is "tacked on" to the end of your file because
- @b<M-W> @b<copies> a region to the kill buffer while leaving the
- original text in your working buffer. Some caution is needed however,
- because the contents of the kill buffer are updated when you delete any
- regions, lines or words. If you are moving large quantities of text,
- complete the operation before you do any more deletions or you could
- find that the text you want to move has been replaced by the most recent
- deletion. Remember--a buffer is a temporary area of computer memory
- that is lost when the machine is powered down or switched off. In order
- to make your changes permanent, they must be saved to a file before you
- leave EMACS. Let's delete the section of text we just added and save
- the file to disk.
-
- @heading(Chapter @value(chapter) Summary)
-
- In Chapter @value(chapter), you learned how to achieve longer insertions
- and deletions. The EMACS terms @b<point> and @b<mark> were introduced
- and you learned how to manipulate text with the kill buffer.
-
- @begin{verbatim}
- @begin(group)
- @u(Key Binding Keystroke Effect)
-
- Delete-Region @b{^W} Deletes region between point and mark and
- places it in KILL buffer
-
- Copy-Region @b{M-W} Copies text between point and mark into
- KILL buffer
-
- Yank-Text @b{^Y} Inserts a copy of the KILL buffer into
- current buffer at point
- @end(group)
- @end(verbatim)
- @chapter(Search and Replace)
-
- @section<Forward Search>
-
- Load EMACS and bring in the file you just saved. Your file should look
- like the one below.
-
- @quotation{One of the largest growth areas in personal computing is
- electronic publishing. There are packages available for practically every
- machine from elegantly simple programs for the humble Commodore 64 to
- sophisticated professional packages for PC and Macintosh computers.
- Personal publishing greatly increases the utility of practically every
- computer. Thousands of people who joined the computer revolution of
- this decade only to hide their machines unused in closets have
- discovered a new use for them as dedicated publishing workstations.
-
- Electronic publishing is as revolutionary in its way as the Gutenburg
- press. Whereas the printing press allowed the mass production and
- distribution of the written word, electronic publishing puts the means
- of production in the hands of nearly every individual. From the class
- magazine to the corporate report, electronic publishing is changing the
- way we produce and disseminate information.}
-
- Let's use EMACS to search for the word "revolutionary" in the second
- paragraph. Because EMACS searches from the current cursor position
- toward the end of buffers, and we intend to search forward, move the
- cursor to the beginning of the text. Enter @b<^S> @i(search-forward)
- @index(search-forward). Note that the command line now reads
-
- "Search [] <META>:"
-
- EMACS is prompting you to enter the @b<search string> -- the text you
- want to find. Enter the word @b<revolutionary> and hit the @b<META>
- key. The cursor moves to the end of the word "revolutionary."
-
- Notice that you must enter the <META> key to start the search. If you
- @index(<NL>) simply press <NL> the command line responds with "<NL>".
- Although this may seem infuriating to users who are used to pressing the
- return key to execute any command, EMACS' use of <META> to begin
- searches allows it to pinpoint text with great accuracy. After every
- line wrap or carriage return, EMACS 'sees' a new line character (<NL>).
- If you need to search for a word at the end of a line, you can specify
- this word uniquely in EMACS.
-
- In our sample text for example, the word "and" occurs a number of times,
- but only once at the end of a line. To search for this particular
- occurrence of the word, move the cursor to the beginning of the buffer
- and type @b(^S). Notice that EMACS stores the last specified
- @index(default string) search string as the @b<default> string. If you
- press @b{<META>} now, EMACS will search for the default string, in this
- case, "revolutionary."
-
- To change this string so we can search for our specified "and" simply
- enter the word @b{and} followed by @b{<NL>}. The command
- line now shows:
-
- "search [and<NL>]<META>:"
-
- Press @b{<META>} and the cursor moves to "and" at the end of the second
- last line.
-
- @section<Exact Searches>
-
- If the mode EXACT is active in the current buffer, EMACS searches on a case
- sensitive basis. Thus, for example you could search for @b{Publishing}
- as distinct from @b{publishing}.
-
- @section<Backward Search>
-
- Backward searching is very similar to forward searching except that it
- is implemented in the reverse direction. To implement a reverse search,
- type @b{^R} @i(search-reverse) @index(search-reverse). Because EMACS
- makes no distinction between forward and backward stored search strings,
- the last search item you entered appears as the default string. Try
- searching back for any word that lies between the cursor and the
- beginning of the buffer. Notice that when the item is found, the point
- moves to the beginning of the found string (i.e., the cursor appears
- under the first letter of the search item).
-
- Practice searching for other words in your text.
-
- @section<Searching and Replacing>
-
- Searching and replacing is a powerful and quick way of making changes to
- your text. Our sample text is about electronic publishing, but the
- correct term is 'desktop' publishing. To make the necessary changes we
- need to replace all occurrences of the word "electronic" with "desktop."
- First, move the cursor to the top of the current buffer with the @b(M-<)
- command. Then type @b[M-R] @i(replace-string) @index(replace-string).
- The command line responds:
-
- "Replace []<META>:"
-
- where the square brackets enclose the default string. Type the word
- @b<electronic> and hit @b{<META>}. The command line responds:
-
- "with []<META>"
-
- type @b{desktop<META>}. EMACS replaces all instances of the original
- word with your revision. Of course, you will have to capitalize the
- first letter of "desktop" where it occurs at the beginning of a
- sentence.
-
- You have just completed an @b<unconditional replace>. In this
- operation, EMACS replaces every instance of the found string with the
- replacement string.
-
- @section<Query-Replace>
-
- You may also replace text on a case by case basis. The @b{M-^R}
- @i(query-replace-string) @index(query-replace-string) command causes
- EMACS to pause at each instance of the found string.
-
- For example, assume we want to replace some instances of the word
- "desktop" with the word "personal." Go back to the beginning of the
- current buffer and enter the @b(M-^R) @i(query-replace)
- @index(query-replace) command. The procedure is very similar to that
- which you followed in the unconditional search/replace option. When the
- search begins however, you will notice that EMACS pauses at each
- instance of "publishing" and asks whether you wish to replace it with
- the replacement string. You have a number of options available for
- response:
-
- @begin(verbatim)
- @u( Response Effect)
- Y(es) Make the current replacement and skip to the next
- occurrence of the search string
-
- N(o) Do not make this replacement but continue
-
- ! Do the rest of the replacements with no more queries
-
- U(ndo) Undo just the last replacement and query for it
- again (This can only go back ONE time)
-
- ^G Abort the replacement command (This action does not
- undo previously-authorized replacements
-
- . Same effect as ^G, but cursor returns to the point at
- which the replacement command was given
-
- ? This lists help for the query replacement command
- @end(verbatim)
-
- Practice searching and searching and replacing until you feel
- comfortable with the commands and their effects.
- @begin(group)
- @heading(Chapter @value(chapter) Summary)
-
- In this chapter, you learned how to search for specified strings of text
- in EMACS. The chapter also dealt with searching for and replacing
- elements within a buffer.
-
- @begin(verbatim)
- @u(Key Binding Keystroke Effect)
-
- Search-Forward @b{^S} Searches from point to end of buffer.
- Point is moved from current location to
- the end of the found string
-
- Search-Backward @b{^R} Searches from point to beginning of buffer.
- Point is moved from current location to
- beginning of found string
-
- Replace @b{M-R} Replace ALL occurrences of search string with
- specified (null) string from point to the
- end of the current buffer
-
- Query-Replace @b{M-^R} As above, but pause at each found string
- and query for action
- @end(verbatim)
- @end(group)
- @chapter(Windows)
-
- @section<Creating Windows>
-
- We have already met windows in an earlier chapter. In this chapter, we
- will explore one of EMACS' more powerful features -- text manipulation
- through multiple windowing.
-
- You will recall that windows are areas of buffer text that you can see
- @index(windows) on the screen. Because EMACS can support several screen
- windows simultaneously you can use them to look into different places in
- the same buffer. You can also use them to look at text in different
- buffers. In effect, you can edit several files at the same time.
-
- Let's invoke EMACS and pull back our file on desktop publishing by
- typing
-
- @quotation<emacs publish.txt>
-
- When the text appears, type the @b{^X-2} @i(split-current-window)
- @index(split-current-window) command. The window splits into two
- windows. The window where the cursor resides is called the @b<current>
- window -- in this case the bottom window. Notice that each window has a
- text area and a mode line. The @b(command line) is however, common to
- all windows on the screen.
-
- The two windows on your screen are virtually mirror images of each other
- because the new window is opened into the same buffer as the one you are
- in when you issue the Open-Window command. All commands issued to EMACS
- are executed on the current buffer in the current window.
-
- To move the cursor to the upper window (i.e., to make that window the
- current window, type @b{^X-P} @i(previous-window)
- @index(previous-window). Notice the cursor moves to the upper or
- @b<previous> window. Entering @b{^X-O} @i(next-window) moves to the
- @b{next} window. Practice moving between windows. You will notice that
- you can also move into the Function Key menu by entering these commands.
-
- Now move to the upper window. Let's open a new file. On the EMACS disk
- is a tutorial file. Let's call it into the upper window by typing:
-
- @quotation<@b[^X-^F] @i(find-file) @index(find-file)>
-
- @flushleft(and press return. Then enter the filename @b<emacs.tut>.)
-
- In a short time, the tutorial file will appear in the window. We now
- have two windows on the screen, each looking into different buffers. We
- have just used the @b(^X- ^F) @i(find-file) @index(find-file) command to
- find a file and bring it into our current window.
-
- You can scroll any window up and down with the cursor keys, or with the
- commands we've learned so far. However, because the area of visible
- text in each window is relatively small, you can scroll the current
- window a line at a time.
-
- Type @b{^X-^N} @i(move-window-down) @index(move-window-down)
-
- The current window scrolls down by one line -- the top line of text
- scrolls out of view, and the bottom line moves towards the top of the
- screen. You can imagine, if you like, the whole window slowly moving
- down to the end of the buffer in increments of one line. The command
- @b{^X-^P} @i(move-window-up) @index(move-window-up) scrolls the window
- in the opposite direction.
-
- As we have seen, EMACS editing commands are executed in the current
- window, but the program does support a useful feature that allows you to
- scroll the @b<next> window. @b<M-^Z> @i(scroll-next-up)
- @index(scroll-next-up) scrolls the next window up, @b{M-^U}
- @i(scroll-next-down) @index(scroll-next-down) scrolls it downward. From
- the tutorial window, practice scrolling the window with the desktop
- publishing text in it up and down.
-
- When you're finished, exit EMACS without saving any changes in your
- files.
-
- Windows offer you a powerful and easy way to edit text. By
- manipulating a number of windows and buffers on the screen
- simultaneously, you can perform complete edits and revisions on the
- computer screen while having your draft text or original data
- available for reference in another window.
-
- Experiment with splitting the windows on your screen. Open windows into
- different buffers and experiment with any other files you may have. Try
- editing the text in each window, but
- don't forget to save any changes you want to keep -- you still have to
- save each buffer separately.
-
- @section(Deleting Windows)
-
- @section(Resizing Windows)
-
- @section(Other Window commands)
-
- @newpage
- @heading(Chapter @value(chapter) Summary)
-
- In Chapter @value(chapter) you learned how to manipulate windows and the
- editing flexibility they offer.
-
- @begin{verbatim}
- @u(Key Binding Keystroke Effect)
-
- Open-Window @b{^X-2} Splits current window into two windows
- if space is available
-
- Close-Windows @b{^X-1} Closes all windows except current
- window
-
- Next-Window @b{^X-O} Moves point into next (i.e. downward)
- window
-
- Previous-Window @b{^X-P} Moves point to previous (i.e. upward)
- window
-
- Move-Window-Down @b{^X-^N} Scrolls current window down one line
-
- Move-Window-Up @b{^X-^P} Scrolls current window up one line
-
- Redraw-display @b{M-!} or Window is moved so line with point
- @b{M-^L} (with cursor) is at center of window
-
- Grow-Window @b{^X-^} Current window is enlarged by one
- line and nearest window is shrunk by
- one line
-
- Shrink-Window @b{^X-^Z} Current window is shrunk by one line
- and nearest window is enlarged by one
- line
-
- Clear-and-Redraw @b{^L} Screen is blanked and redrawn. Keeps
- screen updates in sync with your
- commands
-
- Scroll-Next-Up @b{M-^Z} Scrolls next window up by one line
-
- Scroll-Next-Down @b{M-^U} Scrolls next window down by one line
- @end(verbatim)
- @chapter(Buffers)
-
- @index(buffers) We have already learned a number of things about buffers.
- As you will recall, they are the major internal entities in EMACS -- the
- place where editing commands are executed. They are characterized by
- their @b<names>, their @b<modes>, and by the file with which they are
- associated. Each buffer also "remembers" its @b(mark) and @b(point).
- This convenient feature allows you to go to other buffers and return to
- the original location in the "current" buffer.
-
- Advanced users of EMACS frequently have a number of buffers in the
- computer's memory simultaneously. In the last chapter, for example, you
- opened at least two buffers -- one into the text you were editing, and
- the other into the EMACS on-line tutorial. If you deal with complex
- text files -- say, sectioned chapters of a book, you may have five or
- six buffers in the computer's memory. You could select different
- buffers by simply calling up the file with @b{^X-^F} @i(find-file)
- @index(find-file), and let EMACS open or reopen the buffer. However,
- EMACS offers fast and sophisticated buffering techniques that you will
- find easy to master and much more convenient to use.
-
- Let's begin by opening three buffers. You can open any three you
- choose, for example call the following files into memory: @b(fang.txt),
- @b(publish.txt), and @b(emacs.tut) in the order listed here. When
- you've finished this process, you'll be looking at a screen showing the
- EMACS tutorial. Let's assume that you want to move to the fang.txt
- buffer. Enter:
-
- @b{^X-X} @i(next-buffer) @index(next-buffer)
-
- This command moves you to the @u<next> buffer. Because EMACS cycles
- through the buffer list, which is alphabetized, you will now be in the
- @b(fang.txt) buffer. Using @b(^X-X) again places you in the
- @b(publish.txt) buffer. @i(If you are on a machine that supports
- function keys, using @b[^X-X] again places you in the @b(Function Keys)
- buffer). Using @b(^X-X) one last time cycles you back to the beginning
- of the list.
-
- If you have a large number of buffers to deal with, this cycling process
- may be slow and inconvenient. The command @b{^X-B} @i(select-buffer)
- @index(select-buffer) allows you to specify the buffer you wish to be
- switched to. When the command is entered, EMACS prompts, "Use buffer:".
- Simply enter the buffer name (NOT the file name), and that buffer will
- then become the current buffer.
-
- Multiple buffer manipulation and editing is a complex activity, and you
- will probably find it very inconvenient to re-save each buffer as you
- modify it. The command @b{^X-^B} @i(list-buffers) @index(list-buffers)
- creates a new window that gives details about all the buffers currently
- known to EMACS. Buffers that have been modified are identified by the
- "buffer changed" indicator (an asterisk in the second column). You can
- thus quickly and easily identify buffers that need to be saved to files
- before you exit EMACS. The buffer window also provides other
- information -- buffer specific modes, buffer size, and buffer name are
- also listed. To close this window, simply type the close-windows
- command, @b{^X-1}.
-
- To delete any buffer, type @b{^X-K} @i(delete-buffer)
- @index(delete-buffer). EMACS prompts you "Kill buffer:". Enter the
- buffer name you want to delete. As this is destructive command, EMACS
- will ask for confirmation if the buffer was changed and not saved.
- Answer Y(es) or N(o). As usual @b{^G} cancels the command.
-
- @newpage
- @heading(Chapter @value(chapter) Summary)
-
- In Chapter @value(chapter) you learned how to manipulate buffers.
-
- @begin{verbatim}
- @u(Key Binding Keystroke Effect)
- Next-Buffer @b(^X-^X) Switch to the next buffer in the
- buffer list
-
- Select-Buffer @b(^X-B) Switch to a particular buffer
-
- List-Buffers @b(^X-^B) List all buffers
-
- Delete-Buffer @b(^X-K) delete a particular buffer if it
- is off-screen
- @end(verbatim)
- @chapter(Modes)
-
- EMACS allows you to change the way it works in order to
- customized it to the style of editing you are using. It does this by
- providing a number of different @b(modes) @index(modes). These modes
- can effect either a single buffer, or any new buffer that is created.
- To add a mode to the current buffer, type @b(^X-M) @i(add-mode)
- @index(add-mode). EMACS will then prompt you for the name of a mode to
- add. When you type in a legal mode name, and type a <NL>, EMACS will
- add the mode name to the list of current mode names in the mode line of
- the current buffer.
-
- To remove an existing mode, typing the @b(^X-^M) @i(delete-mode)
- @index(delete-mode) will cause EMACS to prompt you for the name of a
- mode to delete from the current buffer. This will remove that mode from
- the mode list on the current mode line.
-
- Global modes are the modes which are inherited by any new
- buffers which are created. For example, if you wish to always do string
- searching with character case being significant, you would want global
- mode EXACT to be set so that any new files read in inherent the EXACT
- mode. Global modes are set with the @b(M-M) @i(add-global-mode)
- @index(add-global-mode) command, and unset with the @b(M-^M)
- @i(delete-global-mode) @index(delete-global-mode) command. Also, the
- current global modes are displayed in the first line of a
- @b(^X-^B) @i(list-buffers) @index(list-buffers) command.
-
- On machines which are capable of displaying colors,
- @index(color) the mode commands can also set the background and
- foreground character colors. Using @i(add-mode) or @i(delete-mode) with
- a lowercase color will set the background color in the current window.
- An uppercase color will set the foreground color in the current window.
- Colors that EMACS knows about are: white, cyan, magenta, yellow, blue,
- red, green, and black. If the computer you are running on does not have
- eight colors, EMACS will attempt to make some intelligent guess at what
- color to use when you ask for one which is not there.
-
- @section(ASAVE mode)
-
- Automatic Save mode tells EMACS to automatically write out the
- current buffer to its associated file on a regular basis. Normally this
- will be every 256 characters typed into the file. The environment
- variable $ACOUNT counts down to the next auto-save, and $ASAVE is the
- value used to reset $ACOUNT after a save occurs.
-
- @section(CMODE mode)
-
- CMODE is useful to C programmers. When CMODE is active, EMACS
- will try to assist the user in a number of ways. This mode is set
- automatically with files that have a .c or .h extension.
-
- The <NL> key will normally attempt to return the user to the next
- line at the same level of indentation as the current line, unless the
- current line ends with a open brace ({) in which case the new line will
- be further indented by one tab position.
-
- A close brace (}) will delete one tab position preceding itself
- as it is typed. This should line up the close brace with its matching
- IF, FOR or WHILE statement.
-
- A pound sign (#) with only leading whitespace will delete all
- the whitespace preceding itself. This will always bring preprocessor
- directives flush to the left margin.
-
- Whenever any close fence is typed, i.e )]>}, if the matching open
- fence is on screen in the current window, the cursor will briefly flash
- to it, and then back. This makes balancing expressions, and matching
- blocks much easier.
-
- @section(CRYPT mode)
-
- When a buffer is in CRYPT mode, @index(encryption) it is
- encrypted whenever it is written to a file, and decrypted when it is
- read from the file. The encryption key can be specified on the command
- line with the -k switch, or with the @b(M-E) @i(set-encryption-key)
- @index(set-encryption-key) command. If you attempt to read or write a
- buffer in crypt mode and now key has not been set, EMACS will execute
- @i(set-encryption-key) automatically, prompting you for the needed key.
- Whenever EMACS prompts you for a key, it will not echo the key to your
- screen as you type it (i.e make SURE you get it right when you set it
- originally).
-
- The encryption algorithm used changes all characters into normal
- printing characters, thus the resulting file is suitable for sending via
- electronic mail. All version of MicroEMACS should be able decrypt the
- resulting file regardless of what machine encrypted it. Also available
- with EMACS is the stand alone program, MicroCRYPT, which can en/decrypt
- the files produced by CRYPT mode in EMACS.
-
- @section(EXACT mode)
-
- All string searches and replacements will take upper/lower case
- into account. Normally the case of a string during a search or replace
- is not taken into account.
-
- @section(MAGIC mode)
-
- In the MAGIC mode certain characters gain special meanings when
- used in a search pattern. Collectively they are know as regular
- expressions, and a limited number of them are supported in MicroEmacs.
- They grant greater flexibility when using the search command. However,
- they do not affect the incremental search command.
-
- The symbols that have special meaning in MAGIC mode are
- ^, $, ., *, [ (and ], used with it), and \.
-
- The characters ^ and $ fix the search pattern to the beginning and
- end of line, respectively. The ^ character must appear at the beginning
- of the search string, and the $ must appear at the end, otherwise they
- loose their meaning and are treated just like any other character. For
- example, in MAGIC mode, searching for the pattern "t$" would put the
- cursor at the end of any line that ended with the letter 't'. Note that
- this is different than searching for "t<NL>", that is, 't' followed by a
- newline character. The character $ (and ^, for that matter) matches a
- position, not a character, so the cursor remains at the end of the line.
- But a newline is a character that must be matched, just like any other
- character, which means that the cursor is placed just after it - on the
- beginning of the next line.
-
- The character . has a very simple meaning -- it matches any single
- character, except the newline. Thus a search for "bad.er" could match
- "badger", "badder" (slang), or up to the 'r' of "bad error".
-
- The character * is known as closure, and means that zero or more of
- the preceding character will match. If there is no character preceding,
- * has no special meaning, and since it will not match with a newline, *
- will have no special meaning if preceded by the beginning of line symbol
- ^ or the literal newline character <NL>.
-
- The notion of zero or more characters is important. If, for
- example, your cursor was on the line
-
- @quotation(This line is missing two vowels.)
-
- and a search was made for "a*", the cursor would not move, because it is
- guaranteed to match no letter 'a' , which satisfies the search
- conditions. If you wanted to search for one or more of the letter 'a',
- you would search for "aa*", which would match the letter a, then zero or
- more of them.
-
- The character [ indicates the beginning of a character class. It
- is similar to the 'any' character ., but you get to choose which
- characters you want to match. The character class is ended with the
- character ]. So, while a search for "ba.e" will match "bane", "bade",
- "bale", "bate", et cetera, you can limit it to matching "babe" and
- "bake" by searching for "ba[bk]e". Only one of the characters inside
- the [ and ] will match a character. If in fact you want to match any
- character except those in the character class, you can put a ^ as the
- first character. It must be the first character of the class, or else
- it has no special meaning. So, a search for [^aeiou] will match any
- character except a vowel, but a search for [aeiou^] will match any vowel
- or a ^.
-
- If you have a lot of characters in order that you want to put in the
- character class, you may use a dash (-) as a range character. So, [a-z]
- will match any letter (or any lower case letter if EXACT mode is on),
- and [0-9a-f] will match any digit or any letter 'a' through 'f', which
- happen to be the characters for hexadecimal numbers. If the dash is at
- the beginning or end of a character class, it is taken to be just a
- dash.
-
- The escape character \ is for those times when you want to be in
- MAGIC mode, but also want to use a regular expression character
- to be just a character. It turns off the special meaning of the
- character. So a search for "it\." will search for a line with "it.",
- and not "it" followed by any other character. The escape character
- will also let you put ^, -, or ] inside a character class with no
- special side effects.
-
- @section(OVER mode)
-
- OVER mode stands for overwrite mode. When in this mode, when
- characters are typed, instead of simply inserting them into the file,
- EMACS will attempt to overwrite an existing character past the point.
- This is very useful for adjusting tables and diagrams.
-
- @section(WRAP mode)
-
- Wrap mode is used when typing in continuous text. Whenever the
- cursor is past the currently set fill column @index(fill column) (72 by
- default) and the user types a space or a <NL>, the last word of the line
- is brought down to the beginning of the next line. Using this, one just
- types a continuous stream of words and EMACS automatically inserts <NL>s
- at appropriate places.
-
- @center(NOTE to programmers:)
-
- @quotation{EMACS actually calls up the function bound to the illegal
- keystroke M-FNW. This is bound to the function @i(wrap-word)
- @index(wrap-word) by default, but can be re-bound to activate different
- functions and macros at wrap time.}
-
- @section(VIEW mode)
-
- VIEW mode disables all commands which can change the current
- buffer. EMACS will display an error message and ring the bell every
- time you attempt to change a buffer in VIEW mode.
- @newpage
- @heading(Chapter @value(chapter) Summary)
-
- In Chapter @value(chapter) you learned about modes and their effects.
-
- @begin{verbatim}
- @u(Key Binding Keystroke Effect)
- Add-Mode @b(^X-M) Add a mode to the current buffer
-
- Delete-Mode @b(^X-^M) Delete a mode from the current buffer
-
- Add-Global-Mode @b(M-M) Add a global mode to the
- current buffer
-
- Delete-Global-Mode @b(M-^M) Delete a global mode from the
- current buffer
- @end(verbatim)
- @chapter(Files)
-
- A file is simply a collection of related data. In EMACS we are dealing
- with text files -- named collections of text residing on a disk (or some
- other storage medium). You will recall that the major entities EMACS
- deals with are buffers. Disk-based versions of files are only active in
- EMACS when you are reading into or writing out of buffers. As we have
- already seen, buffers and physical files are linked by associated
- filenames. For example, the buffer "ch7.txt" which is associated with
- the physical disk file "ch7.txt." You will notice that the file is
- usually specified by the drive name or (in the case of a hard drive) a
- path. Thus you can specify full filenames in EMACS,
-
- e.g. disk:\directories\filename.extension
-
- If you do not specify a disk and directories, the default disk is used.
-
- IMPORTANT -- If you do not explicitly save your buffer to a file, all your
- edits will be lost when you leave EMACS (although EMACS will prompt you
- when you are about to lose edits by exiting). In addition, EMACS does
- not protect your disk-based files from overwriting when it saves files.
- Thus when you instruct EMACS to save a file to disk, it will create a
- file if the specified file doesn't exist, or it will overwrite the
- previously saved version of the file thus replacing it. Your old
- version is gone forever.
-
- If you are at all unsure about your edits, or if (for any reason) you
- wish to keep previous versions of a file, you can change the name of the
- associated file with the command @b{^X-N}. When this file is saved
- to disk, EMACS will create a new physical file under the new name. The
- earlier disk file will be preserved.
-
- For example, let's load the file @b{fang.txt} into EMACS. Now, type
- @b{^X-N}. The EMACS command line prompts "name:". Enter a new name
- for the file -- say @b(new.txt) and press <NL>. The file will be
- saved under the new filename, and your disk directory will show both
- @b(fang.txt) and @b(new.txt).
-
- An alternative method is to write the file directly to disk under a new
- filename. Let's pull our "publish.txt" file into EMACS. To write this
- file under another filename, type @b{^X-^W}. EMACS will prompt
- you "write file:". Enter an alternate filename -- @b{desktop.txt}.
- Your file will be saved as the physical file "desktop.txt".
-
- Note that in the examples above, although you have changed the names of
- the related files, the buffer names remain the same. However, when you
- pull the physical file back into EMACS, you will find that the buffer
- name now relates to the filename.
-
- For example -- You are working with a buffer "fang.txt" with the related
- file "fang.txt". You change the name of the file to "new.txt". EMACS
- now shows you working with the buffer "fang.txt" and the related file
- "new.txt". Now pull the file "new.txt" into EMACS. Notice that the
- buffer name has now changed to "new.txt".
-
- If for any reason a conflict of buffer names occurs,(if you have files
- of the same name on different drives for example) EMACS will prompt
- you "use buffer:". Enter an alternative buffer name if you need to.
-
- For a list of file related commands (including some we`ve already
- seen), see the summary page.
- @newpage
- @heading(Chapter @value(chapter) Summary)
-
- In Chapter @value(chapter) you learned some of the more advanced
- concepts of file naming and manipulation. The relationship between
- files and buffers was discussed in some detail.
-
- @begin(verbatim)
- @u(Key Binding Keystroke Effect)
-
- Save-file @b{^X-^S} Saves contents of current buffer with
- associated filename on default disk/
- directory (if not specified)
-
- Write-File @b{^X-^W} Current buffer contents will be
- saved under specified name
-
- Change-File-name
- @b{^X-N} The associated filename is changed
- (or associated if not previously
- specified) as specified
-
- Find-File @b{^X-^F} Reads specified file into buffer and
- switches you to that buffer, or switches
- to buffer in which the file has previously
- been read
-
- Read-File @b{^X-^R} Reads file into buffer thus overwriting
- buffer contents. If file has already
- been read into another buffer, you will
- be switched to it
-
- View-File @b{^X-^V} The same as read-file except the buffer
- is automatically put into VIEW mode thus
- preventing any changes from being made
- @end{verbatim}
- -----snip-----snip-----snip-----snip-----snip-----snip-----snip-----snip-----
- --
- Paul Homchick
- Chimitt Gilman Homchick, Inc.; One Radnor Station, Suite 300; Radnor, PA 19087
- {seismo!bpa | ihnp4!cbmvax} !vu-vlsi!cgh!paul
-