[comp.sources.misc] Troffable uEmacs

roger@mips.UUCP (Roger March) (08/11/87)

	  Apparently part 1 of the last posting got munched at a number of
	sites. I hate clogging up your loaded system, but could you please
	post it again. I'm not sure how I chopped it up last time so I'm
	sending you two parts again, this time in SHAR format. Just unbundle
	them and try something like:

		cat me.ms.1 me.ms.2 | tbl | troff -ms

	or equivalent. Thanks.

__
-Rogue Monster
UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!roger  OR  roger@mips.com
USPS: MIPS Computer Systems, 930 Arques, Sunnyvale, CA 94086, (408) 991-0220
#--------------------------Cut Here--------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before the "#! /bin/sh" line,
# then unpack it by saving it in a file and typing "sh file."
#
# Wrapped by Roger March,,,,obiwan,open (roger) at obiwan on Sun Aug  2 15:37:24 1987
#
# unpacks with default permissions
#
# Contents : me.ms.1
#
if `test ! -s me.ms.1`
then
echo "x - me.ms.1"
cat > me.ms.1 << '@\Rogue\Monster\'
.de sf
.in +.2i
..
.de sb
.in -.2i
..
.DS C
.sp 2i
.ps +9
MicroEMACS
.ps -9
.sp
Full Screen Text Editor
Reference Manual (preliminary draft)
.sp
Version 3.8i
April 27, 1987
.sp
(C)opyright 1987 by Daniel M. Lawrence
Reference Manual (C)opyright 1987
.ti +4
by Brian Straight and Daniel M. Lawrence
All Rights Reserved
.sp
.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.)
.R
.DE
.bp
.SH
Introduction
.sf
.PP
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.
.PP
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.
.PP
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.
.PP
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. 
.PP
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).
.sb
.SH
History
.sf
.PP
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.
.PP
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:
.sp
.in +8
.IP USMAIL: 12
Daniel Lawrence
617 New York St
Lafayette, IN 47901
.IP UUCP:
ihnp4!pur-ee!pur-phy!duncan!lawrence
.nr PD 0
.IP ARPA:
nwd@j.cc.purdue.edu
.IP FIDO:
Fido 201/2 The Programmer's Room (317) 742-5533
.nr PD 0.3vs
.in -8
.sb
.bp
.SH
Basic Concepts
.sf
.PP
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. 
.SH
Keys and the Keyboard
.sf
.PP
Many times throughout this manual we will be talking about
.I "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:
.sp
.IP "<NL>" 15
NewLine which is also called RETURN or ENTER, this key is used to
end different commands. 
.IP "^"
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
the C key at the same time. 
.IP "^X"
The CONTROL-X key is used at the beginning of many different commands. 
.IP "META or M-"
This is a special EMACS key used to begin many commands as 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).
.sp
.LP
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."
.sb
.SH
Getting Started
.sf
.PP
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.
.sb
.SH
Parts and Pieces
.sf
.PP
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
shifted function keys.  We will discuss these keys later. 
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. 
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. 
.KS
.TS
tab(;);
r1 l1 r1 l1 c1 r1 l1 r1 l1
r1 l1 r1 l1 c1 r1 l1 r1 l1
r1 l1 r1 l1 c1 r1 l1 r1 l1
r1 l1 r1 l1 c1 r1 l1 r1 l1
r1 l1 r1 l1 c1 r1 l1 r1 l1
l s s s s s s s s
l s s s s s s s s.
=
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 paragragh;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 ---------------------------------------
=
.sp 1i
=
 -- MicroEMACS 3.8i () -- Main ------------------------------------------------
=
.TE
.sp
.IP "Fig 1:" 10
EMACS screen on an IBM-PC
.KE
.sb
.SH
Entering Text
.sf
.PP
Entering text in EMACS is simple.  Type the following sentence fragment:
.IP
.I
Fang Rock lighthouse, center of a series of mysterious and
.R
.LP
The text is displayed at the top of the text window.  Now type:
.IP
.I
terrifying events at the turn of the century
.R
.LP
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
the way it works by setting various
.B "modes."
In this case, you need to set
.B "WRAP"
mode, using the
.I "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.*
.FS
* 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.
.FE
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.
.PP
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. 
.IP
.I
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. 
.sp .5
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.
.R
.sb
.SH
Basic cursor movement
.sf
.PP
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."
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. 
.PP
Notice that EMACS commands are usually mnemonic -- F for forward, B for
backward, for example.
.PP
To move the cursor up one line, enter
.B "^P"
.I "previous-line,"
down one line
.B "^N"
.I "next-line."
Practice this movement by moving the cursor to the word
"terrifying" in the second line. 
.PP
The cursor may also be moved forward or backward in smaller increments. 
To move forward by one character, enter
.B "^F"
.I "forward-character,"
to move backward,
.B "^B"
.I "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. 
.PP
Two other simple cursor commands that are useful to help us move around
in the text are
.B "M-N"
.I "next-paragraph"
which moves the cursor to the second paragraph, and
.B "M-P"
.I "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."
Notice the cursor moves to the word "events"
at the beginning of the line.  Pressing
.B "^E"
.I "end-of-line"
moves the cursor to the end of the line. 
.PP
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"
moves the cursor to the end of the buffer,
.B "M-<"
.I "beginning-of-file"
to the first character of the file. 
.PP
On the IBM-PC, the ATARI ST and many other machines, the cursor keys
can also be used to move the cursor about.  Also, if
there is one available, moving the mouse will move the cursor.
.PP
Practice moving the cursor in the text until you are comfortable with
the commands we've explored in this chapter.
.sb
.SH
Saving your text
.sf
.PP
When you've finished practicing cursor movement, save your file.
Your 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."
Notice that EMACS informs you that
your file has no name and will not let you save it. 
.PP
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."
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. 
.PP
Congratulations!! You've just saved your first EMACS file!
.sb
.SH
Summary
.sf
.PP
In this 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:
.KS
.TS
tab(;);
l l l
lfI lfB l.
Key Binding;Keystroke;Effect
_
abort-command;^G;aborts current command
.sp .5
add-mode;^XM;allows addition of EMACS mode such as \fBWARP\fR
.sp .5
backward-character;^B;moves cursor left one character
.sp .5
beginning-of-file;M-<;moves cursor to beginning of file
.sp .5
beginning-of-line;^A;moves cursor to beginning of line
.sp .5
end-of-file;M->;moves cursor to end of file
.sp .5
end-of-line;^E;moves cursor to end of line
.sp .5
forward-character;^F;moves cursor right one character
.sp .5
next-line;^N;moves cursor to next line
.sp .5
next-paragraph;M-N;moves cursor to next paragraph
.sp .5
next-word;M-F;moves cursor forward one word
.sp .5
previous-line;^P;moves cursor backward by one line
.sp .5
previous-paragraph;M-P;moves cursor to previous paragraph
.sp .5
previous-word;M-B;moves cursor backward by one word
.sp .5
save-file;^X-^S;saves current buffer to a file
.sp .5
write-file;^X-^W;save current buffer under a new name
.TE
.KE
.sb
.sb
.bp
.SH
Basic Editing--Simple Insertions and Deletions
.sf
.SH
A Word About Windows, Buffers, Screens, and Modes
.sf
.PP
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.
.IP
.B "emacs fang.txt"
.LP
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.
.PP
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
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."
.PP
The computer talks to you through the use of its
.B "screen."
This 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 '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 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. 
.PP
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.
.sb
.SH
Insertions
.sf
.PP
Your previously-saved text should look like this:
.IP
.I
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. 
.sp
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.
.LP
.R
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:
.IP
.I
This gives entry to the lower floor where the big steam
generator throbs steadily away, providing power for the electric
lantern.
.LP
.R
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"
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. 
.PP
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"
(Oh, not zero). 
You've just learned how to insert a blank line in your text. 
.sb
.SH
Deletions
.sf
.PP
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."
Notice that the cursor moves back
and obliterates the "r" -- either command will backspace the cursor. 
.PP
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."
Move the cursor down one line to the
beginning of the first paragraph. 
.PP
To delete the forward character, type
.B "^D"
.I "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"
kills the word immediately before the cursor.
.B "M-^H"
has the same effect. 
.PP
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."
Now let's take out the remainder of the first line by typing
.B "^K"
.I "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"
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."
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. 
.sb
.SH
Summary
.sf
.PP
In this chapter, you learned about the basic 'building
blocks' of an EMACS text file--buffers, windows, and files. 
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
delete-previous-character;^H;T{
deletes character immediately before the current cursor position
T}
.sp .5
delete-next-character;^D;T{
deletes character immediately after current cursor position
T}
.sp .5
delete-previous-word;M-^H;T{
deletes word immediately before current cursor position
T}
.sp .5
delete-next-word;M-D;T{
deletes word immediately after current cursor position
T}
.sp .5
kill-to-end-of-line;^K;T{
deletes from current cursor position to end of line
T}
.sp .5
insert-space;^C;inserts a space to right of cursor
.sp .5
open-line;^O;inserts blank line
.sp .5
delete-blank-lines;^X-^O;removes blank line
.sp .5
exit-emacs;^X-^C;exits emacs
.TE
.KE
.sb
.sb
.bp
.SH
Using Regions
.sf
.SH
Defining and Deleting a Region
.sf
.PP
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
.I "point"
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. 
.PP
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:
.IP
.I
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. 
.sp
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. 
.sp
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.
.LP
.R
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."
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."
The paragraph disappears from the screen. 
.PP
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."
Your text should now look like this:
.IP
.I
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. 
.sp
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.
.LP
.R
.sb
.SH
Yanking a Region
.sf
.PP
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. 
.PP
There are other uses to which the kill buffer can be put.  Using the
method we've already learned, define the last
paragraph as a region.  Now type
.B "M-W"
.I "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. 
.PP
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. 
.sb
.SH
Summary
.sf
.PP
In this 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. 
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
Delete-Region;^W;T{
Deletes region between point and mark and places it in KILL buffer
T}
.sp .5
Copy-Region;M-W;T{
Copies text between point and mark into KILL buffer
T}
.sp .5
Yank-Text;^Y;T{
Inserts a copy of the KILL buffer into current buffer at point
T}
.TE
.KE
.sb
.sb
.bp
.SH
Search and Replace
.sf
.SH
Forward Search
.sf
.PP
Load EMACS and bring in the file you just saved.  Your file should look
like the one below.
.IP
.I
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. 
.sp
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.
.LP
.R
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."
Note that the command line now reads
.IP
"Search [] <META>:" 
.LP
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."
.PP
Notice that you must enter the <META> key to start the search.  If you
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. 
.PP
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
search string as the
.B "default"
string.  If you press
.B "<META>"
now, EMACS will search for the default string, in this case, "revolutionary."
.PP
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:
.IP
"search [and<NL>]<META>:"
.LP
Press
.B "<META>"
and the cursor moves to "and" at the end of the second last line.
.sb
.SH
Exact Searches
.sf
.PP
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."
.sb
.SH
Backward Search
.sf
.PP
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."
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). 
.PP
Practice searching for other words in your text.
.sb
.SH
Searching and Replacing
.sf
.PP
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."
The command line responds:
.IP
"Replace []<META>:"
.LP
where the square brackets enclose the default string.  Type the word
.B "electronic"
and hit
.B "<META>."
The command line responds:
.IP
"with []<META>"
.LP
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.
.PP
You have just completed an
.B "unconditional replace."
In this
operation, EMACS replaces every instance of the found string with the
replacement string. 
.sb
.SH	 
Query-Replace
.sf
.PP
You may also replace text on a case by case basis.  The
.B "M-^R"
.I "query-replace-string"
command causes EMACS to pause at each instance of the found string. 
.PP
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"
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:
.KS
.TS
tab(;);
l lw(4i).
Response;Effect
_
Y(es);T{
Make the current replacement and skip to the next occurrence
of the search string
T}
.sp .5
N(o);Do not make this replacement but continue
.sp .5
 !;Do the rest of the replacements with no more queries
