[comp.emacs] troff version of microemacs doc part 3 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 3 (of 6)."
# Contents:  medoc.p02
# Wrapped by klotz@ihlpm on Wed May 24 11:03:15 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'medoc.p02' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'medoc.p02'\"
else
echo shar: Extracting \"'medoc.p02'\" \(39831 characters\)
sed "s/^X//" >'medoc.p02' <<'END_OF_FILE'
Xinstance of ``publishing'' and asks whether you wish to replace it with
Xthe replacement string. You have a number of options available for
Xresponse:
X
X.nf
X.ft CW
X
X.us  "	Response	Effect"
X
X	Y(es)	Make the current replacement and skip to the next
X		occurrence of the search string
X
X	N(o)	Do not make this replacement but continue
X
X	!	Do the rest of the replacements with no more queries
X
X	U(ndo)	Undo just the last replacement and query for it
X		again (This can only go back ONE time)
X
X	^G	Abort the replacement command (This action does not
X		undo previously-authorized replacements
X
X	.	Same effect as ^G, but cursor returns to the point at
X		which the replacement command was given
X
X	?	This lists help for the query replacement command\fR
X.fi
X
X\fR
X
XPractice searching and searching and replacing until you feel
Xcomfortable with the commands and their effects.
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XIn this chapter, you learned how to search for specified strings of text
Xin EMACS. The chapter also dealt with searching for and replacing
Xelements within a buffer. 
X
X.nf
X.ft CW
X
X.us  "Key Binding		Keystroke			 Effect"
X
X
Xsearch-forward		\fB^S\f(CW    	Searches from point to end of buffer.
X				Point is moved from current location to
X				the end of the found string
X
Xsearch-backward 	\fB^R\f(CW    	Searches from point to beginning of buffer. 
X				Point is moved from current location to
X				beginning of found string
X
Xreplace 		\fBM-R\f(CW     Replace ALL occurrences of search string with 
X				specified (null) string from point to the
X				end of the current buffer
X
Xquery-replace	       \fBM-^R\f(CW     As above, but pause at each found string
X				and query for action\fR
X.fi
X
X\fR
X
X.CH "Windows"
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBCreating Windows\fR"
X We have already met windows in an earlier chapter. In this chapter, we
Xwill explore one of EMACS' more powerful features -- text manipulation
Xthrough multiple windowing. Windows offer you a powerful and easy way
Xto edit text. By manipulating a number of windows and buffers on the
Xscreen simultaneously, you can perform complete edits and revisions on
Xthe computer screen while having your draft text or original data
Xavailable for reference in another window. 
X
XYou will recall that windows are areas of buffer text that you can see on the screen. Because EMACS can support several screen
Xwindows simultaneously you can use them to look into different places in
Xthe same buffer. You can also use them to look at text in different
Xbuffers. In effect, you can edit several files at the same time. 
X
XLet's invoke EMACS and pull back our file on desktop publishing by
Xtyping
X
X.in+0.5i
X.ll-0.5i
Xemacs publish.txt
X.in-0.5i
X.ll+0.5i
X
X
XWhen the text appears, type the \fB^X2\fR \fIsplit-current-window\fR command. The window splits into two
Xwindows. The window where the cursor resides is called the \fBcurrent\fR
Xwindow -- in this case the bottom window. Notice that each window has
Xa text area and a mode line. The \fBcommand line\fR  is however, common to all windows on the screen. 
X
XThe two windows on your screen are virtually mirror images of each other
Xbecause the new window is opened into the same buffer as the one you are
Xin when you issue the \fIopen-window command\fR  . All
Xcommands issued to EMACS are executed on the current buffer in the
Xcurrent window. 
X
XTo move the cursor to the upper window (i.e., to make that window the
Xcurrent window, type \fB^XP\fR \fIprevious-window\fR  . 
XNotice the cursor
Xmoves to the upper or \fBprevious\fR window. Entering \fB^XO\fR\fInext-window\fR moves to the \fBnext\fR window. Practice moving between
Xwindows. You will notice that you can also move into the Function Key
Xmenu by entering these commands. 
X
XNow move to the upper window. Let's open a new file. On the EMACS disk
Xis a tutorial file. Let's call it into the upper window by typing:
X
X.in+0.5i
X.ll-0.5i
X^X^F
X.in-0.5i
X.ll+0.5i
X
X
Xand press return.
X
XEnter the filename \fBemacs.tut\fR.
X
XIn a short time, the tutorial file will appear in the window. We now have
Xtwo windows on the screen, each looking into different buffers. We have
Xjust used the \fB^X^F\fR \fIfind-file\fR  command to find a file and bring
Xit into our current window.
X
XYou can scroll any window up and down with the cursor keys, or with the
Xcommands we've learned so far. However, because the area of visible
Xtext in each window is relatively small, you can scroll the current
Xwindow a line at a time. 
X
XType \fB^X^N\fR \fImove-window-down\fR The current window scrolls down by one line -- the top line of text
Xscrolls out of view, and the bottom line moves towards the top of the
Xscreen. You can imagine, if you like, the whole window slowly moving
Xdown to the end of the buffer in increments of one line. The command\fB^X^P\fR \fImove-window-up\fR scrolls the window in the opposite
Xdirection. 
X
XAs we have seen, EMACS editing commands are executed in the current
Xwindow, but the program does support a useful feature that allows you
Xto scroll the \fBnext\fR window.  \fBM-^Z\fR \fIscroll-next-up\fR scrolls the next window up, \fBM-^V\fR\fIscroll-next-down\fR scrolls it downward. 
XFrom the tutorial window, practice scrolling the window with the
Xdesktop publishing text in it up and down. 
X
XWhen you're finished, exit EMACS without saving any changes in your
Xfiles. 
X
X
XExperiment with splitting the windows on your screen. Open windows
Xinto different buffers and experiment with any other files you may
Xhave. Try editing the text in each window, but don't forget to save
Xany changes you want to keep -- you still have to save each buffer
Xseparately.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBDeleting Windows\fR"
X Windows allow you to perform complex editing tasks with ease. However,
Xthey become an inconvenience when your screen is cluttered with open
Xwindows you have finished using. The simplest solution is to delete
Xunneeded windows. The command \fB^X0\fR \fIdelete-window\fR
Xwill delete the window you are currently working in and move you to the
Xnext window.
X
XIf you have a number of windows open, you can delete all but the current
Xwindow by entering \fB^X1\fR \fIdelete-other-windows\fR.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBResizing Windows\fR"
X During complex editing tasks, you will probably find it convenient to
Xhave a number of windows on the screen simultaneously. However this
Xsituation may present inconveniences because the more windows you have
Xon the screen the smaller they are; in some cases, a window may show
Xonly a couple of lines of text. To increase the flexibility and utility
Xof the window environment, EMACS allows you to resize the window you are
Xworking in (called, as you will recall, the \fBcurrent\fR window) to a
Xconvenient size for easier editing, and then shrink it when you no
Xlonger need it to be so large. 
X
XLet's try an example. Load in any EMACS text file and split the current
Xwindow into two. Now type \fB^X^(Shift-6)\fR,\fIgrow-window\fR . Your current window should be
Xthe lower one on the screen. Notice that it increases in size upwards
Xby one line. If you are in the upper window, it increases in size in a
Xdownward direction. The command \fB^X^Z\fR,\fIshrink-window\fR correspondingly decreases window
Xsize by one line at a time. 
X
XEMACS also allows you to resize a window more precisely by entering a
Xnumeric argument specifying the size of the window in lines. To resize
Xthe window this way, press the META key and enter a numeric argument
X(remember to keep it smaller than the number of lines on your screen
Xdisplay) then press \fB^XW\fR \fIresize-window\fR . 
XThe current window will be enlarged or shrunk to the number of lines
Xspecified in the numeric argument. For example entering:
X
X.in+0.5i
X.ll-0.5i
X\fBM-8 ^XW\fR
X.in-0.5i
X.ll+0.5i
Xwill resize the current window to 8 lines.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBRepositioning within a Window\fR"
X
X
XThe cursor may be centered within a window by entering \fBM-! or M-^L\fR\fIredraw-display\fR  . This command is especially
Xuseful in allowing you to quickly locate the cursor if you are moving
Xfrequently from window to window. You can also use this command to move
Xthe line containing the cursor to any position within the current
Xwindow. This is done by using a numeric argument before the command.
XType \fBM-<n> M-^L\fR where <n> is the number of the line within the
Xwindow that you wish the current line to be displayed.
X
XThe \fB^L\fR \fIRefresh-screen\fR  command is useful
Xfor 'cleaning up' a 'messy' screen that can result of using EMACS on a
Xmainframe system and being interrupted by a system message. 
X.bp
X.fi
X
X.us  "Chapter \n(ch summary"
X
X
XIn Chapter \n(ch you learned how to manipulate windows and the
Xediting flexibility they offer. 
X
X.nf
X.ft CW
X
X.us  "Key Binding	Keystroke	Effect"
X
X
Xopen-window	\fB^X2\f(CW     	Splits current window into two windows if
X				space available
X
Xclose-windows	\fB^X1\f(CW     	Closes all windows except current window
X
Xnext-window	\fB^XO\f(CW    [oh]	Moves point into next (i.e. downward) window
X
Xprevious-window \fB^XP\f(CW     	Moves point to previous (i.e. upward) window
X
Xmove-window-down \fB^X^N\f(CW    	Scrolls current window down one line
X
Xmove-window-up	\fB^X^P\f(CW    	Scrolls current window up one line
X
Xredraw-display	\fBM !\f(CW     or	Window is moved so line with point
X		\fBM ^L\f(CW    	(with cursor) is at center of window
X
Xgrow-window	\fBM-X ^\f(CW    	Current window is enlarged by one
X				line and nearest window is shrunk by 
X				one line
X
Xshrink-window	\fB^X^Z\f(CW    	Current window is shrunk by one line
X				and nearest window is enlarged by one line
X
Xclear-and-redraw \fB^L\f(CW     	Screen is blanked and redrawn.	Keeps
X				screen updates in sync with your commands
X
Xscroll-next-up	\fBM-^Z\f(CW    	Scrolls next window up by one line
X
Xscroll-next-down \fBM-^V\f(CW    	Scrolls next window down by one line
X
Xdelete-window	\fB^X0\f(CW     	Deletes current window
X
Xdelete-other-windows \fB^X1\f(CW    	Deletes all but current window
X
Xresize-window	\fB^X^W\f(CW    	Resizes window to a given numeric argument\fR
X.fi
X
X\fR
X.CH "Using a Mouse"
X
X
X On computers equipped with a mouse , the mouse can
Xusually be used to make editing easier. If your computer has a mouse,
Xlet's try using it. Start MicroEMACS by typing:
X
X emacs publish.txt
X
X This brings EMACS up and allows it to edit the file from the
Xlast chapter. If the function key window is visible on the screen,
Xpress the F5 key to cause it to disappear. Now use the \fB^X2\fR\fIsplit-current-window\fR command to split the screen into two windows. 
XNext use the \fB^X^F\fR \fIfind-file\fR command to read in the \fBfang.txt\fR
Xfile. Now your screen should have two windows looking into two
Xdifferent files.
X
X Grab the mouse and move it around. On the screen an arrow, or
Xblock of color appears. This is called the mouse cursor  and can be positioned on any character on the screen. On some
Xcursor"	\n%
Xcomputers, positioning the mouse cursor in the extreme upper right or
Xleft corner may bring down menus which allow you to access that
Xcomputers utilities, sometimes called \fBDesk Accessories\fR  .
Xaccessories"	\n%
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBMoving around with the mouse\fR"
X
X
X Using the mouse button (or the left button if the mouse has more
Xthan one), position the mouse over some character in the current window. 
XClick the mouse button once. The \fBpoint\fR will move to where the mouse
Xcursor is. If you place the mouse cursor past the end of a line, the
Xpoint will move to the end of that line.
X
X Move the mouse cursor into the other window and click on one of
Xthe characters there. MicroEMACS will automatically make this window
Xthe current window (notice that the mode line changes) and position the
Xpoint to the mouse cursor. This makes it very easy to use the mouse to
Xswitch to a different window quickly.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBDragging around\fR"
X
X
X Besides just using the mouse to move around on the screen, you
Xcan use the same button to move text. Move the mouse cursor to a
Xcharacter in one of the windows, and click down... but don't let the
Xbutton up yet! The point will move to where the mouse cursor is. Now
Xmove the mouse cursor up or down on the screen, and release the button.
XThe point will again move to where the mouse cursor is, but this time
Xit will bring the text under it along for the ride. This is called\fBdragging\fR , and is how you can make the text appear
Xjust where you want it to. If you try to drag text out of the current
Xwindow, EMACS will ignore your attempt and leave the point where you
Xfirst clicked down.  Now, click down on a word in one of the windows, and drag it
Xdirectly to the left. Release the button and watch as the entire
Xwindow slides, or \fBscrolls\fR  to the left. 
XThe missing text has not been deleted, it is simply not visible, off the
Xleft hand side of the screen. Notice the mode line has changed and now
Xlooks like:
X
X.ad l
X==== MicroEMACS 3.10 [<12] (
X.na
X == fang.txt == File: fang.txt =========)
X
X The [] delimits a new field which indicates that the screen is
Xnow scrolled 12 characters from the left margin.
X
X Now grab the same text again, and drag it to the right, pulling
Xthe rest of the text back into the current window. The [<] field will
Xdisappear, meaning that the window is no longer scrolled to the left. 
XThis feature is very useful for looking at wide charts and tables. 
XRemember, MicroEMACS will only scroll the text in the current window
Xsideways if you drag it straight to the side, otherwise it will drag
Xthe text vertically.
X
X Now, place the mouse cursor over a character on the upper mode
Xline, click down, move the mouse cursor up or down a few lines and let
Xgo of the button. The mode line moves to where you dragged it, 
Xchanging the size of the windows above and below it. If you try to
Xmake a window with less than one line, EMACS will not let you. Dragging
Xthe mode lines can make it very fast and easy for you to rearrange the
Xwindows as you would like.
X
X If you have a number of different windows visible on the screen,
Xpositioning the mouse over the mode line of one window and clicking the
Xright mouse button will cause that window to be deleted.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBCut and Paste\fR"
X
X
X If your mouse has two buttons, then you can use the right
Xbutton to do some other things as well. Earlier, we learned how to
Xdefine a \fBregion\fR by using the \fBM-<space>\fR\fIset-mark\fR command. Now, position the mouse over at the beginning of
Xa region you would like to copy. Next click and hold down the right
Xmouse button. Notice that the point jumps to the mouse cursor and
XEMACS reports ``[Mark Set]''. Holding the button down move the mouse to
Xthe end of the text you wish to copy and release the mouse button. 
XEmacs reports ``[Region Copied]'' to let you know it has copied the
Xregion into the KILL buffer. If you now click the right mouse button,
Xwithout moving the mouse, the region you defined would be deleted or\fBcut\fR from the current buffer.
X
X If you move the mouse again, and click the right mouse button
Xdown and up without moving the mouse, the text in the KILL buffer gets
Xinserted, or pasted into the current buffer at the point. 
X
X.bp
X.fi
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XIn Chapter \n(ch , you learned how to use the mouse to move the
Xpoint, switch windows, drag text, and resize windows. You also learned
Xhow to use the right mouse button in order to copy and delete regions
Xand yank them back at other places.
X
X.nf
X.ft CW
X
X.us  "Action	Mouse Directions"
X
X
XMove Cursor	position mouse cursor over desired location
X		click down and up with left button
X
XDrag Text	position mouse cursor over desired text
X		click left button down
X		move to new screen location for text
X		release mouse button
X
XResize Windows	position mouse cursor over mode line to move
X		click left button down
X		move to new location for mode line
X		release mouse button
X
XDelete Window	position mouse cursor over mode line of window to delete
X		click right mouse button
X
XResize Screen	position mouse cursor over last character on message line
X		click left button down
X		move to new lower right corner of screen
X		release mouse button
X
XCopy Region	position mouse at beginning of region
X		click right button down
X		move to end of region
X		release mouse button
X
XCut Region	position mouse at beginning of region
X		click right button down
X		move to end of region
X		release mouse button
X		click right button down and up
X
XPaste region	Position mouse at place to paste
X		click right button down and up
X\fR
X.fi
X
X\fR
X.CH "Buffers"
X
XWe have already learned a number of things about buffers.
XAs you will recall, they are the major internal entities in EMACS --
Xthe place where editing commands are executed. They are characterized
Xby their \fBnames\fR, their \fBmodes\fR, and by the file with which they
Xare associated. Each buffer also ``remembers'' its \fBmark\fR and\fBpoint\fR. This convenient feature allows you to go to other buffers
Xand return to the original location in the ``current'' buffer. 
X
XAdvanced users of EMACS frequently have a number of buffers in the
Xcomputer's memory simultaneously. In the last chapter, for example, you
Xopened at least two buffers -- one into the text you were editing, and
Xthe other into the EMACS on-line tutorial. If you deal with complex
Xtext files -- say, sectioned chapters of a book, you may have five or
Xsix buffers in the computer's memory. You could select different
Xbuffers by simply calling up the file with \fB^X^F\fR \fIfind-file\fR , and let EMACS open or reopen the buffer. However,
XEMACS offers fast and sophisticated buffering techniques that you will
Xfind easy to master and much more convenient to use. 
X
XLet's begin by opening three buffers. You can open any three you
Xchoose, for example call the following files into memory: \fBfang.txt\fR,\fBpublish.txt\fR, and \fBemacs.tut\fR in the order listed here. When
Xyou've finished this process, you'll be looking at a screen showing the
XEMACS tutorial. Let's assume that you want to move to the fang.txt
Xbuffer. Enter:
X\fB^XX\fR \fInext-buffer\fR  This command moves you to the 
X.us  "next"
X buffer. Because EMACS cycles
Xthrough the buffer list, which is alphabetized, you will now be in the\fBfang.txt\fR buffer. Using \fB^XX\fR again places you in the\fBpublish.txt\fR buffer. \fIIf you are on a machine that supports
Xfunction keys, using \fB^XX\fB again places you in the \fBFunction Keys\fB
Xbuffer\fR. Using \fB^XX\fR one last time cycles you back to the beginning
Xof the list.
X
XIf you have a large number of buffers to deal with, this cycling process
Xmay be slow and inconvenient. The command \fB^XB\fR \fIselect-buffer\fR allows you to specify the buffer you wish to be
Xswitched to. When the command is entered, EMACS prompts, ``Use buffer:''. 
XSimply enter the buffer name (NOT the file name), and that buffer will
Xthen become the current buffer. If you type in part of the file name
Xand press the space bar, EMACS will attempt to complete the name from
Xthe list of current buffers. If it succeeds, it will print the rest of
Xthe name and you can hit <NL> to switch to that buffer. If EMACS beeps
Xthe bell, there is no such buffer, and you may continue editing the name
Xon the command line.
X
XMultiple buffer manipulation and editing is a complex activity, and you
Xwill probably find it very inconvenient to re-save each buffer as you
Xmodify it. The command \fB^X^B\fR \fIlist-buffers\fR  creates a new window that gives details about all the buffers currently
Xknown to EMACS. Buffers that have been modified are identified by the
X``buffer changed'' indicator (an asterisk in the second column). You can
Xthus quickly and easily identify buffers that need to be saved to files
Xbefore you exit EMACS. The buffer window also provides other
Xinformation -- buffer specific modes, buffer size, and buffer name are
Xalso listed. To close this window, simply type the close-windows
Xcommand, \fB^X1\fR. 
X
XTo delete any buffer, type \fB^XK\fR \fIdelete-buffer\fR . EMACS prompts you ``Kill buffer:''. Enter the
Xbuffer name you want to delete. As this is destructive command, EMACS
Xwill ask for confirmation if the buffer was changed and not saved. 
XAnswer Y(es) or N(o). As usual \fB^G\fR cancels the command. 
X
X.bp
X.fi
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XIn Chapter \n(ch you learned how to manipulate buffers. 
X
X.nf
X.ft CW
X
X.us  "Key Binding		Keystroke		       Effect"
X
Xnext-buffer		\fB^X^X\f(CW    	Switch to the next buffer in the
X					buffer list
X
Xselect-buffer		\fB^XB\f(CW     	Switch to a particular buffer
X
Xlist-buffers		\fB^X^B\f(CW    	List all buffers
X
Xdelete-buffer		\fB^XK\f(CW     	Delete a particular buffer if it
X					is off-screen\fR
X.fi
X
X\fR
X.CH "Modes"
X
X
X EMACS allows you to change the way it works in order to
Xcustomized it to the style of editing you are using. It does this by
Xproviding a number of different \fBmodes\fR  . These modes
Xcan effect either a single buffer, or any new buffer that is created. 
XTo add a mode to the current buffer, type \fB^XM\fR \fIadd-mode\fR . EMACS will then prompt you for the name of a mode to
Xadd. When you type in a legal mode name, and type a <NL>, EMACS will
Xadd the mode name to the list of current mode names in the mode line of
Xthe current buffer. 
X
X To remove an existing mode, typing the \fB^X^M\fR \fIdelete-mode\fR will cause EMACS to prompt you for the name of a
Xmode to delete from the current buffer. This will remove that mode from
Xthe mode list on the current mode line.
X
X Global modes are the modes which are inherited by any new
Xbuffers which are created. For example, if you wish to always do string
Xsearching with character case being significant, you would want global
Xmode EXACT to be set so that any new files read in inherent the EXACT
Xmode. Global modes are set with the \fBM-M\fR \fIadd-global-mode\fR command, and unset with the \fBM-^M\fR\fIdelete-global-mode\fR  command. Also, the
Xcurrent global modes are displayed in the first line of a\fB^X^B\fR \fIlist-buffers\fR  command.
X
X On machines which are capable of displaying colors, the mode commands can also set the background and
Xforeground character colors. Using \fIadd-mode\fR or \fIdelete-mode\fR with
Xa lowercase color will set the background color in the current window. 
XAn uppercase color will set the foreground color in the current window. 
XColors that EMACS knows about are: white, cyan, magenta, yellow, blue,
Xred, green, and black. If the computer you are running on does not have
Xeight colors, EMACS will attempt to make some intelligent guess at what
Xcolor to use when you ask for one which is not there. 
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBASAVE mode\fR"
X Automatic Save mode tells EMACS to automatically write out the
Xcurrent buffer to its associated file on a regular basis. Normally this
Xwill be every 256 characters typed into the file. The environment
Xvariable $ACOUNT counts down to the next auto-save, and $ASAVE is the
Xvalue used to reset $ACOUNT after a save occurs. 
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBCMODE mode\fR"
X CMODE is useful to C programmers. When CMODE is active, EMACS
Xwill try to assist the user in a number of ways. This mode is set
Xautomatically with files that have a .c or .h extension. 
X
X The <NL> key will normally attempt to return the user to the
Xnext line at the same level of indentation as the last non blank line,
Xunless the current line ends with a open brace ({) in which case the
Xnew line will be further indented by one tab position.
X
X A close brace (}) will search for the corresponding open brace
Xand line up with it.
X
X A pound sign (#) with only leading white space will delete all
Xthe white space preceding itself. This will always bring preprocessor
Xdirectives flush to the left margin.
X
X Whenever any close fence is typed, IE )]>}, if the matching open
Xfence is on screen in the current window, the cursor will briefly flash
Xto it, and then back. This makes balancing expressions, and matching
Xblocks much easier.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBCRYPT mode\fR"
X When a buffer is in CRYPT mode,  it is
Xencrypted whenever it is written to a file, and decrypted when it is
Xread from the file. The encryption key can be specified on the command
Xline with the -k switch, or with the \fBM-E\fR \fIset-encryption-key\fR command. If you attempt to read or write a
Xbuffer in crypt mode and now key has not been set, EMACS will execute\fIset-encryption-key\fR automatically, prompting you for the needed key. 
XWhenever EMACS prompts you for a key, it will not echo the key to your
Xscreen as you type it (IE make SURE you get it right when you set it
Xoriginally).
X
X The encryption algorithm used changes all characters into normal
Xprinting characters, thus the resulting file is suitable for sending via
Xelectronic mail. All version of MicroEMACS should be able decrypt the
Xresulting file regardless of what machine encrypted it. Also available
Xwith EMACS is the stand alone program, MicroCRYPT, which can en/decrypt
Xthe files produced by CRYPT mode in EMACS.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBEXACT mode\fR"
X All string searches and replacements will take upper/lower case
Xinto account. Normally the case of a string during a search or replace
Xis not taken into account.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBMAGIC mode\fR"
X In the MAGIC mode certain characters gain special meanings when
Xused in a search pattern. Collectively they are know as regular
Xexpressions, and a limited number of them are supported in MicroEmacs. 
XThey grant greater flexibility when using the search command. However,
Xthey do not affect the incremental search command. 
X
XThe symbols that have special meaning in MAGIC mode are
X^, $, ., &, *, [ (and ], used with it), and \\.
X
X The characters ^and $ fix the search pattern to the beginning and
Xend of line, respectively. The ^character must appear at the beginning
Xof the search string, and the $ must appear at the end, otherwise they
Xloose their meaning and are treated just like any other character. For
Xexample, in MAGIC mode, searching for the pattern ``t$'' would put the
Xcursor at the end of any line that ended with the letter 't'. Note that
Xthis is different than searching for ``t<NL>'', that is, 't' followed by a
Xnewline character. The character $ (and ^, for that matter) matches a
Xposition, not a character, so the cursor remains at the end of the line. 
XBut a newline is a character that must be matched, just like any other
Xcharacter, which means that the cursor is placed just after it - on the
Xbeginning of the next line. 
X
XThe character . has a very simple meaning -- it matches any single
Xcharacter, except the newline. Thus a search for ``bad.er'' could match
X``badger'', ``badder'' (slang), or up to the 'r' of ``bad error''. 
X
XThe character * is known as closure, and means that zero or more of
Xthe preceding character will match. If there is no character preceding,
X* has no special meaning, and since it will not match with a newline, *
Xwill have no special meaning if preceded by the beginning of line symbol
X^ or the literal newline character <NL>. 
X
XThe notion of zero or more characters is important. If, for
Xexample, your cursor was on the line
X
X.in+0.5i
X.ll-0.5i
XThis line is missing two vowels.
X.in-0.5i
X.ll+0.5i
X
X
Xand a search was made for ``a*'', the cursor would not move, because it is
Xguaranteed to match no letter 'a' , which satisfies the search
Xconditions. If you wanted to search for one or more of the letter 'a',
Xyou would search for ``aa*'', which would match the letter a, then zero or
Xmore of them. 
X
XThe character [ indicates the beginning of a character class. It
Xis similar to the 'any' character ., but you get to choose which
Xcharacters you want to match. The character class is ended with the
Xcharacter ]. So, while a search for ``ba.e'' will match ``bane'', ``bade'',
X``bale'', ``bate'', et cetera, you can limit it to matching ``babe'' and
X``bake'' by searching for ``ba[bk]e''. Only one of the characters inside
Xthe [ and ] will match a character. If in fact you want to match any
Xcharacter except those in the character class, you can put a ^as the
Xfirst character. It must be the first character of the class, or else
Xit has no special meaning. So, a search for [^aeiou] will match any
Xcharacter except a vowel, but a search for [aeiou^] will match any vowel
Xor a ^.
X
XIf you have a lot of characters in order that you want to put in the
Xcharacter class, you may use a dash (-) as a range character. So, [a-z]
Xwill match any letter (or any lower case letter if EXACT mode is on),
Xand [0-9a-f] will match any digit or any letter 'a' through 'f', which
Xhappen to be the characters for hexadecimal numbers. If the dash is at
Xthe beginning or end of a character class, it is taken to be just a
Xdash. 
X
XThe character & (ampersand) is a replacement character, and
Xrepresents the characters which matched the search string. When used in
Xthe \fBM-R\fR \fIreplace-string\fR  or the \fBM-^R\fR\fIquery-replace-string\fR  commands, the &
Xwill be substituted for the search string. 
X
XThe escape character \\is for those times when you want to be in
XMAGIC mode, but also want to use a regular expression character
Xto be just a character. It turns off the special meaning of the
Xcharacter. So a search for ``it\\.'' will search for a line with ``it.'',
Xand not ``it'' followed by any other character. The escape character
Xwill also let you put ^, -, or ] inside a character class with no
Xspecial side effects.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBOVER mode\fR"
X OVER mode stands for overwrite mode. When in this mode, when
Xcharacters are typed, instead of simply inserting them into the file,
XEMACS will attempt to overwrite an existing character past the point. 
XThis is very useful for adjusting tables and diagrams. 
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBWRAP mode\fR"
X Wrap mode is used when typing in continuous text. Whenever the
Xcursor is past the currently set fill column  (72 by
Xdefault) and the user types a space or a <NL>, the last word of the line
Xis brought down to the beginning of the next line. Using this, one just
Xtypes a continuous stream of words and EMACS automatically inserts <NL>s
Xat appropriate places.
X
X.ce 1
XNOTE to programmers:
X
X.in+0.5i
X.ll-0.5i
XThe EMACS variable $wraphook contains the name of the
Xfunction which executes when EMACS detects it is time to wrap. This is
Xset to the function \fIwrap-word\fR  by default, but can
Xbe changed to activate different functions and macros at wrap time.
X.in-0.5i
X.ll+0.5i
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBVIEW mode\fR"
X VIEW mode disables all commands which can change the current
Xbuffer. EMACS will display an error message and ring the bell every
Xtime you attempt to change a buffer in VIEW mode.
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 modes and their effects.
X
X.nf
X.ft CW
X
X.us  "Key Binding		Keystroke		       Effect"
X
Xadd-mode		\fB^XM\f(CW     	Add a mode to the current buffer
X
Xdelete-mode		\fB^X^M\f(CW    	Delete a mode from the current buffer
X
Xadd-global-mode 	\fBM-M\f(CW     	Add a global mode to the
X					current buffer
X
Xdelete-global-mode	\fBM-^M\f(CW    	Delete a global mode from the
X					current buffer\fR
X.fi
X
X\fR
X.CH "Files"
X
X
XA file is simply a collection of related data. In EMACS we are dealing
Xwith text files -- named collections of text residing on a disk (or some
Xother storage medium). You will recall that the major entities EMACS
Xdeals with are buffers. Disk-based versions of files are only active in
XEMACS when you are reading into or writing out of buffers. As we have
Xalready seen, buffers and physical files are linked by associated
Xfile names. For example, the buffer ``ch7.txt'' which is associated with
Xthe physical disk file ``ch7.txt.'' You will notice that the file is
Xusually specified by the drive name or (in the case of a hard drive) a
Xpath. Thus you can specify full file names in EMACS,
X
Xe.g. disk:\\directories\\filename.extension
X
XIf you do not specify a disk and directories, the default disk and the
Xcurrent directory is used.
X
XIMPORTANT -- If you do not explicitly save your buffer to a file, all your
Xedits will be lost when you leave EMACS (although EMACS will prompt you
Xwhen you are about to lose edits by exiting). In addition, EMACS does
Xnot protect your disk-based files from overwriting when it saves files. 
XThus when you instruct EMACS to save a file to disk, it will create a
Xfile if the specified file doesn't exist, or it will overwrite the
Xpreviously saved version of the file thus replacing it. Your old
Xversion is gone forever. 
X
XIf you are at all unsure about your edits, or if (for any reason) you
Xwish to keep previous versions of a file, you can change the name of
Xthe associated file with the command \fB^XN\fR\fIchange-file-name\fR . When this file is saved
Xto disk, EMACS will create a new physical file under the new name. The
Xearlier disk file will be preserved.
X
XFor example, let's load the file \fBfang.txt\fR into EMACS. Now, type\fB^XN\fR. The EMACS command line prompts ``Name:''. Enter a new name
Xfor the file -- say \fBnew.txt\fR and press <NL>. The file will be
Xsaved under the new filename, and your disk directory will show both\fBfang.txt\fR and \fBnew.txt\fR.
X
XAn alternative method is to write the file directly to disk under a new
Xfilename. Let's pull our ``publish.txt'' file into EMACS. To write this
Xfile under another filename, type \fB^X^W\fR\fIwrite-file\fR . EMACS will prompt you ``write file:''. 
XEnter an alternate filename -- \fBdesktop.txt\fR. Your file will be
Xsaved as the physical file ``desktop.txt''.
X
XNote that in the examples above, although you have changed the names of
Xthe related files, the buffer names remain the same. However, when you
Xpull the physical file back into EMACS, you will find that the buffer
Xname now relates to the filename.
X
XFor example -- You are working with a buffer ``fang.txt'' with the related
Xfile ``fang.txt''. You change the name of the file to ``new.txt''. EMACS
Xnow shows you working with the buffer ``fang.txt'' and the related file
X``new.txt''. Now pull the file ``new.txt'' into EMACS. Notice that the
Xbuffer name has now changed to ``new.txt''. 
X
XIf for any reason a conflict of buffer names occurs,(if you have files
Xof the same name on different drives for example) EMACS will prompt
Xyou ``use buffer:''. Enter an alternative buffer name if you need to. 
X
XFor a list of file related commands (including some we`ve already
Xseen), see the summary page.
X.bp
X.fi
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XIn Chapter \n(ch you learned some of the more advanced
Xconcepts of file naming and manipulation. The relationship between
Xfiles and buffers was discussed in some detail. 
X
X.nf
X.ft CW
X
X.us  "Key Binding	Keystroke	Effect"
X
X
Xsave-file	\fB^X^S\f(CW    	Saves contents of current buffer with
X				associated filename on default disk/
X				directory (if not specified)
X
Xwrite-file	\fB^X^W\f(CW    	Current buffer contents will be
X				saved under specified name 
X
Xchange-file-name
X		\fB^XN\f(CW     	The associated filename is changed
X				(or associated if not previously
X				specified) as specified
X
Xfind-file	\fB^X^F\f(CW    	Reads specified file into buffer and 
X				switches you to that buffer, or switches
X				to buffer in which the file has previously
X				been read
X
Xread-file	\fB^X^R\f(CW    	Reads file into buffer thus overwriting
X				buffer contents.  If file has already
X				been read into another buffer, you will
X				be switched to it
X
Xview-file	\fB^X^V\f(CW    	The same as read-file except the buffer
X				is automatically put into VIEW mode thus 
X				preventing any changes from being made\fR
X.fi
X
X\fR
X.CH "Screen Formatting"
X
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBWrapping Text\fR"
X
X
XAs we learned in the introduction, EMACS is not a word processor, but an
Xeditor. Some simple formatting options are available however, although
Xin most cases they will not affect the appearance of the finished text when it is run through the formatter. We have
Xalready encountered WRAP mode which wraps lines longer than a certain
Xlength (default is 75 characters). You will recall that WRAP is enabled
Xby entering \fB^XM\fR and responding to the command line prompt with\fBwrap\fR. 
X
XYou can also set your own wrap margin with the command \fB^XF\fR\fIset-fill-column\fR  . Notice EMACS responds
X``[Fill column is 1].'' Now try typing some text. You'll notice some very
Xstrange things happening -- your text wraps at every word!! This effect
Xoccurs because the set wrap margin command must be preceded by a
Xnumeric argument or EMACS sets it to the first column. Thus any text
Xyou type that extends past the first column will wrap at the most
Xconvenient line break. 
X
XTo reset the wrap column to 72 characters, press the \fB<META>\fR key and
Xenter 72. EMACS will respond ``Arg: 72''. Now press \fB^XF\fR. EMACS
Xwill respond ``[Fill column is 72]''. Your text will again wrap at the
Xmargin you've been using up to this point.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBReformatting Paragraphs\fR"
X
X
XAfter an intensive editing session, you may find that you have
Xparagraphs containing lines of differing lengths. Although this
Xdisparity will not affect the formatted text, aesthetic and technical
Xconcerns may make it desirable to have consistent paragraph blocks on
Xthe screen. If you are in WRAP mode, you can reformat a paragraph with
Xthe command \fBM-Q\fR \fIfill-paragraph\fR  . This
Xcommand 'fills' the current paragraph reformatting it so all the lines
Xare filled and wrap logically.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBChanging Case\fR"
X
X
XThere may be occasions when you find it necessary to change the case of
Xthe text you've entered. EMACS allows you to change the case of even
Xlarge amounts of text with ease. Let's try and convert a few of the
Xoffice traditionalists to the joy of word processing. Type in the
Xfollowing text:
X
X.in+0.5i
X.ll-0.5i
XThrow away your typewriter and learn to use a word processor. 
XWord processing is relatively easy to learn and will increase your
Xproductivity enormously. Enter the Computer Age and find out just how
Xmuch fun it can be!!
X.in-0.5i
X.ll+0.5i
X
X
XLet's give it a little more impact by capitalizing the first four words. 
XThe first step is to define the region of text just as you would if you
Xwere doing an extensive deletion. Set the mark at the beginning of the
Xparagraph with \fBM-<space>\fR \fIset-mark\fR and move the cursor to the
Xspace beyond ``typewriter.'' Now enter \fB^X^U\fR \fIcase-region-upper\fR. 
XYour text should now look like this:
X
X.in+0.5i
X.ll-0.5i
XTHROW AWAY YOUR TYPEWRITER and learn to use a word processor. 
XWord processing is relatively easy to learn and will increase your
Xproductivity enormously. Enter the Computer Age and find out just how
Xmuch fun it can be!!
X.in-0.5i
X.ll+0.5i
X
X
XIf you want to change the text back to lower case, type \fB^X^L\fR\fIcase-region-lower\fR  . You can also
Xcapitalize individual words. To capitalize the word ``fun'', position the
Xcursor in front of the word and type \fBM-U\fR \fIcase-word-upper\fR . The word is now capitalized. To change it
Xck to lower case, move the cursor back to the beginning of the word
Xand type \fBM-L\fR \fIcase-word-lower\fR  . 
X
XYou may also capitalize individual letters in EMACS. The command\fBM-C\fR \fIcase-word-capitalize\fR  capitalizes the first letter after the point. This command would
Xnormally be issued with the cursor positioned in front of the first
Xletter of the word you wish to capitalize. If you issue it in the
Xmiddle of a word, you can end up with some strAnge looking text. 
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBTabs\fR"
X
X
XUnless your formatter is instructed to take screen text literally (as
XMicroSCRIBE does in the 'verbatim' environment for example), tabs in
XEMACS generally affect screen formatting only. 
X
XWhen EMACS is first started, it sets the default tab to every eighth
Xcolumn. As long as you stay with default, every time you press the tab
Xkey a tab character, \fB^I\fR is inserted. This character, like other
Xcontrol characters, is invisible -- but it makes a subtle and
Xsignificant difference to your file and editing. 
X

END_OF_FILE
echo shar: NEWLINE appended to \"'medoc.p02'\"
if test 39832 -ne `wc -c <'medoc.p02'`; then
    echo shar: \"'medoc.p02'\" unpacked with wrong size!
fi
# end of 'medoc.p02'
fi
echo shar: End of archive 3 \(of 6\).
cp /dev/null ark3isdone
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