[comp.emacs] troff version of microemacs doc 3.10 part 2 of 6

klotz@ihlpm.ATT.COM (Dave Klotzbach) (05/24/89)

# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 2 (of 6)."
# Contents:  medoc.p01
# Wrapped by klotz@ihlpm on Wed May 24 11:03:01 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'medoc.p01' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'medoc.p01'\"
else
echo shar: Extracting \"'medoc.p01'\" \(34403 characters\)
sed "s/^X//" >'medoc.p01' <<'END_OF_FILE'
X.de TO
X.de hd
X.if \\n%>0 \{
X.ps 10
X.ft R
X.vs 12p
X'sp |0.5i
X.if e .tl 'contents'''
X.if o .tl '''contents'
X.ps
X.ft
X.vs \}
X'sp |1.0i
X\\..
X.de fo
X.vs 12p
X.ft R
X.ps 10
X'sp |\\n(.pu-0.5i
X.tl ''%''
X.ps 
X.ft 
X.vs 
X'bp
X\\..
X.nr % 0
X.tc
X.af % i
X
X.ce 1
X\s+8\fBTable of Contents\fR\s-8
X..
X.de TC
X.ie \\$1>0 .tl '	\\$2''\\$3'
X.el \{
X.br
X.br
X.tl '\\$2''\\$3'
X.br\}
X..
X.de CH
X.nr ch +1
X.nr sc 0 1
X.ds hl \\*(ct \\n(ch: \\$1
X.bp
X.nr ss 0 1
X.ls 2
X.sp (\n(.p)/3i
X.ce 2
X\s+8\\*(ct \\n(ch
X\fB\\$1\s-8\fR
X.ls 
X.am TO 
X.TC 0 "\\*(hl" \\n%
X\\..
X..
X.de SE
X.nr sc +1
X.nr ss 0 1
X.ls 2
X\\n(sc.\\n(ss \fB\\$1\fR
X.ls
X.am TO
X.TC 1 "\\n(sc.\\n(ss \\$1" \\n%
X\\..
X..
X.de SS
X.nr ss +1
X.ls 2
X\\n(sc.\\n(ss \fB\\$1\fR
X.ls
X.am TO
X.TC 1 "\\n(sc.\\n(ss \\$1" \\n%
X\\..
X..
X.ds ct Chapter
X.nr ch 0 1
X.in 0.5i
X.ll 6.5i
X.ev 1
X.ta 1.0i
X.in 1.5i
X.ll 6.0i
X.ev 0
X.ta 0.666i +0.6666i +0.666i +0.6666i +0.6666i +0.6666i
X.nf
X.ds hr MicroEMACS Reference Manual
X.ds hl 
X.ds fl \\*(ct \\n(ch
X.ds fr 
X.de us
X\\$1\l'|0\(ul'
X..
X.de hd
X.if \\n(ch>=1 \{\
X.if \\n%>0 \{\
X.ps 10
X.ft R
X.vs 12p
X'sp |0.5i
X.if e .tl '\\*(hl''\\*(hr'
X.if o .tl '\\*(hr''\\*(hl'
X.ps
X.ft
X.vs \} \}
X'sp |1.0i
X..
X.de fo
X.if \\n(ch>=1 \{\
X.if \\n%>=1 \{\
X.vs 12p
X.ft R
X.ps 10
X'sp |\\n(.pu-0.5i
X.if o .tl '\\*(fl''Page %'
X.if e .tl 'Page %''\\*(fl'
X.ps 
X.ft 
X.vs \}\}
X'bp
X..
X.wh 0 hd
X.wh -1.0i fo
X
X
X
X
X
X
X
X
X
X
X
X
X
X		\s+8MicroEMACS\s-8
X
X		Full Screen Text Editor
X		Reference Manual
X
X		Version 3.10
X		March 19, 1989
X
X		(C)opyright 1988, 1989 by Daniel M. Lawrence
X		Reference Manual (C)opyright 1988, 1989
X			by Brian Straight and Daniel M. Lawrence
X		All Rights Reserved
X
X		\fIMicroEMACS 3.10 can be copied and distributed freely
X		for any non-commercial purposes. MicroEMACS 3.10 can
X		only be incorporated into commercial software with
X		the permission of the current author.\fR
X.bp
X.fi
X
X.bp
X.fi
X
X.ad l
X\s+8Introduction\s-8
X.na
X
X
X MicroEMACS is a tool for creating and changing documents,
Xprograms, and other text files. It is both relatively easy for the
Xnovice to use, but also very powerful in the hands of an expert.
XMicroEMACS can be extensively customized for the needs of the
Xindividual user.
X
X MicroEMACS allows several files to be edited at the same time.
XThe screen can be split into different windows, and text may be moved
Xfreely from one window to the next. Depending on the type of file being
Xedited, MicroEMACS can change how it behaves to make editing simple. 
XEditing standard text files, program files and word processing documents
Xare all possible at the same time.
X
X There are extensive capabilities to make word processing and
Xediting easier. These include commands for string searching and
Xreplacing, paragraph reformatting and deleting, automatic word wrapping,
Xword move and deletes, easy case controlling, and automatic word counts.
X
X For complex and repetitive editing tasks editing macroes can be
Xwritten. These macroes allow the user a great degree of flexibility in
Xdetermining how MicroEMACS behaves. Also, any and all the commands can
Xbe used by any keystroke by changing, or rebinding, what commands
Xvarious keys invoke.
X
X Special features are also available to perform a diverse set of
Xoperations such as file encryption, automatic backup file generation,
Xentabbing and detabbing lines, executing operating system commands and
Xfiltering of text through other programs (like SORT to allow sorting
Xtext).
X
X.ad l
X\s+8History\s-8
X.na
X
X
X EMACS was originally a text editor written by Richard Stallman
Xat MIT in the early 1970s for Digital Equipment computers. Various
Xversions, rewrites and clones have made an appearance since.
X
X This version of MicroEMACS is derived from code written by Dave
XG. Conroy in 1985. Later modifications were performed by Steve Wilhite
Xand George Jones. In December of 1985 Daniel Lawrence picked up the
Xthen current source (version 2.0) and made extensive modifications and
Xadditions to it over the course of the next three years. Updates and
Xsupport for the current version are still available. Commercial
Xsupport and usage licences are also available. The current program
Xauthor can be contacted by writing to:
X
X.nf
X.ft CW
X
X	USMAIL: Daniel Lawrence
X		617 New York St
X		Lafayette, IN 47901
X
X	UUCP:	pur-ee!pur-phy!j.cc.purdue.edu!nwd
X	ARPA:	nwd@j.cc.purdue.edu
X	FIDO:	Opus 201/10 The Programmer's Room (317) 742-5533\fR
X.fi
X
X\fR
X.bp
X.fi
X
X.ad l
X\s+8Credits\s-8
X.na
X
X
X Many people have been involved in creating this software and we
Xwish to credit some of them here. Dave Conroy, of course, wrote the
Xvery first version of MicroEMACS, and it is a credit to his clean
Xcoding that so much work was able to be done to expand it. John Gamble
Xis responsible for writing the MAGIC mode search routines, and for
Xmaintaining all the search code. Dana Hoggatt supplied the encryption
Xroutines for encrypt mode and continues to answer really hard questions
Xabout MSDOS and UNIX. Jeff Lomicka wrote the appendix on DEC VMS and
Xhas supplied a lot of code to support VMS and the ATARI 1040ST
Xversions. Curtis Smith wrote the original VMS code and help support the
XCommodore AMIGA. Also Lance Jones has done a lot of work on the AMIGA
Xcode. Professor Suresh Konda at Purdue University has put a lot of
Xeffort into writing complex macros and finding all the bugs in the
Xmacro language before anyone else does.
X
X As to people sending source code and text translations over
Xcomputer networks like USENET and ARPA net, there are simply more than
Xcan be listed here. [The comments in the edit history in the main.c
Xfile mention each and the piece they contributed]. All these people
Xshould be thanked for the hard work they have put into MicroEMACS.
X
X.ig
X\closing{Daniel M. Lawrence}
X..
X
X.bp
X.fi
X
X.nr % 0
X
X.CH "Basic Concepts"
X
X
X The current version of MicroEMACS is 3.10 (Third major
Xre-write, tenth public release), and for the rest of this document, we
Xshall simply refer to this version as ``EMACS''. Any modifications for
Xlater versions will be in the file README on the MicroEMACS distribution
Xdisk.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBKeys and the Keyboard\fR"
X
X
X Many times throughout this manual we will be talking about commands and the keys on the keyboard needed to use
Xthem. There are a number of ``special'' keys which can be used and are
Xlisted here:
X
X
X.ev 1
X
X
X.ti -1.0i
X\fB<NL>\fR	NewLine which is also called RETURN or ENTER, this key is used to end different commands. 
X
X
X.ti -1.0i
X\fB^\fR	The control key can be used before any alphabetic character and some
Xsymbols. For example, ^C means to hold down the <CONTROL> key and type the C key at the same time. 
X
X
X.ti -1.0i
X\fB^X\fR	The CONTROL-X key is used at the beginning of many different commands. 
X
X
X.ti -1.0i
X\fBMETA or M-\fR	This is a special EMACS key used to begin many commands as well. This key is pressed and then released before
Xtyping the next character. On most systems, this is the <ESC> key, but
Xit can be changed. (consult appendix E to learn what key is used for
XMETA on your computer).
X
X.ev 0
X
X
XWhenever a command is described, the manual will list the actual
Xkeystrokes needed to execute it in \fBboldface\fR using the above
Xconventions, and also the name of the command in \fIitalics\fR.
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBGetting Started\fR"
X
X
X In order to use EMACS, you must call it up from your system or
Xcomputer's command prompt. On UNIX and MSDOS machines, just type
X``emacs'' from the main command prompt and follow it with the <RETURN> or
X<ENTER> key (we will refer to this key as <NL> for ``new-line'' for the
Xremainder of this manual). On the Macintosh, the Amiga, the ATARI ST
Xand other icon based operating systems, double click on the uEMACS icon.
XShortly after this, a screen similar to the one below should appear.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBParts and Pieces\fR"
X
X
X The screen is divided into a number of areas or \fBwindows\fR. On
Xsome systems the top window contains a function list of unshifted and shifted function keys. We will discuss these keys later.  Below them is an EMACS \fBmode line\fR which, as we will
Xsee, informs you of the present mode of operation of the editor--for
Xexample ``(WRAP)'' if you set EMACS to wrap at the end of each line.  Under the mode line is the \fBtext window\fR where text
Xappears and is manipulated. Since each window has its own mode line,
Xbelow the text window is it's mode line. The last line of the screen is
Xthe \fBcommand line\fR where EMACS takes commands and reports on what it
Xis doing. 
X
X.nf
X.ft CW
X
X===============================================================================
Xf1 search-> f2 <-search |    MicroEMACS:  Text Editor
Xf3 hunt->   f4 <-hunt	| 
Xf5 fkeys    f6 help	|  Available function key Pages include:
Xf7 nxt wind f8 pg[    ] |    WORD  BOX	EMACS  PASCAL  C
Xf9 save     f10 exit	|  [use the f8 key to load Pages]
X===============================================================================
X   MicroEMACS 3.10 ()	 Function Keys
X===============================================================================
X
X
X
X
X
X
X
X
X
X
X
X===============================================================================
X---- MicroEMACS 3.10 () -- Main ----------------------------------------------
X===============================================================================
X		Fig 1:	EMACS screen on an IBM-PC\fR
X.fi
X
X\fR
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBEntering Text\fR"
X
X
XEntering text in EMACS is simple. Type the following sentence fragment:
X
X.in+0.5i
X.ll-0.5i
XFang Rock lighthouse, center of a series of mysterious and
X.in-0.5i
X.ll+0.5i
X
X
X.ad l
XThe text is displayed at the top of the text window. Now type:
X.na
X
X
X.in+0.5i
X.ll-0.5i
Xterrifying events at the turn of the century
X.in-0.5i
X.ll+0.5i
X
X
XNotice that some of your text has dissapeared off the left side of the
Xscreen. Don't panic--your text is safe!!! You've just discovered that
XEMACS doesn't ``wrap'' text to the next line like most word processors
Xunless you hit <NL>. But since EMACS is used for both word processing,
Xand text editing, it has a bit of a dual personality. You can change the way it works by setting various \fBmodes\fR. In this
Xcase, you need to set \fBWRAP\fR mode, using the \fIadd-mode\fR command, by typing \fB^XM\fR. The command line at the
Xbase of the screen will prompt you for the mode you wish to add. Type\fBwrap\fR followed by the <NL> key and any text you now enter will be
Xwrapped. However, the command doesn't wrap text already entered. To
Xget rid of the long line, press and hold down the <BACKSPACE> key until
Xthe line is gone. Now type in the words you deleted, watch how EMACS
Xgoes down to the next line at the right time. \fI(In some versions of
XEMACS, \fBWRAP\fB is a default mode in which case you don't have to worry
Xabout the instructions relating to adding this mode.)\fR
X
XNow let's type a longer insert. Hit <NL> a couple of times to tab
Xdown from the text you just entered. Now type the following paragraphs. 
XPress <NL> twice to indicate a paragraph break. 
X
X.in+0.5i
X.ll-0.5i
XFang Rock lighthouse, center of a series of mysterious and
Xterrifying events at the turn of the century, is built on a rocky island
Xa few miles of the Channel coast. So small is the island that wherever
Xyou stand its rocks are wet with sea spray. 
X
XThe lighthouse tower is in the center of the island. A steep flight of
Xsteps leads to the heavy door in its base. Winding stairs lead up to
Xthe crew room.
X.in-0.5i
X.ll+0.5i
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBBasic cursor movement\fR"
X
X
XNow let's practice moving around in this text. To move the cursor back
Xto the word ``Winding,'' enter \fBM-B\fR \fIprevious-word\fR . This command moves the cursor backwards by one
Xword at a time. Note you have to press the key combination every time
Xthe cursor steps back by one word. Continuously pressing META and
Xtoggling B produces an error message. To move forward to the word
X``stairs'' enter \fBM-F\fR \fInext-word\fR , which moves the
Xcursor forward by one word at a time. 
X
XNotice that EMACS commands are usually mnemonic--F for forward, B for
Xbackward, for example.
X
XTo move the cursor up one line, enter \fB^P\fR \fIprevious-line\fR , down one line \fB^N\fR \fInext-line\fR . Practice this movement by moving the cursor to the
Xword ``terrifying'' in the second line. 
X
XThe cursor may also be moved forward or backward in smaller increments. 
XTo move forward by one character, enter \fB^F\fR \fIforward-character\fR , to move backward, \fB^B\fR\fIbackward-character\fR  . EMACS also allows
Xyou to specify a number which is normally used to tell a command to
Xexecute many times. To repeat most commands, press META and then the
Xnumber before you enter the command. Thus, the command META 5 ^F
X(\fBM-5^F\fR) will move the cursor forward by five characters. Try moving
Xaround in the text by using these commands. For extra practice, see how
Xclose you can come to the word ``small'' in the first paragraph by giving
Xan argument to the commands listed here. 
X
XTwo other simple cursor commands that are useful to help us move around
Xin the text are \fBM-N\fR \fInext-paragraph\fR  which
Xmoves the cursor to the second paragraph, and \fBM-P\fR\fIprevious-paragraph\fR  which moves it back
Xto the previous paragraph. The cursor may also be moved rapidly from
Xone end of the line to the other. Move the cursor to the word ``few'' in
Xthe second line. Press \fB^A\fR \fIbeginning-of-line\fR . Notice the cursor moves to the word
X``events'' at the beginning of the line. Pressing \fB^E\fR \fIend-of-line\fR moves the cursor to the end of the line. 
X
XFinally, the cursor may be moved from any point in the file to the end
Xor beginning of the file. Entering \fBM->\fR \fIend-of-file\fR moves the cursor to the end of the buffer, \fBM-<\fR\fIbeginning-of-file\fR  to the first character
Xof the file. 
X\fIOn the IBM-PC, the ATARI ST and many other machines, the cursor keys can also be used to move the cursor.\fR
X
XPractice moving the cursor in the text until you are comfortable with
Xthe commands we've explored in this chapter.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBSaving your text\fR"
X
X
XWhen you've finished practicing cursor movement, save your file. Your file currently resides in a \fBBUFFER\fR. The buffer is a
Xtemporary storage area for your text, and is lost when the computer is
Xturned off. You can save the buffer to a file by entering \fB^X^S\fR\fIsave-file\fR  . Notice that EMACS informs you that
Xyour file has no name and will not let you save it.
X
XTo save your buffer to a file with a different name than it's current
Xone (which is empty), press \fB^X^W\fR \fIwrite-file\fR  . 
XEMACS will prompt you for the filename you wish to write. Enter the
Xname \fBfang.txt\fR and press return. On a micro, the drive light will
Xcome on, and EMACS will inform you it is writing the file. When it
Xfinishes, it will inform you of the number of lines it has written to
Xthe disk. 
X
XCongratulations!! You've just saved your first EMACS file!
X.bp
X.fi
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
X In chapter \n(ch , you learned how to enter text, how
Xto use wrap mode, how to move the cursor, and to save a buffer. The
Xfollowing is a table of the commands covered in this chapter and their
Xcorresponding key bindings:
X
X.nf
X.ft CW
X
X.us  "Key Binding		Keystroke	Effect"
X
X
Xabort-command		\fB^G\f(CW    		aborts current command
X
Xadd-mode		\fB^XM\f(CW     	allows addition of EMACS
X					mode such as \fBWRAP\f(CW    
X
Xbackward-character	\fB^B\f(CW    		moves cursor left one character
X
Xbeginning-of-file	\fBM-<\f(CW     	moves cursor to beginning of file
X
Xbeginning-of-line	\fB^A\f(CW    		moves cursor to beginning of line
X
Xend-of-file		\fBM->\f(CW     	moves cursor to end of file
X
Xend-of-line		\fB^E\f(CW    		moves cursor to end of line
X
Xforward-character	\fB^F\f(CW    		moves cursor right one character
X
Xnext-line		\fB^N\f(CW    		moves cursor to next line
X
Xnext-paragraph		\fBM-N\f(CW     	moves cursor to next paragraph
X
Xnext-word		\fBM-F\f(CW     	moves cursor forward one word
X
Xprevious-line		\fB^P\f(CW    		moves cursor backward by one line
X
Xprevious-paragraph	\fBM-P\f(CW     	moves cursor to previous paragraph
X
Xprevious-word		\fBM-B\f(CW     	moves cursor backward by one word
X
Xsave-file		\fB^X^S\f(CW    	saves current buffer to a file
X
Xwrite-file		\fB^X^W\f(CW    	save current buffer under a new name\fR
X.fi
X
X\fR
X.bp
X.fi
X
X.CH "Basic Editing--Simple Insertions and Deletions"
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBA Word About Windows, Buffers, Screens, and Modes\fR"
X
X
XIn the first chapter, you learned how to create and save a file in
XEMACS. Let's do some more editing on this file. Call up emacs by
Xtyping in the following command.
X\fBemacs fang.txt\fR
X\fIOn icon oriented systems, double click on the uEMACS icon, usually a
Xfile dialog box of some sort will appear. Choose \fBFANG.TXT\fB from the
Xappropriate folder.\fR
X
XShortly after you invoke EMACS, the text should appear on the screen
Xready for you to edit. The text you are looking at currently resides in
Xa \fBbuffer\fR. A buffer is a temporary area of computer memory which is the primary unit internal to EMACS -- this is the place
Xwhere EMACS goes to work. The mode line at the bottom of the screen
Xlists the buffer name, \fBFANG.TXT\fR and the name of the file with which
Xthis buffer is associated, \fBFANG.TXT\fR
X
XThe computer talks to you through the use of its \fBscreen\fR. This screen usually has an area of 24 lines each of 80
Xcharacters across. You can use EMACS to subdivide the screen into
Xseveral separate work areas, or \fBwindows\fR, each of which can be 'looking into' different files or sections of text. Using
Xwindows, you can work on several related texts at one time, copying and
Xmoving blocks of text between windows with ease. To keep track of what
Xyou are editing, each window is identified by a \fBmode line\fR on the  last line of the window which lists the
Xname of the \fBbuffer\fR which it is looking into, the file from which the
Xtext was read, and how the text is being edited. 
X
XAn EMACS \fBmode\fR tells EMACS how to deal with user input. As we have
Xalready seen, the mode 'WRAP' controls how EMACS deals with long lines
X(lines with over 79 characters) while the user is typing them in. The
X'VIEW' mode, allows you to read a file without modifying it. Modes are
Xassociated with buffers and not with files; hence, a mode needs to be
Xexplicitly set or removed every time you edit a file. A new file read
Xinto a buffer with a previously specified mode will be edited under this
Xmode. If you use specific modes frequently, EMACS allows you to set
Xthe modes which are used by all new buffers, called \fBglobal\fR modes. 
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBInsertions\fR"
X
X
XYour previously-saved text should look like this:
X
X.in+0.5i
X.ll-0.5i
XFang Rock lighthouse, center of a series of mysterious and
Xterrifying events at the turn of the century, is built on a rocky island
Xa few miles of the Channel coast. So small is the island that wherever
Xyou stand its rocks are wet with sea spray. 
X
XThe lighthouse tower is in the center of the island. A steep flight of
Xsteps leads to the heavy door in its base. Winding stairs lead up to
Xthe crew room.
X.in-0.5i
X.ll+0.5i
X
X
XLet's assume you want to add a sentence in the second paragraph after
Xthe word ``base.'' Move the cursor until it is on the ``W'' of ``Winding''.
XNow type the following:
X
X.in+0.5i
X.ll-0.5i
XThis gives entry to the lower floor where the big steam
Xgenerator throbs steadily away, providing power for the electric
Xlantern.
X.in-0.5i
X.ll+0.5i
X
X
XIf the line fails to wrap and you end up with a '$' sign in the right
Xmargin, just enter \fBM-Q\fR \fIfill-paragraph\fR  to
Xreformat the paragraph. This new command attempts to fill out a
Xparagraph. Long lines are divided up, and words are shuffled around to
Xmake the paragraph look nicer. 
X
XNotice that all visible EMACS characters are self-inserting -- all you
Xhad to do was type the characters to insert and the existing text made
Xspace for it. With a few exceptions discussed later, all non-printing
Xcharacters (such as control or escape sequences) are commands. To
Xinsert spaces, simply use the space bar. Now move to the first line of
Xthe file and type \fB^O\fR \fIopen-line\fR  (Oh, not zero). 
XYou've just learned how to insert a blank line in your text. 
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBDeletions\fR"
X
X
XEMACS offers a number of deletion options. For example, move the cursor
Xuntil it's under the period at the end of the insertion you just did. 
XPress the backspace key. Notice the ``n'' on ``lantern'' disappeared. The
Xbackspace implemented on EMACS is called a \fBdestructive\fR backspace--it
Xremoves text immediately before the current cursor position from the
Xbuffer. Now type \fB^H\fR \fIdelete-previous-character\fR . Notice that the cursor moves back
Xand obliterates the ``r''--either command will backspace the cursor. 
X
XType in the two letters you erased to restore your text and move the
Xcursor to the beginning of the buffer \fBM->\fR \fIbeginning-of-file\fR . Move the cursor down one line to the
Xbeginning of the first paragraph. 
X
XTo delete the forward character, type \fB^D\fR \fIdelete-next-character\fR . The ``F'' of ``Fang'' disappears. Continue
Xto type \fB^D\fR until the whole word is erased EMACS also permits the
Xdeletion of larger elements of text. Move the cursor to the word
X``center'' in the first line of text. Pressing \fBM-<backspace>\fR\fIdelete-previous-word\fR  kills the word
Ximmediately before the cursor. \fBM-^H\fR has the same effect. 
X
XNotice that the commands are very similar to the control commands you
Xused to delete individual letters. As a general rule in EMACS, control
Xsequences affect small areas of text, META sequences larger areas. The
Xword forward of the cursor position can therefore be deleted by typing\fBM-D\fR \fIdelete-next-word\fR  . Now let's take
Xout the remainder of the first line by typing \fB^K\fR\fIkill-to-end-of-line\fR  . You now have a
Xblank line at the top of your screen. Typing \fB^K\fR again or \fB^X^O\fR\fIdelete-blank-lines\fR  deletes the blank line
Xand flushes the second line to the top of the text. Now exit EMACS by
Xtyping \fB^X^C\fR \fIexit-emacs\fR  . Notice EMACS
Xreminds you that you have not saved your buffer. Ignore the warning and
Xexit. This way you can exit EMACS without saving any of the changes you
Xjust made. 
X.bp
X.fi
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XIn Chapter \n(ch , you learned about the basic 'building
Xblocks' of an EMACS text file--buffers, windows, and files. 
X
X.nf
X.ft CW
X
X.us  "Key binding		Keystroke	Effect"
X
Xdelete-previous-character
X			\fB^H\f(CW    		deletes character immediately before
X					the current cursor position
X
Xdelete-next-character	\fB^D\f(CW    		deletes character immediately after     
X					current cursor position
X
Xdelete-previous-word	\fBM-^H\f(CW    	deletes word immediately before
X					current cursor position
X
Xdelete-next-word	\fBM-D\f(CW     	deletes word immediately after
X					current cursor position
X
Xkill-to-end-of-line	\fB^K\f(CW    		deletes from current cursor
X					position to end of line
X
Xinsert-space		\fB^C\f(CW    		inserts a space to right of cursor
X
Xopen-line		\fB^O\f(CW    		inserts blank line
X
Xdelete-blank-lines	\fB^X^O\f(CW    	removes blank line
X
Xexit-emacs		\fB^X^C\f(CW    	exits emacs\fR
X.fi
X
X\fR
X.CH "Using Regions"
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBDefining and Deleting a Region\fR"
X
X
XAt this point its time to familiarize ourselves with two more EMACS
Xterms--the \fBpoint\fR and the \fBmark\fR. The point is located directly  behind the current cursor position. The mark
X(as we shall see shortly) is user defined. These two elements together
Xare called the current \fBregion\fR and limit the \fBregion\fR of text on
Xwhich EMACS performs many of its editing functions. 
X
XLet's begin by entering some new text. Don't forget to add \fBwrap\fR
Xmode if its not set on this buffer. Start EMACS and open a file called\fBPUBLISH.TXT\fR. Type in the following text:
X
X.in+0.5i
X.ll-0.5i
XOne of the largest growth areas in personal computing is
Xelectronic publishing. There are packages available for practically
Xevery machine from elegantly simple programs for the humble Commodore 64
Xto sophisticated professional packages for PC and Macintosh computers. 
X
XElectronic publishing is as revolutionary in its way as the Gutenburg
Xpress. Whereas the printing press allowed the mass production and
Xdistribution of the written word, electronic publishing puts the means
Xof production in the hands of nearly every individual. From the class
Xmagazine to the corporate report, electronic publishing is changing the
Xway we produce and disseminate information. 
X
XPersonal publishing greatly increases the utility of practically every
Xcomputer. Thousands of people who joined the computer revolution of
Xthis decade only to hide their machines unused in closets have
Xdiscovered a new use for them as dedicated publishing workstations.
X.in-0.5i
X.ll+0.5i
X
X
XNow let's do some editing. The last paragraph seems a little out of
Xplace. To see what the document looks like without it we can cut it
Xfrom the text by moving the cursor to the beginning of the paragraph. 
XEnter \fBM-<space>\fR \fIset-mark\fR  . EMACS will respond
Xwith ``[Mark set]''. Now move the cursor to the end of the paragraph. 
XYou have just defined a region of text. To remove this text from the
Xscreen, type \fB^W\fR \fIkill-region\fR  . The paragraph
Xdisappears from the screen. 
X
XOn further consideration, however, perhaps the paragraph we cut wasn't
Xso bad after all. The problem may have been one of placement. If we
Xcould tack it on to the end of the first paragraph it might work quite
Xwell to support and strengthen the argument. Move the cursor to the end
Xof the first paragraph and enter \fB^Y\fR \fIyank\fR  . Your
Xtext should now look like this:
X
X.in+0.5i
X.ll-0.5i
XOne of the largest growth areas in personal computing is
Xelectronic publishing. There are packages available for practically
Xevery machine from elegantly simple programs for the humble Commodore 64
Xto sophisticated professional packages for PC and Macintosh computers. 
XPersonal publishing greatly increases the utility of practically every
Xcomputer. Thousands of people who joined the computer revolution of
Xthis decade only to hide their machines unused in closets have
Xdiscovered a new use for them as dedicated publishing workstations. 
X
XElectronic publishing is as revolutionary in its way as the Gutenburg
Xpress. Whereas the printing press allowed the mass production and
Xdistribution of the written word, electronic publishing puts the means
Xof production in the hands of nearly every individual. From the class
Xmagazine to the corporate report, electronic publishing is changing the
Xway we produce and disseminate information.
X.in-0.5i
X.ll+0.5i
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBYanking a Region\fR"
X
X
XThe text you cut initially didn't simply just disappear, it was cut into
Xa buffer that retains the 'killed' text appropriately called the \fBkill
Xbuffer\fR. \fB^Y\fR ``yanks'' the text back from this buffer into the current
Xbuffer. If you have a long line (indicated, remember, by the ``$''
Xsign), simply hit \fBM-Q\fR to reformat the paragraph. 
X
XThere are other uses to which the kill buffer can be put. Using the method we've already learned, define the last
Xparagraph as a region. Now type \fBM-W\fR \fIcopy-region\fR . Nothing seems to have happened; the cursor stays
Xblinking at the point. But things have changed, even though you may not
Xbe able to see any alteration. 
X
XTo see what has happened to the contents of the kill buffer, move the
Xcursor down a couple of lines and ``yank'' the contents of the kill buffer
Xback with \fB^Y\fR. Notice the last paragraph is now repeated. The
Xregion you defined is ``tacked on'' to the end of your file because\fBM-W\fR \fBcopies\fR a region to the kill buffer while leaving the
Xoriginal text in your working buffer. Some caution is needed however,
Xbecause the contents of the kill buffer are updated when you delete any
Xregions, lines or words. If you are moving large quantities of text,
Xcomplete the operation before you do any more deletions or you could
Xfind that the text you want to move has been replaced by the most recent
Xdeletion. Remember--a buffer is a temporary area of computer memory
Xthat is lost when the machine is powered down or switched off. In order
Xto make your changes permanent, they must be saved to a file before you
Xleave EMACS. Let's delete the section of text we just added and save
Xthe file to disk. 
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XIn Chapter \n(ch , you learned how to achieve longer insertions
Xand deletions. The EMACS terms \fBpoint\fR and \fBmark\fR were introduced
Xand you learned how to manipulate text with the kill buffer. 
X
X.nf
X.ft CW
X
X.us  "Key Binding	Keystroke	Effect"
X
X
Xset-mark	\fBM-<space>\f(CW    	Marks the beginning of a region
X
Xdelete-region	\fB^W\f(CW    		Deletes region between point and mark and
X				places it in KILL buffer
X
Xcopy-region	\fBM-W\f(CW     	Copies text between point and mark into
X				KILL buffer
X
Xyank-text	\fB^Y\f(CW    		Inserts a copy of the KILL buffer into
X				current buffer at point
X\fR
X.fi
X
X\fR
X.CH "Search and Replace"
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBForward Search\fR"
X
X
XLoad EMACS and bring in the file you just saved. Your file should look
Xlike the one below.
X
X.in+0.5i
X.ll-0.5i
XOne of the largest growth areas in personal computing is electronic
Xpublishing. There are packages available for practically every machine
Xfrom elegantly simple programs for the humble Commodore 64 to
Xsophisticated professional packages for PC and Macintosh computers. 
XPersonal publishing greatly increases the utility of practically every
Xcomputer. Thousands of people who joined the computer revolution of
Xthis decade only to hide their machines unused in closets have
Xdiscovered a new use for them as dedicated publishing workstations. 
X
XElectronic publishing is as revolutionary in its way as the Gutenburg
Xpress. Whereas the printing press allowed the mass production and
Xdistribution of the written word, electronic publishing puts the means
Xof production in the hands of nearly every individual. From the class
Xmagazine to the corporate report, electronic publishing is changing the
Xway we produce and disseminate information.
X.in-0.5i
X.ll+0.5i
X
X
XLet's use EMACS to search for the word ``revolutionary'' in the second
Xparagraph. Because EMACS searches from the current cursor position
Xtoward the end of buffers, and we intend to search forward, move the
Xcursor to the beginning of the text. Enter \fB^S\fR \fIsearch-forward\fR . Note that the command line now reads
X
X``Search [] <META>:'' 
X
XEMACS is prompting you to enter the \fBsearch string\fR -- the text you
Xwant to find. Enter the word \fBrevolutionary\fR and hit the \fBMETA\fR
Xkey. The cursor moves to the end of the word ``revolutionary.''
X
XNotice that you must enter the <META> key to start the search. If you simply press <NL> the command line responds with ``<NL>''. 
XAlthough this may seem infuriating to users who are used to pressing the
Xreturn key to execute any command, EMACS' use of <META> to begin
Xsearches allows it to pinpoint text with great accuracy. After every
Xline wrap or carriage return, EMACS 'sees' a new line character (<NL>). 
XIf you need to search for a word at the end of a line, you can specify
Xthis word uniquely in EMACS. 
X
XIn our sample text for example, the word ``and'' occurs a number of times,
Xbut only once at the end of a line. To search for this particular
Xoccurrence of the word, move the cursor to the beginning of the buffer
Xand type \fB^S\fR. Notice that EMACS stores the last specified search string as the \fBdefault\fR string. If you
Xpress \fB<META>\fR now, EMACS will search for the default string, in this
Xcase, ``revolutionary.''
X
XTo change this string so we can search for our specified ``and'' simply
Xenter the word \fBand\fR followed by \fB<NL>\fR. The command
Xline now shows:
X
X``search [and<NL>]<META>:''
X
XPress \fB<META>\fR and the cursor moves to ``and'' at the end of the second
Xlast line.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBExact Searches\fR"
X
X
XIf the mode EXACT is active in the current buffer, EMACS searches on a case
Xsensitive basis. Thus, for example you could search for \fBPublishing\fR
Xas distinct from \fBpublishing\fR. 
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBBackward Search\fR"
X
X
XBackward searching is very similar to forward searching except that it
Xis implemented in the reverse direction. To implement a reverse search,
Xtype \fB^R\fR \fIsearch-reverse\fR  . Because EMACS
Xmakes no distinction between forward and backward stored search strings,
Xthe last search item you entered appears as the default string. Try
Xsearching back for any word that lies between the cursor and the
Xbeginning of the buffer. Notice that when the item is found, the point
Xmoves to the beginning of the found string (i.e., the cursor appears
Xunder the first letter of the search item). 
X
XPractice searching for other words in your text.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBSearching and Replacing\fR"
X
X
XSearching and replacing is a powerful and quick way of making changes to
Xyour text. Our sample text is about electronic publishing, but the
Xcorrect term is 'desktop' publishing. To make the necessary changes we
Xneed to replace all occurrences of the word ``electronic'' with ``desktop.''
XFirst, move the cursor to the top of the current buffer with the \fBM-<\fR
Xcommand. Then type \fBM-R\fR \fIreplace-string\fR  . 
XThe command line responds:
X
X``Replace []<META>:''
X
Xwhere the square brackets enclose the default string. Type the word\fBelectronic\fR and hit \fB<META>\fR. The command line responds:
X
X``with []<META>''
X
Xtype \fBdesktop<META>\fR. EMACS replaces all instances of the original
Xword with your revision. Of course, you will have to capitalize the
Xfirst letter of ``desktop'' where it occurs at the beginning of a
Xsentence.
X
XYou have just completed an \fBunconditional replace\fR. In this
Xoperation, EMACS replaces every instance of the found string with the
Xreplacement string. 
X 
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBQuery-Replace\fR"
X
X
XYou may also replace text on a case by case basis. The \fBM-^R\fR\fIquery-replace-string\fR  command causes
XEMACS to pause at each instance of the found string. 
X
XFor example, assume we want to replace some instances of the word
X``desktop'' with the word ``personal.'' Go back to the beginning of the
Xcurrent buffer and enter the \fBM-^R\fR \fIquery-replace\fR command. The procedure is very similar to that
Xwhich you followed in the unconditional search/replace option. When the
Xsearch begins however, you will notice that EMACS pauses at each

END_OF_FILE
echo shar: NEWLINE appended to \"'medoc.p01'\"
if test 34404 -ne `wc -c <'medoc.p01'`; then
    echo shar: \"'medoc.p01'\" unpacked with wrong size!
fi
# end of 'medoc.p01'
fi
echo shar: End of archive 2 \(of 6\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 3 4 5 6 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked all 6 archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0
-- 

					Dave Klotzbach
					att!ihlpm!klotz
					IE 2F-518  (312) 416-7437