.sp .5
U(ndo);T{
Undo just the last replacement and query for it again (This
can only go back ONE time)
T}
.sp .5
^G;T{
Abort the replacement command (This action does not
undo previously-authorized replacements
T}
.sp .5
 .;T{
Same effect as ^G, but cursor returns to the point at
which the replacement command was given
T}
.sp .5
 ?;This lists help for the query replacement command
.TE
.KE
.sp
Practice searching and searching and replacing until you feel
comfortable with the commands and their effects.
.sb
.SH
Summary
.sf
.PP
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. 
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
Search-Forward;^S;T{
Searches from point to end of buffer.
Point is moved from current location to the end of the found string
T}
.sp .5
Search-Backward;^R;T{
Searches from point to beginning of buffer. 
Point is moved from current location to beginning of found string
T}
.sp .5
Replace;M-R;T{
Replace ALL occurrences of search string with 
specified (null) string from point to the end of the current buffer
T}
.sp .5
Query-Replace;M-^R;T{
As above, but pause at each found string and query for action
T}
.TE
.KE
.sb
.sb
.bp
.SH
Windows
.sf
.SH
Creating Windows
.sf
.PP
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.
.PP
You will recall that windows are areas of buffer text that you can see
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. 
.PP
Let's invoke EMACS and pull back our file on desktop publishing by
typing
.IP
.I
emacs publish.txt
.LP
.R
When the text appears, type the
.B "^X-2"
.I "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. 
.PP
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.
.PP
To move the cursor to the upper window (i.e., to make that window the
current window, type
.B "^X-P"
.I "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. 
.PP
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:
.IP
.B "^X-^F"
.I "find-file"
.LP
and press return.  Then enter the filename
.B "emacs.tut."
.PP
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"
command to find a file and bring it into our current window. 
.PP
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.  
.PP
Type
.B "^X-^N"
.I "move-window-down"
.PP
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"
scrolls the window in the opposite direction. 
.PP
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"
scrolls the next window up,
.B "M-^U"
.I "scroll-next-down"
scrolls it downward.  From
the tutorial window, practice scrolling the window with the desktop
publishing text in it up and down. 
.PP
When you're finished, exit EMACS without saving any changes in your
files. 
.PP
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. 
.PP
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.
.sb
.SH
Deleting Windows
.sf
.sb
.SH
Resizing Windows
.sf
.sb
.SH
Other Window commands
.sf
.sb
.SH
Summary
.sf
.PP
In this chapter you learned how to manipulate windows and the
editing flexibility they offer. 
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
Open-Window;^X-2;T{
Splits current window into two windows if space is available
T}
.sp .5
Close-Windows;^X-1;T{
Closes all windows except current window
T}
.sp .5
Next-Window;^X-O;T{
Moves point into next (i.e. downward) window
T}
.sp .5
Previous-Window;^X-P;T{
Moves point to previous (i.e. upward) window
T}
.sp .5
Move-Window-Down;^X-^N; Scrolls current window down one line
.sp .5
Move-Window-Up;^X-^P;Scrolls current window up one line
.sp .5
Redraw-display;M-!;T{
Window is moved so line with point (with cursor) is at center of window
T}
\^;M-^L\^
.sp .5
Grow-Window;^X-^;T{
Current window is enlarged by one line and nearest window is shrunk by one line
T}
.sp .5
Shrink-Window;^X-^Z;T{
Current window is shrunk by one line and nearest window is enlarged by one line
T}
.sp .5
Clear-and-Redraw;^L;T{
Screen is blanked and redrawn. Keeps screen updates in sync with your commands
T}
.sp .5
Scroll-Next-Up;M-^Z;Scrolls next window up by one line
.sp .5
Scroll-Next-Down;M-^U;Scrolls next window down by one line
.TE
.KE
.sb
.sb
.bp
.SH
Buffers
.sf
.SH
More Buffer Stuff
.sf
.PP
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. 
.PP
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,"
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. 
.PP
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:
.IP
.B "^X-X"
.I "next-buffer"
.LP
This command moves you to the 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*.
.FS
* 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.
.FE
.PP
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"
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. 
.PP
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"
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."
.PP
To delete any buffer, type
.B "^X-K"
.I "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. 
.sb
.SH
Summary
.sf
.PP
In this chapter you learned how to manipulate buffers. 
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
Next-Buffer;^X-^X;Switch to the next buffer in the buffer list
.sp .5
Select-Buffer;^X-B;Switch to a particular buffer
.sp .5
List-Buffers;^X-^B;List all buffers
.sp .5
Delete-Buffer;^X-K;delete a particular buffer if it is off-screen
.TE
.KE
.sb
.sb
.bp
.SH
Modes
.sf
.PP
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."
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."
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. 
.PP
To remove an existing mode, typing the
.B "^X-^M"
.I "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.
.PP
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"
command, and unset with the
.B "M-^M"
.I "delete-global-mode"
command.  Also, the
current global modes are displayed in the first line of a
.B "^X-^B"
.I "list-buffers"
command.
.PP
On machines which are capable of displaying colors,
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. 
.SH
ASAVE mode
.sf
.PP
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. 
.sb
.SH
CMODE mode
.sf
.PP
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. 
.PP
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.
.PP
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. 
.PP
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.
.PP
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.
.sb
.SH
CRYPT mode
.sf
.PP
When a buffer is in CRYPT mode, 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"
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).
.PP
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.
.sb
.SH
EXACT mode
.sf
.PP
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.
.sb
.SH
MAGIC mode
.sf
.PP
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. 
.PP
The symbols that have special meaning in MAGIC mode are
 ^, $, ., *, [ (and ], used with it), and \.
.PP
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. 
.PP
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". 
.PP
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>. 
.PP
The notion of zero or more characters is important.  If, for
example, your cursor was on the line
.IP
.I
This line is missing two vowels.
.LP
.R
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. 
.PP
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 ^.
.PP
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. 
.PP
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.
.sb
.SH
OVER mode
.sf
.PP
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. 
.sb
.SH
WRAP mode
.sf
.PP
Wrap mode is used when typing in continuous text.  Whenever the
cursor is past the currently set 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.
.DS C
NOTE to programmers:
.DE
.IP
EMACS actually calls up the function bound to the illegal
keystroke M-FNW.  This is bound to the function
.I "wrap-word"
by default, but can be re-bound to activate different
functions and macros at wrap time.
.sb
.SH
VIEW mode
.sf
.PP
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.
.sb
.SH
Summary
.sf
.PP
In this chapter you learned about modes and their effects.
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
Add-Mode;^X-M;Add a mode to the current buffer
.sp .5
Delete-Mode;^X-^M;Delete a mode from the current buffer
.sp .5
Add-Global-Mode;M-M;Add a global mode to the current buffer
Delete-Global-Mode;M-^M;Delete a global mode from the current buffer
.TE
.KE
.sb
.sb
.bp
.SH
Files
.sf
.PP
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,
.IP
e.g. disk:\directories\filename.extension
.LP
If you do not specify a disk and directories, the default disk is used.
.PP
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. 
.PP
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.
.PP
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."
.PP
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".
.PP
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.
.PP
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".
.PP
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. 
.PP
For a list of file related commands (including some we`ve already
seen), see the summary page.
.SH
Summary
.sf
.PP
In this 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. 
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
Save-file;^X-^S;T{
Saves contents of current buffer with
associated filename on default disk/directory (if not specified)
T}
.sp .5
Write-File;^X-^W;T{
Current buffer contents will be saved under specified name 
T}
.sp .5
Change-File-name;^X-N;T{
The associated filename is changed (or associated if not previously
specified) as specified
T}
.sp .5
Find-File;^X-^F;T{
Reads specified file into buffer and  switches you to that buffer, or switches
to buffer in which the file has previously been read
T}
.sp .5
Read-File;^X-^R;T{
Reads file into buffer thus overwriting buffer contents.  If file has already
been read into another buffer, you will be switched to it
T}
.sp .5
View-File;^X-^V;T{
The same as read-file except the buffer
is automatically put into VIEW mode thus 
preventing any changes from being made
T}
.TE
.KE
.sb
.sb
.bp
.SH
Screen Formatting
.sf
.SH
Wrapping Text
.sf
.PP
As we learned in the introduction, EMACS is not a word processor, but an
editor.  Some simple formatting options are available however, although
in most cases they will not affect the appearance of the finished text
when it is run through the formatter.  We have
already encountered WRAP mode which wraps lines longer than a certain
length (default is 75 characters).  You will recall that WRAP is enabled
by entering
.B "^X-M"
and responding to the command line prompt with
.B "wrap."
.PP
You can also set your own wrap margin with the command
.B "^X-F"
@\Rogue\Monster\
else
  echo "shar: Will not over write me.ms.1"
fi
echo "Finished archive 1 of 2"
# to concatenate archives, remove anything after this line
exi  e

roger@mips.UUCP (Roger March) (08/11/87)

#--------------------------Cut Here--------------------------
#! /bin/sh
# This is a shell archive.  Remove anything before the "#! /bin/sh" line,
# then unpack it by saving it in a file and typing "sh file."
#
# Wrapped by Roger March,,,,obiwan,open (roger) at obiwan on Sun Aug  2 15:37:24 1987
#
# unpacks with default permissions
#
# Contents : me.ms.2
#
if `test ! -s me.ms.2`
then
echo "x - me.ms.2"
cat > me.ms.2 << '@\Rogue\Monster\'
.I "set-fill-column."
Notice EMACS responds
"[Fill column is 1]." Now try typing some text.  You'll notice some very
strange things happening -- your text wraps at every word!! This effect
occurs because the set wrap margin command must be preceded by a
numeric argument or EMACS sets it to the first column.  Thus any text
you type that extends past the first column will wrap at the most
convenient line break. 
.PP
To reset the wrap column to 72 characters, press the
.B "<META>"
key and enter 72.  EMACS will respond "Arg: 72".  Now press
.B "^X-F."
EMACS will respond "[Fill column is 72]".  Your text will again wrap at the
margin you've been using up to this point.
.sb
.SH
Reformatting Paragraphs
.sf
.PP
After an intensive editing session, you may find that you have
paragraphs containing lines of differing lengths.  Although this
disparity will not affect the formatted text, aesthetic and technical
concerns may make it desirable to have consistent paragraph blocks on
the screen.  If you are in WRAP mode, you can reformat a paragraph with
the command
.B "M-Q"
.I "fill-paragraph."
This command 'fills' the current paragraph reformatting it so all the lines
are filled and wrap logically.  The process is complex, and (especially
with longer paragraphs) may take a little time. 
.sb
.SH
Changing Case
.sf
.PP
There may be occasions when you find it necessary to change the case of
the text you've entered.  EMACS allows you to change the case of even
large amounts of text with ease.  Let's try and convert a few of the
office traditionalists to the joy of word processing.  Type in the
following text:
.IP
.I
Throw away your typewriter and learn to use a word processor. 
Word processing is relatively easy to learn and will increase your
productivity enormously.  Enter the Computer Age and find out just how
much fun it can be!!
.LP
.R
Let's give it a little more impact by capitalizing the first four words. 
The first step is to define the region of text just as you would if you
were doing an extensive deletion.  Set the mark at the beginning of the
paragraph with
.B "M-<space>"
.I "set-mark"
and move the cursor to the space beyond "typewriter." Now enter
.B "^X-^U"
.I "case-region-upper."
Your text should now look like this:
.IP
.I
THROW AWAY YOUR TYPEWRITER and learn to use a word processor. 
Word processing is relatively easy to learn and will increase your
productivity enormously.  Enter the Computer Age and find out just how
much fun it can be!!
.LP
.R
If you want to change the text back to lower case, type
.B "^X-^L"
.I "case-region-lower."
You can also
capitalize individual words.  To capitalize the word "fun", position the
cursor in front of the word and type
.B "M-U"
.I "case-word-upper."
The word is now capitalized.  To change it
back to lower case, move the cursor back to the beginning of the word
and type
.B "M-L"
.I "case-word-lower."
.PP
You may also capitalize individual letters in EMACS.  The command
.B "M-C"
.I "case-word-capitalize"
capitalizes the first letter after the point.  This command would
normally be issued with the cursor positioned in front of the first
letter of the word you wish to capitalize.  If you issue it in the
middle of a word, you can end up with some strAnge looking text. 
.sb
.SH
Tabs
.sf
.PP
Unless your formatter is instructed to take screen text literally (as
MicroSCRIBE does in the 'verbatim' environment for example), tabs in
EMACS generally affect screen formatting only. 
.PP
When EMACS is first started, it sets the default tab to every eighth
column.  As long as you stay with default, every time you press the tab
key a tab character,
.B "^I"
is inserted.  This character, like other
control characters, is invisible -- but it makes a subtle and
significant difference to your file and editing. 
.PP
For example, in default mode, press the tab key and then type the word
.B "Test."
"Test" appears at the eighth column.  Move your cursor to the
beginning of the word and delete the backward character.  The word
doesn't move back just one character, but flushes to the left margin. 
The reason for this behavior is easily explained.  In tab default, EMACS
inserts a 'real' tab character when you press the tab key.  This
character is inserted at the default position, but NO SPACES are
inserted between the tab character and the margin (or previous tab
character).  As you will recall, EMACS only recognizes characters (such
as spaces or letters) and thus when the tab character is removed, the
text beyond the tab is flushed back to the margin or previous tab mark.
.PP
This situation changes if you alter the default configuration.  The
default value may be changed by entering a numeric argument before
pressing the tab key.  As we saw earlier, pressing the
.B "META"
key and entering a number allows you to specify how EMACS performs a given
action.  In this case, let's specify an argument of 10 and hit the tab
key. 
.PP
Now hit the tab key again and type
.B "Test."
Notice the word now
appears at the tenth column.  Now move to the beginning of the word and
delete the backward character.	"Test" moves back by one character. 
.PP
EMACS behaves differently in these circumstances because the
.B "^I"
.I "handle-tab"
function deals
with tabbing in two distinct ways.  In default conditions, or if the
numeric argument of zero is used,
.I "handle-tab"
inserts a true tab
character.  If, however, a non-zero numeric argument is specified,
.I "handle-tab"
inserts the correct number of spaces needed to position
the cursor at the next specified tab position.  It does NOT insert the
single tab character and hence any editing functions should take account
of the number of spaces between tabbed columns. 
.PP
Many times you would like to take a line which has been created using
the tab character and change it to use just spaces.  The command
.B "^X-^D"
.I "detab-line"
changes any tabs from the
point to the end of the current line into the right number of spaces so
the line does not change.  This is very useful for times when the file
must be printed or transferred to a machine which does not understand
tabs. 
.PP
Also, the inverse command,
.B "^X-^E"
.I "entab-lines"
changes multiple spaces to tabs where possible.  This is a good way to
shrink the size of large documents, especially with data tables.  Both
of these commands can take a numeric argument which will be interpreted
as the number of lines to en/detab. 
.sb
.SH
Summary
.sf
.PP
This chapter introduced some of the formatting features of
EMACS. Text-wrap, paragraph reformatting, and tabs were discussed in
some detail.  The commands in the following table were covered in the
chapter. 
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
Add-Mode/WRAP;^X-M [WRAP];Add wrap mode to current buffer
.sp .5
Delete-Mode/WRAP;^X-^M [WRAP];Remove wrap mode from current buffer
.sp .5
Set-Fill-Column;^X-F;Set fill column to given numeric argument  
.sp .5
Fill-Paragraph;M-Q;Logically reformats the current paragraph
.sp .5
Case-Word-Upper;M-U;T{
Text from point to end of the current word is changed to uppercase
T}
.sp .5
Case-Word-Lower;M-L;T{
Text from point to end of the  current word is changed to lowercase
T}
.sp .5
Case-Word-Capitalize;M-C;T{
First word (or letter) after the point is capitalized
T}
.sp .5
Case-Region-Upper;^X-^U;The current region is uppercased
.sp .5
Case-Region-Lower;^X-^L;The current region is lowercased
.sp .5
Handle-Tab;^I;T{
Tab interval is set to the given numeric argument
T}
.sp .5
Entab-Line;^X-^E;T{
Changes multiple spaces to tabs characters where possible
T}
.sp .5
Detab-Line;^X-^D;T{
Changes tab characters to the appropriate number of spaces
T}
.TE
.KE
.sb
.sb
.bp
.SH
Keyboard Macros
.sf
.PP
In many applications, it may be necessary to repeat a series of
characters or commands frequently.  For example, a paper may require the
frequent repetition of a complex formula or a long name.  You may also
have a series of EMACS commands that you invoke frequently.  Keyboard
macros offer a convenient method of recording and repeating these
commands. 
.PP
Imagine, for example, you are writing a scholarly paper on
.I "Asplenium platyneuron,"
the spleenwort fern.  Even the dedicated botanist would
probably find it a task bordering on the agonizing to type
.I "Asplenium platyneuron"
frequently throughout the paper.  An
alternative method is 'record' the name in a keyboard macro.  Try it
yourself.
.PP
The command
.B "^X-("
.I "begin-macro"
starts recording the all the keystrokes and commands you input.  After you've
typed it, enter
.I "Asplenium platyneuron."
To stop recording, type
.B "^X-)"
.I "end-macro."
EMACS has stored all the
keystrokes between the two commands.  To repeat the name you've stored,
just enter
.B "^X-E"
.I "execute-macro,"
and the name "Asplenium platyneuron" appears.  You can repeat this action as
often as you want, and of course as with any EMACS command, you may
precede it with a numerical argument. 
.PP
Because EMACS records keystrokes, you may freely intermix commands and
text.  Unfortunately, you can only store one macro at a time.  Thus, if
you begin to record another macro, the previously defined macro is
lost. Be careful to ensure that you've finished with one macro before
defining another.  If you have a series of commands that you would like
to 'record' for future use, use the macro or procedure facilities
detailed in chapter <X>.
.SH
Summary
.sf
.SH
This chapter covered keyboard macros.  You learned how to
record keystrokes and how to repeat the stored sequence. 
.KS
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
Start-Macro;^X-(;Starts recording all keyboard input
.sp .5
End-Macro;^X-);Stops recording keystrokes for macro
.sp .5
Execute-Macro;^X-E;T{
Entire sequence of recorded keystrokes is replayed
T}
.TE
.KE
.sb
.sb
.bp
.SH
MicroEMACS Macros
.sf
.PP
Macros are programs that are used to customize the editor and to
perform complicated editing tasks.  They may be stored in files or
buffers and may be executed using an appropriate command, or bound to a
particular keystroke.  Portions of the standard start-up file are
implement via macros, as well as the example menu system.  The
.I "execute-macro-<n>"
commands cause the
macro, numbered from 1 to 40, to be executed.  The
.I "execute-file"
command allows you to execute a macro stored in a
disk file, and the
.I "execute-buffer"
command allows you to execute a macro stored in a buffer.  Macros are stored for
easy execution by executing files that contain the store-macro command. 
.PP
There are many different aspects to the macro language within
MicroEMACS.  Editor commands are the various commands that manipulate
text, buffers, windows, etc, within the editor.  Directives are commands
which control what lines get executed within a macro.  Also there are
various types of variables.  Environmental variables both control and
report on different aspects of the editor.  User variables hold string
values which may be changed and inspected.  Buffer variables allow text
to be placed into variables.  Interactive variable allow the program to
prompt the user for information.  Functions can be used to manipulate
all these variables. 
.SH
Variables
.sf
.PP
Variables in MicroEMACS can be used to return values within
expressions, as repeat counts to editing commands, or as text to be
inserted into buffers and messages.  The value of these variables is set
using the set
.B "^X-A"
command.  For example, to set the current fill
column to 64 characters, the following macro line would be used:
.IP
set $fillcol 64
.LP
or to have the contents of
.B "%name"
inserted at the point in the current buffer, the command to use would be:
.IP
insert-string %name
.sb
.SH
Environmental Variables
.sf
.PP
"What good is a quote if you can't change it?"
.PP
These variables are used to change different aspects of the way
the editor works.  Also they will return the current settings if used as
part of an expression.  All environmental variable names begin with a
dollar sign ($) and are in lower case.
.TS
tab(;);
l lw(4i).
$fillcol;Current fill column
.sp .5
$pagelen;Number of screen lines used currently
.sp .5
$curwidth;Number of columns used currently
.sp .5
$curcol;Current column of point in current buffer
.sp .5
$curline;Current line of point in current buffer
.sp .5
$flicker;T{
Flicker Flag set to TRUE if IBM CGA set to FALSE for most others
T}
.sp .5
$cbufname;Name of the current buffer
.sp .5
$cfname;File name of the current buffer
.sp .5
$sres;T{
Current screen resolution (CGA, MONO or EGA on the IBM-PC driver.
LOW, MEDIUM, HIGH or DENSE on the Atari ST1040, NORMAL on all others)
T}
.sp .5
$debug;T{
Flag to trigger macro debugging (try it... you'll like it!)
T}
.sp .5
$status;T{
return status of the success of the last command
(TRUE or FALSE) usually used with !force
T}
.sp .5
$palette;T{
string used to control the palette register settings on graphics versions.
The usually form consists of groups of three octal digits
setting the red, green, and blue levels.
T}
.sp .5
$asave;T{
The number of inserted characters between automatic file-saves in ASAVE mode.
T}
.sp .5
$acount;T{
The countdown of inserted characters until the next save-file.
T}
.sp .5
$lastkey;Last keyboard character typed
.sp .5
$curchar;Character currently at the point
.sp .5
$discmd;T{
Flag to disable the echoing of messages on the command line
T}
.sp .5
$version;T{
Contains the current MicroEMACS version number
T}
.sp .5
$progname;T{
Always contains the string "MicroEMACS" for standard MicroEMACS.
Could be something else if used as part of someone else's program
T}
.sp .5
$seed;integer seed of the random number generator
.sp .5
$disinp;T{
Flag to disable the echoing of characters during command line input
T}
.TE
.PP
Obviously, many more of these variables will be available in
future releases of MicroEMACS. (Yes, send a vote for your favorite new
environmental variables today).
.sb
.SH
User variables
.sf
.PP
User variables allow you, the user, to store strings and
manipulate them.  These strings can be pieces of text, numbers (in text
form), or the logical values
.B "TRUE"
and
.B "FALSE."
These variables
can be combined, tested, inserted into buffers, and otherwise used to
control the way your macros execute.  At the moment, up to 100 user
variables may be in use in one editing session.  All users variable
names must begin with a percent sign (%) and may contain any printing
characters.  Only the first 10 characters are significant (i.e
differences beyond the tenth character are ignored).  Most operators
will truncate strings to a length of 128 characters. 
.sb
.SH
Buffer Variables
.sf
.PP
Buffer variables are special in that they can only be queried
and cannot be set.  What buffer variables are is a way to take text from
a buffer and place it in a variable. For example, if I have a buffer by
the name of RIGEL2, and it contains the text:
.KS
.TS
tab(;);
l l
l l
l l
l l
l l
l s.
;Richmond
;Lafayette
<*>;Bloomington
;Indianapolis
;Gary
 =* MicroEMACS 3.8i (WRAP) == rigel2 == File: /data/rigel2.txt =====
.TE
.KE
.FS
where <*> is the current point
.FE
and within a command I reference #rigel2, like:
.IP
insert-string #rigel2
.PP
MicroEMACS would start at the current point in the RIGEL2
buffer and grab all the text up to the end of that line and pass that
back.  Then it would advance the point to the beginning of the next line.
Thus, after our last command executes, the string "Bloomington" gets
inserted into the current buffer, and the buffer RIGEL2 now looks like
this:
.KS
.TS
tab(;);
l l
l l
l l
l l
l l
l s.
;Richmond
;Lafayette
;Bloomington
<*>;Indianapolis
;Gary
 =* MicroEMACS 3.8i (WRAP) == rigel2 == File: /data/rigel2.txt =====
.TE
.KE
as you have probably noticed, a buffer variable consists of the
buffer name, preceded by a pound sign (#).
.sb
.SH
Interactive variables
.sf
.PP
Interactive variables are actually a method to prompt the user
for a string.  This is done by using an at sign (@) followed either with
a quoted string, or a variable containing a string.  The string is the
placed on the bottom line, and the editor waits for the user to type in
a string.  Then the string typed in by the users is returned as the
value of the interactive variable.  For example:
.IP
set %quest "What file? "
.br
find-file @%quest
.LP
will ask the user for a file name, and then attempt to find it.
.sb
.sb
.SH
Functions
.sf
.PP
Functions can be used to manipulate variables in various ways. 
Functions can have one, two, or three arguments.  These arguments will
always be placed after the function on the current command line.  For
example, if we wanted to increase the current fill column by two, using
emacs's set
.B "^X-A"
command, we would write:
.KS
.TS
tab(;);
l l l l l l
c c c c c l.
set;$fillcol;&add;$fillcol;2;
;;;;\(ua;second operand
;;;\(ua;;first operand
;;\(ua;;;function to execute
;\(ua;;;;variable to set
\(ua;;;;;set (^X-A) command
.TE
.KE
.PP
Function names always begin with the ampersand (&) character,
and are only significant to the first three characters after the
ampersand.  Functions will normal expect one of three types of
arguments, and will automatically convert types when needed.
.KS
.TS
tab(;);
l lw(4i).
<num>;T{
an ascii string of digits which is interpreted as a numeric value. 
Any string which does not start with a digit or a minus sign (-) will be
considered zero. 
T}
.sp .5
<str>;T{
An arbitrary string of characters.  At the moment, strings are
limited to 128 characters in length. 
T}
.sp .5
<log>;T{
A logical value consisting of the string "TRUE" or "FALSE". 
Numeric strings will also evaluate to "FALSE" if they are equal to zero,
and "TRUE" if they are non-zero.  Arbitrary text strings will have the
value of "FALSE".
T}
.TE
.KE
A list of the currently available functions follows: (Once
again, send in those votes on what kind of functions you would like to
see added!) Functions are always used in lower case, the uppercase
letters in the function table are the short form of the function (i.e
&div for &divide).
.KS
.TS
tab(;);
l s l
l l lw(3i).
Numeric Functions:;(returns <num>)
_
&ADD;<num> <num>;Add two numbers
.sp .5
&SUB;<num> <num>;T{
Subtract the second number from the first
T}
.sp .5
&TIMes;<num> <num>;Multiply two numbers
.sp .5
&DIVide;<num> <num>;T{
Divide the first number by the second giving an integer result
T}
.sp .5
&MOD;<num> <num>;T{
Return the reminder of dividing the first number by the second
T}
.sp .5
&NEGate;<num>;Multiply the arg by -1
.sp .5
&LENgth;<str>;Returns length of string
.sp .5
&ASCii;<str>;T{
Return the ascii code of the first character in <str>
T}
.sp .5
&RND;<num>;T{
Returns a random integer between 1 and <num>
T}
.sp .5
&ABS;<num>;T{
Returns the absolute value of <num>
T}
.TE
.KE
.KS
.TS
tab(;);
l s l
l l lw(3i).
String manipulation functions:;(returns <str>)
_
&CAT;<str> <str>;Concatenate the two strings to form one
.sp .5
&LEFt;<str> <num>;T{
return the <num> leftmost characters from <str>
T}
.sp .5
&RIGht;<str> <num>;T{
return the <num> rightmost characters from <str>
T}
.sp .5
&MID;<str> <num1> <num2>;T{
Starting from <num1> position in <str>, return <num2> characters.
T}
.sp .5
&UPPer;<str>;Uppercase <str>
.sp .5
&LOWer;<str>;lowercase <str>
.sp .5
&CHR;<num>;T{
return a string with the character represented by ascii code <num>
T}
.sp .5
&GTK;;T{
return a string containing a single keystroke from the user
T}
.TE
.KE
.KS
.TS
tab(;);
l s l
l l lw(3i).
Logical Testing functions:;(returns <log>)
_
&NOT;<log>;Return the opposite logical value
.sp .5
&AND;<log1> <log2>;T{
Returns TRUE if BOTH logical arguments are TRUE
T}
.sp .5
&OR;<log1> <log2>;T{
Returns TRUE if either argument is TRUE
T}
.sp .5
&EQUal;<num> <num>;T{
If <num> and <num> are numerically equal, return TRUE
T}
.sp .5
&LESs;<num1> <num2>;T{
If <num1> is less than <num2>, return TRUE.
T}
.sp .5
&GREater;<num1> <num2>;T{
If <num1> is greater than, or equal to <num2>, return TRUE.
T}
.sp .5
&SEQual;<str1> <str2>;T{
If the two strings are the same, return TRUE.
T}
.sp .5
&SLEss;<str1> <str2>;T{
If <str1> is less alphabetically than <str2>, return TRUE.
T}
.sp .5
&SGReater;<str1> <str2>;T{
If <str1> is alphabetically greater than or equal to <str2>, return TRUE.
T}
.TE
.KE
.KS
.TS
tab(;);
l s l
l l lw(3i).
Special Functions:;;
_
&INDirect;<str>;Evaluate <str> as a variable.
.TE
.KE
.PP
This last function deserves more explanation. The &IND function
evaluates its argument, takes the resulting string, and then uses it as
a variable name.  For example, given the following code sequence:
.IP
; set up reference table
.sp
set %one	"elephant"
.br
set %two	"giraffe"
.br
set %thee	"donkey"
.sp
set %index "two"
.br
insert-string &ind %index
.LP
the string "giraffe" would have been inserted at the point in
the current buffer.  This indirection can be safely nested up to about
10 levels.
.sb
.SH
Directives
.sf
.PP
Directives are commands which only operate within an executing
macro, i.e they do not make sense as a single command. As such, they
cannot be called up singly or bound to keystroke. Used within macros,
they control what lines are executed and in what order.
.PP
Directives always start with the exclamation mark (!) character
and must be the first thing placed on a line. Directives executed singly
(via the execute-command-line command) interactively will be ignored.
.SH
!ENDM Directive
.sf
.PP
This directive is used to terminate a macro being stored. For
example, if a file is being executed contains the text:
.KS
.TS
tab(%);
l s
l l
l l
l l
l l
l s.
;  Read in a file in view mode, and make the window red
.sp
26%store-macro
%find-file @"File to view: "
%add-mode "view"
%add-mode "red"
!endm
.sp
write-message "[Consult macro has been loaded]"
.TE
.KE
only the lines between the store-macro command and the !ENDM
directive are stored in macro 26.
.sb
.SH
!FORCE Directive
.sf
.PP
When MicroEMACS executes a macro, if any command fails, the
macro is terminated at that point. If a line is preceded by a !FORCE
directive, execution continues weather the command succeeds or not. For
example:
.KS
.TS
tab(%);
l s
l l.
; Merge the top two windows
.sp
save-window%;remember what window we are at
1 next-window%;go to the top window
delete-window%;merge it with the second window
!force restore-window%;This will continue regardless
add-mode "red"%
.TE
.KE
.sb
.SH
!IF, !ELSE, and !ENDIF Directives
.sf
.PP
This directive allows statements only to be executed if a
condition specified in the directive is met.  Every line following the
!IF directive, until the first !ELSE or !ENDIF directive, is only
executed if the expression following the !IF directive evaluates to a
TRUE value.  For example, the following macro segment creates the
portion of a text file automatically.  (yes believe me, this will be
easier to understand then that last explanation....)
.KS
.IP
!if &sequal %curplace "timespace vortex"
.ti +4
insert-string "First, rematerialize~n"
.br
!endif
.br
!if &sequal %planet "earth"	;If we have landed on earth...
.ti +4
!if &sequal %time "late 20th century"  ;and we are then
.ti +8
write-message "Contact U.N.I.T."
.ti +4
!else
.ti +8
insert-string "Investigate the situation....~n"
.ti +8
insert-string "(SAY 'stay here Sara')~n"
.ti +4
!endif
.br
!else
.ti +4
set %conditions @"Atmosphere conditions outside? "
.ti +4
!if &sequal %conditions "safe"
.ti +8
insert-string &cat "Go outside......" "~n"
.ti +8
insert-string "lock the door~n"
.ti +4
!else
.ti +8
insert-string "Dematerialize..try somewhere else"
.ti +8
newline
.ti +4
!endif
.br
!endif
.KE
.sb
.SH
!GOTO Directive
.sf
.PP
Flow can be controlled within a MicroEMACS macro using the !GOTO
directive. It takes as an argument a label. A label consists of a line
starting with an asterisk (*) and then an alphanumeric label.  Only
labels in the currently executing macro can be jumped to, and trying to
jump to a non-existing label terminates execution of a macro.  For
example..
.KS
.IP
;Create a block of DATA statements for a BASIC program
.sp
.ti +4
insert-string "1000 DATA "
.ti +4
set %linenum 1000
.sp
*nxtin
.ti +4
update-screen		;make sure we see the changes
.ti +4
set %data @"Next number: "
.ti +4
!if &equal %data 0
.ti +8
!goto finish
.ti +4
!endif
.sp
.ti +4
!if &greater $curcol 60
.ti +8
2 delete-previous-character
.ti +8
newline
.ti +8
set %linenum &add %linenum 10
.ti +8
insert-string &cat %linenum " DATA "
.ti +4
!endif
.sp
.ti +4
insert-string &cat %data ", "
.ti +4
!goto nxtin
.sp
*finish
.sp
.ti +4
2 delete-previous-character
.ti +4
newline
.KE
.sb
.SH
!RETURN Directive
.sf
.PP
The !RETURN Directive causes the current macro to exit, either
returning to the caller (if any) or to interactive mode.  For example:
.KS
.IP
; Check the monitor type and set %mtyp
.sp
!if &sres "CGA"
.ti +4
set %mtyp 1
.ti +4
!return
.br
!else
.ti +4
set %mtyp 2
.br
!endif
.sp
insert-string "You are on a MONOCHROME machine!~n"
.KE
.sb
.sb
.sb
.bp
.SH
MicroEMACS commands
.sf
.PP
Below is a complete list of the commands in EMACS, the keys
normally used to do the command, and what the command does.  Remember,
on some computers there may also be additional ways of using a command
(cursor keys and special function keys for example). 
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
abort-command;^G;T{
This allows the user to abort out of any command that is waiting for input
T}
.sp .5
add-mode;^X-M;Add a mode to the current buffer
.sp .5
add-global-mode;M-M;Add a global mode for all new buffers
.sp .5
apropos;M-A;T{
List out commands whose name contains the string specified
T}
.sp .5
backward-character;^B;Move one character to the left
.sp .5
begin-macro;^X-(;Begin recording a keyboard macro
.sp .5
beginning-of-file;M-<;T{
Move to the beginning of the file in the current buffer
T}
.sp .5
beginning-of-line;^A;Move to the beginning of the current line
.sp .5
bind-to-key;M-K;Bind a key to a function
.sp .5
buffer-position;^X-=;T{
List the position of the cursor in the current window on the command line
T}
.sp .5
case-region-lower;^X-^L;Make a marked region all lower case
.sp .5
case-region-upper;^X-^U;Make a marked region all upper case
.sp .5
case-word-capitalize;M-C;Capitalize the following word
.sp .5
case-word-lower;M-L;Lower case the following word
.sp .5
case-word-upper;M-U;Upper case the following word
.sp .5
change-file-name;^X-N;T{
Change the name of the file in the current buffer
T}
.sp .5
change-screen-size;M-^S;T{
Change the number of lines of the screen currently being used
T}
.sp .5
change-screen-width;M-^T;T{
Change the number of columns of the screen currently being used
T}
.sp .5
clear-and-redraw;^L;Clear the physical screen and redraw it
.sp .5
clear-message-line;(none);Clear the command line
.sp .5
copy-region;M-W;T{
Copy the currently marked region into the kill buffer
T}
.sp .5
count-words;M-^C;T{
Count how many words, lines and characters are in the current marked region
T}
.sp .5
ctlx-prefix;^X;Change the key used as the ^X prefix
.sp .5
delete-blank-lines;^X-^O;Delete all blank lines around the cursor
.sp .5
delete-buffer;^X-K;T{
Delete a buffer which is not being currently displayed in a window
T}
.TE
.bp
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
delete-mode;^X-^M;Turn off a mode in the current buffer
.sp .5
delete-global-mode;M-^M;Turn off a global mode
.sp .5
delete-next-character;^D;Delete the character following the cursor
.sp .5
delete-next-word;M-D;Delete the word following the cursor
.sp .5
delete-other-windows;^X-1;T{
Make the current window cover the entire screen
T}
.sp .5
delete-previous-character;^H;T{
Delete the character to the left of the cursor
T}
.sp .5
delete-previous-word;M-^H;Delete the word to the left of the cursor
.sp .5
delete-window;^X-0;Remove the current window from the screen
.sp .5
describe-bindings;(none);Make a list of all legal commands
.sp .5
describe-key;^X-?;T{
Describe what command is bound to a keystroke sequence
T}
.sp .5
detab-line;^X-^D;T{
Change all tabs in a line to the equivalent spaces
T}
.sp .5
end-macro;^X-);stop recording a keyboard macro
.sp .5
end-of-file;M->;Move cursor to the end of the current buffer
.sp .5
end-of-line;^E;Move to the end of the current line
.sp .5
entab-line;^X-^E;T{
Change multiple spaces to tabs where possible
T}
.sp .5
exchange-point-and-mark;^X-^X;T{
Move cursor to the last marked spot, make the original position be marked
T}
.sp .5
execute-buffer;(none);Execute a buffer as a macro
.sp .5
execute-command-line;(none);T{
Execute a line typed on the command line as a macro command
T}
.sp .5
execute-file;FNB;Execute a file as a macro
.sp .5
execute-macro;^X-E;T{
Execute the keyboard macro (play back the recorded keystrokes)
T}
.sp .5
execute-macro-<n>;(none);T{
Execute numbered macro <N> where <N> is an integer from 1 to 40
T}
.sp .5
execute-named-command;M-X;Execute a command by name
.sp .5
execute-procedure;M-^E;Execute a procedure by name
.sp .5
exit-emacs;^X-^C;T{
Exit EMACS. If there are unwritten, changed buffers EMACS will ask to confirm
T}
.sp .5
fill-paragraph;M-Q;Fill the current paragraph
.sp .5
filter-buffer;^X-#;T{
Filter the current buffer through an external filter
T}
.sp .5
find-file;^X-^F;Find a file to edit in the current window
.sp .5
forward-character;^F;Move cursor one character to the right
.sp .5
goto-line;M-G;Goto a numbered line
.sp .5
goto-matching-fence;M-^F;Goto the matching fence
.TE
.bp
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
grow-window;^X-^;Make the current window larger
.sp .5
handle-tab;^I;Insert a tab or set tab stops
.sp .5
hunt-forward;FN=;T{
Hunt for the next match of the last search string
T}
.sp .5
hunt-backward;FN>;T{
Hunt for the last match of the last search string
T}
.sp .5
help;M-?;Read EMACS.HLP into a buffer and display it
.sp .5
i-shell;^X-C;Shell up to a new command processor
.sp .5
incremental-search;^X-S;Search for a string, incrementally
.sp .5
insert-file;^X-^I;T{
insert a file at the cursor in the current file
T}
.sp .5
insert-space;^C;Insert a space to the right of the cursor
.sp .5
insert-string;(none);Insert a string at the cursor
.sp .5
kill-paragraph;M-^W;Delete the current paragraph
.sp .5
kill-region;^W;T{
Delete the current marked region, moving it to the kill buffer
T}
.sp .5
kill-to-end-of-line;^K;Delete the rest of the current line
.sp .5
list-buffers;^X-^B;List all existing buffers
.sp .5
meta-prefix;<ESC>;Key used to precede all META commands
.sp .5
move-window-down;^X-^N;TMove all the lines in the current window down
.sp .5
move-window-up;^X-^P;Move all the lines in the current window up
.sp .5
name-buffer;M-^N;Change the name of the current buffer
.sp .5
newline;^M;Insert a <NL> at the cursor
.sp .5
newline-and-indent;^J;T{
Insert a <NL> at the cursor and indent
the new line the same as the preceding line
T}
.sp .5
next-buffer;^X-X;T{
Bring the next buffer in the list into the current window
T}
.sp .5
next-line;^N;Move the cursor down one line
.sp .5
next-page;^V;Move the cursor down one page
.sp .5
next-paragraph;M-N;Move cursor to the next paragraph
.sp .5
next-window;^X-O;Move cursor to the next window
.sp .5
next-word;M-F;T{
Move cursor to the beginning of the next word
T}
.sp .5
open-line;^O;Open a line at the cursor
.sp .5
pipe-command;^X-@;T{
Execute an external command and place its output in a buffer
T}
.sp .5
previous-line;^P;Move cursor up one line
.sp .5
previous-page;^Z;Move cursor up one page
.sp .5
previous-paragraph;M-P;Move back one paragraph
.sp .5
previous-window;^X-P;Move the cursor to the last window
.TE
.bp
.TS
tab(;);
l l l
lfI lfB lw(3i).
Key Binding;Keystroke;Effect
_
previous-word;M-B;T{
Move the cursor to the beginning of the word to the left of the cursor
T}
.sp .5
query-replace-string;M-^R;T{
Replace all of one string with another
string, interactively querying the user
T}
.sp .5
quick-exit;M-Z;Exit EMACS, writing out all changed buffers
.sp .5
quote-character;^Q;Insert the next character literally
.sp .5
read-file;^X-^R;Read a file into the current buffer
.sp .5
redraw-display;M-^L;T{
Redraw the display, centering the current line
T}
.sp .5
resize-window;^X-W;T{
Change the number of lines in the current window
T}
.sp .5
restore-window;(none);Move cursor to the last saved window
.sp .5
replace-string;M-R;T{
Replace all occurrences of one string
with another string from the cursor to the end of the buffer
T}
.sp .5
reverse-incremental-search;^X-R;Search backwards, incrementally
.sp .5
run;M-^E;Execute a named procedure
.sp .5
save-file;^X-^S;Save the current buffer if it is changed
.sp .5
save-window;(none);Remember current window (to restore later)
.sp .5
scroll-next-up;M-^Z;Scroll the next window up
.sp .5
scroll-next-down;M-^V;Scroll the next window down
.sp .5
search-forward;^S;Search for a string
.sp .5
search-reverse;^R;Search backwards for a string
.sp .5
select-buffer;^X-B;T{
Select a buffer to display in the current window
T}
.sp .5
set;^X-A;Set a variable to a value
.sp .5
set-encryption-key;M-E;Set the encryption key of the current buffer
.sp .5
set-fill-column;^X-F;Set the current fill column
.sp .5
set-mark;^X-.;Set the mark
.sp .5
shell-command;^X-!;Execute an external command
.sp .5
shrink-window;^X-^Z;Make the current window smaller
.sp .5
split-current-window;^X-2;Split the current window in two
.sp .5
store-macro;(none);T{
Store the following macro lines to a numbered macro
T}
.sp .5
store-procedure;(none);T{
Store the following macro lines to a named procedure
T}
.sp .5
transpose-characters;^T;T{
Transpose the character at the cursor with the character to the left
T}
.sp .5
trim-line;^X-^T;Trim any trailing whitespace from line
.sp .5
unbind-key;M-^K;Unbind a key from a function
.sp .5
universal-argument;^U;Execute the following command 4 times
.sp .5
unmark-buffer;M-~;T{
Unmark the current buffer (so it is no longer changed)
T}
.sp .5
update-screen;(none);Force a screen update during macro execution
.sp .5
view-file;^X-^V;Find a file,and put it in view mode
.sp .5
wrap-word;M-FNW;T{
Wrap the current word, this is an internal function
T}
.sp .5
write-file;^X-^W;T{
Write the current buffer under a new file name
T}
.sp .5
write-message;(none);Display a string on the command line
.sp .5
yank;^Y;T{
yank the kill buffer into the current buffer at the cursor
T}
.TE
.sb
.bp
.SH
MicroEMACS Bindings
.sf
.PP
Below is a complete list of the key bindings used in MicroEMACS.
This can be used as a wall chart reference for MicroEMACS commands.
.KS
.TS
tab(;);
c s s s
lfB l lfB l.
Default Key Bindings for MicroEmacs 3.8i
_
^A;Move to start of line;ESC A;Apropos (list some commands)
^B;Move backward by characters;ESC B;Backup by words
^C;Insert space;ESC C;Initial capitalize word
^D;Forward delete;ESC D;Delete forward word
^E;Goto end of line;ESC E;Reset Encryption Key
^F;Move forward by characters;ESC F;Advance by words
^G;Abort out of things;ESC G;Go to a line
^H;Backward delete		      
^I;Insert tab/Set tab stops
^J;Insert CR-LF, then indent 		    
^K;Kill forward;ESC K;Bind Key to function
^L;Refresh the screen;ESC L;Lower case word
^M;Insert CR-LF;ESC M;Add global mode
^N;Move forward by lines;ESC N;Goto End paragraph
^O;Open up a blank line	      
^P;Move backward by lines;ESC P;Goto Beginning of paragraph
^Q;Insert literal;ESC Q;Fill current paragraph
^R;Search backwards;ESC R;Search and replace
^S;Search forward
^T;Transpose characters		       
^U;Repeat command four times;ESC U;Upper case word
^V;Move forward by pages;ESC V;Move backward by pages
^W;Kill region;ESC W;Copy region to kill buffer
^Y;Yank back from killbuffer;ESC X;Execute named command
^Z;Move backward by pages;ESC Z;Save all buffers and exit
.sp
ESC ^C;Count words in region;ESC ~;Unmark current buffer
ESC ^F;Goto matching fence;ESC !;Reposition window
ESC ^H;Delete backward word;ESC <;Move to start of buffer
ESC ^K;Unbind Key from function;ESC >;Move to end of buffer
ESC ^L;Reposition window;ESC .;Set mark
ESC ^M;Delete global mode;ESC space;Set mark
ESC ^N;Rename current buffer;ESC rubout;Delete backward word
ESC ^R;Search & replace w/query;rubout;Backward delete
ESC ^S;Change screen rows
ESC ^T;Change screen columns
ESC ^V;Scroll next window down
ESC ^W;Delete Paragraph
ESC ^Z;Scroll next window up
.TE
.KE
.KS
.TS
tab(;);
c s s s
lfB l lfB l.
Default Key Bindings for MicroEmacs 3.8i
_
.sp
^X ?;Describe a key;^X !;Run 1 command in a subjob
^X =;Show the cursor position;^X @;Pipe DOS command to buffer
^X ^;Enlarge display window;^X #;Filter buffer thru DOS filter
^X 0;Delete current window;^X (;Begin macro
^X 1;Delete other windows;^X );End macro
^X 2;Split current window
;;^X A;Set variable value
^X ^B;Display buffer list;^X B;Switch a window to a buffer
^X ^C;Exit MicroEMACS;^X C;Start a new command processor
;;^X D;Suspend MicroEMACS (BSD4.2 only)
;;^X E;Execute macro
^X ^F;Find file;^X F;Set fill column
^X ^I;Insert file
;;^X K;Delete buffer
^X ^L;Lower case region
^X ^M;Delete Mode;^X M;Add a mode
^X ^N;Move window down;^X N;Rename current filename
^X ^O;Delete blank lines;^X O;Move to the next window
^X ^P;Move window up;^X P;Move to the previous window
^X ^R;Get a file from disk;^X R;Incremental reverse search
^X ^S;Save current file;^X S;Incremental forward search
^X ^U;Upper case region
^X ^V;View file
^X ^W;Write a file to disk;^X W;resize Window
^X ^X;Swap "." and mark;^X X;Use next buffer
^X ^Z;Shrink window;^X Z;Enlarge display window
.TE
.KE
.KS
.TS
tab (;);
l l.
Only under PCDOS:
.sp .5
<ALT>-S Hunt forward;SHIFT <F1> - <F10>
<ALT>-R Hunt backward;Execute macros 1 - 10
.TE
.KE
.KS
.TS
tab(;);
l s
l l.
Usable Modes
_
WRAP;Lines going past right margin "wrap" to a new line
VIEW;Read-Only mode where no modifications are allowed
CMODE;Change behavior of some commands to work with C better
EXACT;Exact case matching on search strings
OVER;Overwrite typed characters instead of inserting them
CRYPT;Current buffer will be encrypted on write, decrypted on read
MAGIC;Use regular expression matching in searches
ASAVE;Save the file every 256 inserted characters
.TE
.sp .5
.TS
tab(;);
l l.
WHITE/CYAN/MAGENTA/YELLOW/BLUE/RED/GREEN/BLACK;Sets foreground color
white/cyan/magenta/yellow/blue/red/green/black;Sets background color
.TE
.KE
.sb
.bp
.SH
Supported machines
.sf
.PP
The following table lists all the hardware/compilers for which I
currently support MicroEMACS.  This is not exclusive of all machines
which MicroEMACS will run on, but I have either run it myself, or had a
first hand report of it running.
.KS
.TS
tab(;);
l l l l.
Hardware;OS;Compiler;Comments
_
VAX 780;UNIX V5;native
;UNIX V7;native
;BSD 4.2;native;job control supported
;*VMS;native;only some terminals supported
.sp
NCR Tower;UNIX V5;native
.sp
Fortune 32:16;UNIX V7;native
.sp
IBM-PC;MSDOS 2/3.2;Lattice 2.15;Large CODE/Large DATA
;;AZTEC 3.4e;Small CODE/Large DATA
;;*MSC 4.0
;;*MWC 86
.sp
HP150;MSDOS;Lattice 2.15;T{
Function key labels for the touch screen
T}
.sp
HP110;MSDOS;Lattice 2.15
;;Aztec 3.4e
.sp
T{
*Data General 10
T};MSDOS;Lattice 2.15
.sp
T{
*Texas Instruments Professional
T};MSDOS;Lattice 2.15
.sp
Amiga;Intuition;Lattice 3.03;no mouse or menus yet
;;*Aztec 3
.sp
ST520;TOS;Lattice 3.10;T{
no menus yet, no shell commands
T}
+Macintosh;Finder 5.0;Aztec
.TE
.KE
.FS
* means that I do not own or have access to the listed compiler and/or
machine and must rely upon others to help support it.
.FE
.FS
+ Systems to be supported (i.e some code is already written:)
.FE
.sb
.bp
.SH
Machine Dependent Notes
.sf
.PP
This appendix lists some notes specific to individual
implementations of MicroEMACS. Every attempt has been made to allow
EMACS to be identical on all machines, but we have also tried to take
advantage of function keys, cursor keys, mice, and special screen modes
where possible.
.SH
IBM-PC/XT/AT and its clones
.sf
.PP
The IBM-PC family of computers is supported with a variety of
different display adapters.  EMACS will attempt to discover what adapter
is connected and use the proper driver for it.	Below is a list of the
currently supported video adapters:
.KS
.TS
tab(;);
l l l.
;Adapter;$sres;Original mode used
_
Monochrome Graphics Adapter;MONO;MONO
Color Graphics Adapter;CGA;CGA
Enhanced graphics Adapter;EGA;CGA
.TE
.KE
.PP
EMACS also takes advantage of various function keys and the keys
on the keypad on an IBM-PC.  The function keys are initially not bound
to any particular functions (except by the emacs.rc startup file), but
the keypad keys do default to the following:
.KS
.TS
tab(;);
l l.
Keypad key;Function
_
Home;beginning-of-file
CSRS UP;previous-line
Pg Up;previous-page
CSRS LEFT;backward-character
CSRS RIGHT;forward-character
End;end-of-file
CSRS DOWN;next-line
Pg Dn;Next-page
.TE
.KE
.PP
All these special keys are indicated in EMACS macros by use of the
.B "FN"
prefix.  Below is a list of many of the keys and the codes
used to specify them.  Also the codes may be gotten by using the
describe-key (^X ?) command on the suspect key.
.KS
.TS
tab(%);
l s s s s
l l l l l.
IBM PC function keys in MicroEmacs
.sp .5
%function%Function%^function%Alt-function
f1)%FN;%FNT%FN^%FNh
f2)%FN<%FNU%FN_%FNi
f3)%FN=%FNV%FN`%FNj
f4)%FN>%FNW%FNa%FNk
f5)%FN?%FNX%FNb%FNl
f6)%FN@%FNY%FNc%FNm
f7)%FNA%FNZ%FNd%FNn
f8)%FNB%FN[%FNe%FNo
f9)%FNC%FN\%FNf%FNp
f10)%FND%FN]%FNg%FNq
.sp
home)%FNG%%FNw
CuUp)%FNH
PgUp)%FNI%%FN {Alt 132}
CuLf)%FNK%%FNs
 5  )
CuRt)%FNM%%FNt
 End)%FNO%%FNu
CuDn)%FNP
PgDn)%FNQ%%FNv
 Ins)%FNR
 Del)%FNS
.TE
.KE
.sb
.bp
.SH
Atari 520/1040ST
.sf
.PP
The ATARI ST family of computers have a dual personality.  They
may use either a monochrome or a color screen.	EMACS supports two
screen resolutions on each monitor. 
.KS
.TS
tab(;);
l l l l l.
Monitor;$sres;size;#color;$palette format
_
Color;LOW;40x25;16;000111222333444555666777
;MEDIUM;80x25;4;000111222333
Mono;HIGH;80x25;2;000
;DENSE*;80x40;2;000
.TE
.KE
.FS
* DENSE mode is not yet supported in 3.8i.  It will be soon
.FE
.PP
The $palette environment variable can be used to change what
color is associated with each color name.  With a color monitor, each
group of three digits indicates an octal number specifying the RED,
GREEN and BLUE levels of that color.  Each color digit can vary from 0
to 7.  For example, the initial setting of $palette in LOW resolution is:
.IP
000700070770007707077777
.LP
which broken up is:
.IP
000 700 070 770 007 707 077 777
.LP
which means:
.KS
.TS
tab(;);
l l.
000;Black
700;Red
070;Green
770;Yellow
007;Blue
707;Magenta
077;Cyan
777;White
.TE
.KE
.PP
Also the mouse generates FN prefix codes when moved, or when one
of the two buttons is pressed.	Initially the movement of the mouse is
bound to movement of the cursor, and the left mouse button generates a
set-mark (M-space) command.  The cursor keys and the function keys are
bound similarly to IBM-PC.
.sb
.SH
Amiga 1000
.sf
.PP
The Commodore AMIGA 1000 version of MicroEMACS does not have
extensive support of the mouse or of pull down menus as of yet.  It does
however come up in a window, and it is possible to re-size it to run in
different sized windows.  The
.B "M-^S"
.I "change-screen-size"
takes its numeric argument as the new number
of lines for EMACS to use.  The
.B "M-^T"
.I "change-screen-width"
command allows you to change the number of
columns EMACS will use.  The defaults for these are 23 lines and 77
characters across for a full screen window.
.DS C
Note about Compiling MicroEMACS
.DE
.IP
.I
If you are compiling the sources on the AMIGA to produce an
executable image, and you are using the Lattice compiler, be sure to
give the CLI command 'STACK 40000' before compiling to make sure the
compiler has sufficient stack space to successfully complete
compilation.
.sb
.bp
.SH
UNIX V5, V7, and BSD4.[23]
.sf
.PP
MicroEMACS under UNIX utilizes the
.B "TERMCAP"
library to provide machine independent screen functions.  Make sure that
termcap is available and properly set on your account before attempting
to use MicroEMACS. 
.PP
Under systems which support job control, you can use the
.B "^X-D"
.I "suspend-emacs"
command to place EMACS
into the background.  This carries a much smaller overhead than bringing
up a new shell under EMACS.  EMACS will properly redraw the screen when
you bring it back to the foreground.
.PP
With the addition of some very machine/operating system specific
code, EMACS can prevent two or more people from modifying the same file
at the same time. The upper level of a set of
functions to provide file locking exist in the source file
.B "LOCK.C."
It requires two machine specific functions written and linked into EMACS
for it to operate properly. 
.IP
char *dolock(fname)
.sp
char *fname;
.sp
dolock() locks a file, preventing others from modifying it. If
it succeeds, it returns NULL, otherwise it returns a pointer to
a string in the form "LOCK ERROR: explanation".
.sp
char *undolock(fname)
.sp
char *fname;
.sp
undolock() unlocks a file, allowing others to modifying it. If
it succeeds, it returns NULL, otherwise it returns a pointer to
a string in the form "LOCK ERROR: explanation".
@\Rogue\Monster\
else
  echo "shar: Will not over write me.ms.2"
fi
echo "Finished archive 2 of 2"
# to concatenate archives, remove anything after this line
exit 0