[comp.emacs] emacs troff manual

larry@jc3b21.UUCP (Lawrence F. Strickland) (12/05/87)

# This is part 3 of 3.  See part 1 for instructions.

# This is a shell archive.  Remove anything before this line,
# then unpack it by saving it in a file and typing "sh file".
#
# Wrapped by larry on Fri Dec  4 18:38:39 EST 1987
# Contents:  emacstroff03
 
echo x - emacstroff03
sed 's/^@//' > "emacstroff03" <<'@//E*O*F emacstroff03//'
Richmond
Lafayette
<*>Bloomington	(where <*> is the current point)
Indianapolis
Gary
@.T&
l s.
=* MicroEMACS 3.9e (WRAP) == rigel2 == File: /data/rigel2.txt =====
@.TE
@.sp
and within a command I reference #rigel2, like:
@.sp
@.tl ''insert-string #rigel2''
@.P
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:
@.sp
@.TS
l l.
Richmond
Lafayette
Bloomington
<*>Indianapolis	(where <*> is the current point)
Gary
@.T&
l s.
=* MicroEMACS 3.9e (WRAP) == rigel2 == File: /data/rigel2.txt =====
@.TE
@.sp
as you have probably noticed, a buffer variable consists of the
buffer name, preceded by a pound sign (#).
@.sp
@.SS "Interactive variables"
@.P
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:
@.sp
@.in 1i
@.nf
set %quest "What file? "
find-file @%quest
@.fi
@.in -1i
@.sp
will ask the user for a file name, and then attempt to find it.
Note also that complex expressions can be built up with these
operators, such as:
@.sp
@.in 1i
\&&cat &cat "File to decode[" %default "]: "
@.sp
@.in -1i
which prompts the user with the concatenated string.
@.SH "Functions"
@.P
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 (^X-A) command, we would write:
@.sp
@.nf
@.in 1i
@.cs R 24
set $fillcol &add $fillcol 2
 \(ua     \(ua      \(ua     \(ua    \(ua____second operand
 |     |      |     |_________first operand
 |     |      |_______________function to execute
 |     |______________________variable to set
 |____________________________set (^X-A) command
@.cs R
@.in -1i
@.fi
@.P
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.
@.sp
@.SD \w'<num>\ \ \ \ \ 'u
@.ND
<num>	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. 
@.ND
<str>	An arbitrary string of characters.  At the moment, strings are
limited to 128 characters in length. 
@.ND
<log>	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". 
@.ED
@.P
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 (ie
\&&div for &divide).
@.sp
@.TS
center;
l s s
lw(1.2i) lw(1.2i) lw(3.4i).
Numeric Functions:  (returns <num>)
_
&ADD	<num> <num>	Add two numbers
&SUB	<num> <num>	Subtract the second number from the first
&TIMes	<num> <num>	Multiply two numbers
&DIVide	<num> <num>	Divide the first number by the second
		giving an integer result
&MOD	<num> <num>	Return the reminder of dividing the
		first number by the second
&NEGate	<neg>	Multiply the arg by -1
&LENgth	<str>	Returns length of string
&SINdex	<str1> <str2>	Finds the position of <str2> within
		<str1>. Returns zero if not found.
&ASCii	<str>	Return the ascii code of the first
		character in <str>
&RND	<num>	Returns a random integer between 1 and <num>
&ABS	<num>	Returns the absolute value of <num>
&BANd	<num> <num>	Bitwise AND function
&BOR	<num> <num>	Bitwise OR function
&BXOr	<num> <num>	Bitwise XOR function
&BNOt	<num>	Bitwise NOT function
@.TE
@.sp
@.TS
center;
l s s
lw(1.2i) lw(1.2i) lw(3.4i).
String manipulation functions:  (returns <str>)
_
&CAT	<str> <str>	Concatenate the two strings to form one
&LEFt	<str> <num>	return the <num> leftmost characters
		from <str>
&RIGht	<str> <num>	return the <num> rightmost characters
		from <str>
&MID	<str> <num1> <num2>
		Starting from <num1> position in <str>,
		return <num2> characters.
&UPPer	<str>	Uppercase <str>
&LOWer	<str>	lowercase <str>
&CHR	<num>	return a string with the character
		represented by ascii code <num>
&GTK		return a string containing a single
		keystroke from the user
&ENV	<str>	If the operating system is capable, this
		returns the environment string associated
		with <str>
&BIND	<str>	return the function name bound to the
		keystroke <str>
&ENV	<str>	Returns the operating system value
		attached to environmental variable <str>
&FINd	<str>	Find the named file <str> along the
		path and return its full file specification
		or an empty string if none exists
@.TE
@.sp
@.TS
center;
l s s
lw(1.2i) lw(1.2i) lw(3.4i).
Logical Testing functions:  (returns <log>)
_
&NOT	<log>	Return the opposite logical value
&AND	<log1> <log2>	Returns TRUE if BOTH logical arguments
		are TRUE
&OR	<log1> <log2>	Returns TRUE if either argument
		is TRUE
&EQUal	<num> <num>	If <num> and <num> are numerically
		equal, return TRUE
&LESs	<num1> <num2>	If <num1> is less than <num2>, return
		TRUE.
&GREater	<num1> <num2>	If <num1> is greater than, or equal to
		<num2>, return TRUE.
&SEQual	<str1> <str2>	If the two strings are the same, return
		TRUE.
&SLEss	<str1> <str2>	If <str1> is less alphabetically than
		<str2>, return TRUE.
&SGReater	<str1> <str2>	If <str1> is alphabetically greater than
		or equal to <str2>, return TRUE.
&FINd	<str>	Does the named file <str> exist?
@.TE
@.sp
@.TS
center;
l s s
lw(1.2i) lw(1.2i) lw(3.4i).
Special Functions:
_
&INDirect	<str>	Evaluate <str> as a variable.
@.TE
@.ta 1i 2i 3i 4i 5i
@.P
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:
@.sp
@.nf
	; set up reference table
@.sp
	set %one	"elephant"
	set %two	"giraffe"
	set %three	"donkey"
@.sp
	set %index "two"
	insert-string &ind %index
@.fi
@.sp
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.
@.SH "Directives"
@.P
Directives are commands which only operate within an executing
macro, ie 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.
@.P
Directives always start with the exclamation mark (!) character
and must be the first thing placed on a line.  Directives executed
interactively (via the execute-command-line command) will be ignored. 
@.SS "!ENDM Directive"
@.P
This directive is used to terminate a macro being stored. For
example, if a file is being executed contains the text:
@.sp
@.nf
	;	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]"
@.fi
@.sp
only the lines between the store-macro command and the !ENDM
directive are stored in macro 26.  Both numbered macroes and named
procedures (via the \fIstore-procedure\fP command) should be terminated with
this directive.
@.SS "!FORCE Directive"
@.P
When MicroEMACS executes a macro, if any command fails, the
macro is terminated at that point. If a line is preceeded by a !FORCE
directive, execution continues weather the command succeeds or not. For
example:
@.sp
@.nf
	;	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"
@.fi
@.SS "!IF, !ELSE, and !ENDIF Directives"
@.P
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....)
@.sp
@.nf
	!if &sequal %curplace "timespace vortex"
		insert-string "First, rematerialize~n"
	!endif
	!if &sequal %planet "earth"	;If we have landed on earth...
		!if &sequal %time "late 20th century"  ;and we are then
			write-message "Contact U.N.I.T."
		!else
			insert-string "Investigate the situation....~n"
			insert-string "(SAY 'stay here Sara')~n"
		!endif
	!else
		set %conditions @"Atmosphere conditions outside? "
		!if &sequal %conditions "safe"
			insert-string &cat "Go outside......" "~n"
			insert-string "lock the door~n"
		!else
			insert-string "Dematerialize..try somewhen else"
			newline
		!endif
	!endif
@.fi
@.SS "!GOTO Directive"
@.P
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..
@.sp
@.nf
	;Create a block of DATA statements for a BASIC program
@.sp
		insert-string "1000 DATA "
		set %linenum 1000
@.sp
	*nxtin
		update-screen		;make sure we see the changes
		set %data @"Next number: "
		!if &equal %data 0
			!goto finish
		!endif
@.sp
		!if &greater $curcol 60
			2 delete-previous-character
			newline
			set %linenum &add %linenum 10
			insert-string &cat %linenum " DATA "
		!endif
@.sp
		insert-string &cat %data ", "
		!goto nxtin
@.sp
	*finish
@.sp
		2 delete-previous-character
		newline
@.fi
@.SS "!WHILE and !ENDWHILE Directives"
@.P
This directive allows you to set up repetitive tasks easily and
efficiently. If a group of statements need to be executed while a
certain condition is true, enclose them with a while loop. For example,
@.sp
@.nf
	!while &less $curcol 70
		insert-string &cat &cat "[" #stuff "]"
	!endwhile
@.fi
@.sp
places items from buffer "item" in the current line until the
cursor is at or past column 70.  While loops may be nested and can
contain and be the targets of !GOTOs with no ill effects. Using a while
loop to enclose a repeated task will run much faster than the
corresponding construct using !IFs.
@.SS "!BREAK Directive"
@.P
This directive allows the user to abort out of the currently
most inner while loop, regardless of the condition.  It is often used
to abort processing for error conditions.  For example:
@.sp
@.nf
;	Read in files and substitute "begining" with "beginning"
@.sp
	set %filename #list
	!while &not &seq %filename "<end>"
!force		find-file %filename
		!if &seq $status FALSE
			write-message "[File read error]"
			!break
		!endif
		beginning-of-file
		replace-string "begining" "beginning"
		save-file
		set %filename #list
	!endwhile
@.fi
@.sp
This while loop will process files until the list is exhausted
or there is an error while reading a file.
@.SS "!RETURN Directive"
@.P
The !RETURN Directive causes the current macro to exit, either
returning to the caller (if any) or to interactive mode.  For example:
@.sp
@.nf
	;	Check the monitor type and set %mtyp
@.sp
	!if &sres "CGA"
		set %mtyp 1
		!return
	!else
		set %mtyp 2
	!endif
@.sp
	insert-string "You are on a MONOCHROME machine!~n"
@.fi
@.AH "Micro EMACS Command Line Switches" "and Startup Files"
@.P
When EMACS first executes, it always searches for a file,
called \fB.emacsrc\fP \fIunder most UNIX systems\fP or \fBemacs.rc\fP \fIon
most other systems\fP which it will
execute as EMACS macros before it reads in the named source files. This
file normally contains EMACS macroes to bind the function keys to
useful functions and load various useful macros.  The contents of this
file will probably vary from system to system and can be modified by the
user as desired.
@.P
When searching for this file, EMACS looks for it in this order. 
First, it attempts to find a definition for "\fBHOME\fP" in the
environment.  It will look in that directory first.  Then it searches
all the directories listed in the "\fBPATH\fP" environment variable.  Then
it looks through a list of predefined standard directories which vary
from system to system.  Finally, failing all of these, it looks in the
current directory.  This is also the same method EMACS uses to look up
any files to execute, and to find it's help file \fBEMACS.HLP\fP. 
@.P
On computers that call up EMACS via a command line process, such
as MSDOS and UNIX, there are different things that can be added to the
command line to control the way EMACS operates. These can be switches,
which are a dash ('-') followed by a letter, and possible other
parameters, or a startup file specifier, which is an at sign '@'
followed by a file name.
@.sp
@.SD \w'-S<string>\ \ \ \ \ 'u
@.ND
@@<file>	This causes the named file to be executed instead of the
standard emacs.rc file before emacs reads in any other files.  More than
one of these can be placed on the command line, and they will be
executed in the order that they appear. 
@.ND
-A	This flag causes emacs to automatically run the startup file
"error.cmd" instead of emacs.rc. This is used by various C compilers for
error processing (for example, Mark Williams C).
@.ND
-E	The following source files on the command line can be edited (as
opposed to being in VIEW mode). This is mainly used to cancel the
effects of the -v switch used previously in the same command line.
@.ND
-G<num>	Upon entering EMACS, position the cursor at the <num> line of
the first file.
@.ND
-K<key>	This key tells emacs to place the source files in CRYPT
mode and read it in using <key> as the encryption
key.  If no key is listed immediately after the -K switch, EMACS will
prompt for a key, and not echo it as it is typed. 
@.ND
-R	This places EMACS in "restricted mode"
where any commands allowing the user to read or write any
files other than the ones listed on the command line are disabled. Also
all commands allowing the user access to the operating system are
disabled. This makes EMACS very useful as a "safe" environment for use
within other applications and especially used as a remote editor for a
BBS or electronic bulletin board system.
@.ND
-S<string>	After EMACS is started, it automatically searches for
\&<string> in the first source file.
@.ND
-V	This tells EMACS that all the following sources files on the command
line should be in VIEW mode to prevent any changes being made to them.
@.ED
@.AH "MicroEMACS commands"
@.sp
	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). 
@.sp
@.TS
center;
lfB lfB lfB
l lfB l.
Command	Binding	Meaning
_
abort-command	 ^G	This allows the user to abort out of any
		command that is waiting for input
@.sp
add-mode	^X-M	Add a mode to the current buffer
@.sp
add-global-mode	M-M	Add a global mode for all new buffers
@.sp
apropos	M-A	List out commands whose name contains
		the string specified
@.sp
backward-character	^B	Move one character to the left
@.sp
begin-macro	^X-(	Begin recording a keyboard macro
@.sp
beginning-of-file	M-<	Move to the beginning of the file in
		the current buffer
@.sp
beginning-of-line	^A	Move to the beginning of the current line
@.sp
bind-to-key	M-K	Bind a key to a function
@.sp
buffer-position	^X-=	List the position of the cursor in the
		current window on the command line
@.sp
case-region-lower	^X-^L	Make a marked region all lower case
@.sp
case-region-upper	^X-^U	Make a marked region all upper case
@.sp
case-word-capitalize	M-C	Capitalize the following word
@.sp
case-word-lower	M-L	Lower case the following word
@.sp
case-word-upper	M-U	Upper case the following word
@.sp
change-file-name	^X-N	Change the name of the file in the
		current buffer
@.sp
change-screen-size	M-^S	Change the number of lines of the screen
		currently being used
@.sp
change-screen-width	M-^T	Change the number of columns of the
		screen currently being used
@.sp
clear-and-redraw	^L	Clear the physical screen and redraw it
@.sp
clear-message-line	(none)	Clear the command line
@.sp
copy-region	M-W	Copy the currently marked region into
		the kill buffer
@.sp
count-words	M-^C	Count how many words, lines and
		characters are in the current marked region
@.sp
ctlx-prefix	^X	Change the key used as the ^X prefix
@.sp
delete-blank-lines	^X-^O	Delete all blank lines around the cursor
@.sp
delete-buffer	^X-K	Delete a buffer which is not being
		currently displayed in a window
@.sp
delete-mode	^X-^M	Turn off a mode in the current buffer
@.sp
delete-global-mode	M-^M	Turn off a global mode
@.sp
delete-next-character	^D	Delete the character following the cursor
@.sp
delete-next-word	M-D	Delete the word following the cursor
@.sp
delete-other-windows	^X-1	Make the current window cover the entire
		screen
@.sp
delete-previous-character	^H	Delete the character to the left of the
		cursor
@.sp
delete-previous-word	M-^H	Delete the word to the left of the cursor
@.sp
delete-window	^X-0	Remove the current window from the screen
@.sp
describe-bindings	(none)	Make a list of all legal commands
@.sp
describe-key	^X-?	Describe what command is bound to a
		keystroke sequence
@.sp
detab-line	^X-^D	Change all tabs in a line to the
		equivalent spaces
@.sp
end-macro	^X-)	stop recording a keyboard macro
@.sp
end-of-file	M->	Move cursor to the end of the current buffer
@.sp
end-of-line	^E	Move to the end of the current line
@.sp
entab-line	^X-^E	Change multiple spaces to tabs where
		possible
@.sp
exchange-point-and-mark	^X-^X	Move cursor to the last marked spot,
		make the original position be marked
@.sp
execute-buffer	(none)	Execute a buffer as a macro
@.sp
execute-command-line	(none)	Execute a line typed on the command
		line as a macro command
@.sp
execute-file	FNB	Execute a file as a macro
@.sp
execute-macro	^X-E	Execute the keyboard macro (play back
		the recorded keystrokes)
execute-macro-<n>	(none)	Execute numbered macro <N> where <N> is
		an integer from 1 to 40
@.sp
execute-named-command	M-X	Execute a command by name
@.sp
execute-procedure	M-^E	Execute a procedure by name
@.sp
execute-program	^X-$	Execute a program directly (not through
		an intervening shell)
@.sp
exit-emacs	^X-^C	Exit EMACS. If there are unwritten,
		changed buffers EMACS will ask to confirm
@.sp
fill-paragraph	M-Q	Fill the current paragraph
@.sp
filter-buffer	^X-#	Filter the current buffer through an
		external filter
@.sp
find-file	^X-^F	Find a file to edit in the current window
@.sp
forward-character	^F	Move cursor one character to the right
@.sp
goto-line	M-G	Goto a numbered line
@.sp
goto-matching-fence	M-^F	Goto the matching fence
@.sp
grow-window	^X-^	Make the current window larger
@.sp
handle-tab	^I	Insert a tab or set tab stops
@.sp
hunt-forward	FN=	Hunt for the next match of the last
		search string
@.sp
hunt-backward	FN>	Hunt for the last match of the last
		search string
@.sp
help	M-?	Read EMACS.HLP into a buffer and display it
@.sp
i-shell	^X-C	Shell up to a new command processor
@.sp
incremental-search	^X-S	Search for a string, incrementally
@.sp
insert-file	^X-^I	insert a file at the cursor in the
		current file
@.sp
insert-space	^C	Insert a space to the right of the cursor
@.sp
insert-string	(none)	Insert a string at the cursor
@.sp
kill-paragraph	M-^W	Delete the current paragraph
@.sp
kill-region	^W	Delete the current marked region, moving
		it to the kill buffer
@.sp
kill-to-end-of-line	^K	Delete the rest of the current line
@.sp
list-buffers	^X-^B	List all existing buffers
@.sp
meta-prefix	<ESC>	Key used to precede all META commands
@.sp
move-window-down	^X-^N	Move all the lines in the current window down
@.sp
move-window-up	^X-^P	Move all the lines in the current window up
@.sp
name-buffer	M-^N	Change the name of the current buffer
@.sp
newline 	^M	Insert a <NL> at the cursor
@.sp
newline-and-indent	^J	Insert a <NL> at the cursor and indent
		the new line the same as the preceeding line
@.sp
next-buffer	^X-X	Bring the next buffer in the list into
		the current window
@.sp
next-line	^N	Move the cursor down one line
@.sp
next-page	^V	Move the cursor down one page
@.sp
next-paragraph	M-N	Move cursor to the next paragraph
@.sp
next-window	^X-O	Move cursor to the next window
@.sp
next-word	M-F	Move cursor to the beginning of the
		next word
@.sp
nop	M-FNC	Does nothing
@.sp
open-line	^O	Open a line at the cursor
@.sp
overwrite-string	(none)	Overwrite a string at the cursor
@.sp
pipe-command	^X-@	Execute an external command and place
		its output in a buffer
@.sp
previous-line	^P	Move cursor up one line
@.sp
previous-page	^Z	Move cursor up one page
@.sp
previous-paragraph	M-P	Move back one paragraph
@.sp
previous-window	^X-P	Move the cursor to the last window
@.sp
previous-word	M-B	Move the cursor to the beginning of the
		word to the left of the cursor
@.sp
query-replace-string	M-^R	Replace all of one string with another
		string, interactively querying the user
@.sp
quick-exit	M-Z	Exit EMACS, writing out all changed buffers
@.sp
quote-character	^Q	Insert the next character literally
@.sp
read-file	^X-^R	Read a file into the current buffer
@.sp
redraw-display	M-^L	Redraw the display, centering the
		current line
@.sp
resize-window	^X-W	Change the number of lines in the
		current window
@.sp
restore-window	(none)	Move cursor to the last saved window
@.sp
replace-string	M-R	Replace all occurrences of one string
		with another string from the cursor
		to the end of the buffer
@.sp
reverse-incremental-search	^X-R	Search backwards, incrementally
@.sp
run	M-^E	Execute a named procedure
@.sp
save-file	^X-^S	Save the current buffer if it is changed
@.sp
save-window	(none)	Remember current window (to restore later)
@.sp
scroll-next-up	M-^Z	Scroll the next window up
@.sp
scroll-next-down	M-^V	Scroll the next window down
@.sp
search-forward	^S	Search for a string
@.sp
search-reverse	^R	Search backwards for a string
@.sp
select-buffer	^X-B	Select a buffer to display in the
		current window
@.sp
set	^X-A	Set a variable to a value
@.sp
set-encryption-key	M-E	Set the encryption key of the current buffer
@.sp
set-fill-column	^X-F	Set the current fill column
@.sp
set-mark	M-<SPC>	Set the mark
@.sp
shell-command	^X-!	Causes an external shell to execute
		a command
@.sp
shrink-window	^X-^Z	Make the current window smaller
@.sp
split-current-window	^X-2	Split the current window in two
@.sp
store-macro	(none)	Store the following macro lines to a
		numbered macro
@.sp
store-procedure	(none)	Store the following macro lines to a
		named procedure
@.sp
transpose-characters	^T	Transpose the character at the cursor
		with the character to the left
@.sp
trim-line	^X-^T	Trim any trailing whitespace from line
@.sp
unbind-key	M-^K	Unbind a key from a function
@.sp
universal-argument	^U	Execute the following command 4 times
@.sp
unmark-buffer	M-~	Unmark the current buffer (so it is
		no longer changed)
@.sp
update-screen	(none)	Force a screen update during macro execution
@.sp
view-file	^X-^V	Find a file,and put it in view mode
@.sp
wrap-word	M-FNW	Wrap the current word, this is an
		internal function
@.sp
write-file	^X-^W	Write the current buffer under a new
		file name
@.sp
write-message	(none)	Display a string on the command line
@.sp
yank	^Y	yank the kill buffer into the current
		buffer at the cursor
@.TE
@.AH "MicroEMACS Bindings"
@.P
Below is a complete list of the key bindings used in MicroEMACS.
This can be used as a wall chart reference for MicroEMACS commands.
@.sp
@.TS
center expand;
cfB s s s
lfB l5 lfB l.
Default Key Bindings for MicroEMACS 3.9e
@.sp
^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 <NL>, then indent
^K	Kill forward	ESC K	Bind Key to function
^L	Refresh the screen	ESC L	Lower case word
^M	Insert <NL>	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 ^E	Execute named procedure
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 <SPC>	Set mark
ESC ^N	Rename current buffer	ESC <RUB>	Delete backward word
ESC ^R	Search & replace w/query	<RUB>	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
@.sp
^X ?	Describe a key	^X !	Run 1 command in a shell
^X =	Show the cursor position	^X @	Pipe shell command to buffer
^X ^	Enlarge display window	^X #	Filter buffer thru shell filter
^X 0	Delete current window	^X $	Execute an external program
^X 1	Delete other windows	^X (	Begin macro
^X 2	Split current window	^X )	End macro
		^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	Detab line	^X D	Suspend MicroEMACS (BSD4.2 only)
^X ^E	Entab line	^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 ^T	Trim line		(Incremental search
^X ^U	Upper case region		not always available)
^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
@.sp
@.TS
center expand;
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 better with C
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
@.TS
center expand;
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
@.AH "Supported machines"
@.P
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.
@.sp
@.TS
center expand;
lfB lfB lfB lfB
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	LATTICE 2.15	Large CODE/Large DATA
	2.0 & 3.2	AZTEC 3.4e	Small CODE/Large DATA
		TURBO C v1.00	LARGE memory model
		*MSC 4.0
		*MWC 86
	SCO XENIX	native
@.sp
HP150	MSDOS	Lattice 2.15	Function key labels
			for the touch screen
HP110	MSDOS	Lattice 2.15
		Aztec 3.4e
@.sp
*Data General 10	MSDOS	Lattice 2.15
@.sp
*TI Professional	MSDOS	Lattice 2.15
@.sp
Amiga	Intuition	Lattice 3.03	no mouse or menus yet
		*Aztec 3
@.sp
ST520	TOS	Mark Williams C	Spawns under MSH
		Lattice 3.10	(no shell commands)
@.sp
@.T&
l s s s
l l l l.
Systems to be supported (i.e. some code is already written):
Macintosh	Finder 5.0	Aztec
@.TE
@.sp
*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.
@.AH "Machine Dependent Notes"
@.P
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.
@.AS "IBM-PC/XT/AT and its clones"
@.P
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:
@.sp
@.TS
center expand;
lfB lfB lfB
l l l.
Adapter	$sres	Original mode used
_
Monochrome Graphics Adapter	MONO	MONO
Color Graphics Adapter	CGA	CGA
Enhanced Graphics Adapter	EGA	CGA
@.TE
@.P
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:
@.sp
@.TS
center;
lfB lfB
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
@.P
All these special keys are indicated in EMACS macroes by use of
the \fBFN\fP 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.
@.bp
@.sp 1i
@.TS
center;
cfB s s s s
lfB cfB cfB cfB cfB
l c c c c.
IBM PC function keys in MicroEMACS
@.sp
	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
CsUp)	FNH
PgUp)	FNI		FNa(umlaut)	{Alt 132}
CsLf)	FNK		FNs
5)
CsRt)	FNM		FNt
End)	FNO		FNu
CsDn)	FNP
PgDn)	FNQ		FNv
Ins)	FNR
Del)	FNS
@.TE
@.AS "HP 150"
@.P
This machine from Hewlett Packard is very unusual for an MSDOS
machine.  It has a touch screen and is very function key oriented.  An
additional command, \fIlabel-function-key\fP
allows you to place labels on the on screen function key labels.  A
numeric argument indicates which function key to label (one through
eight) and then the program prompts for a 16 character label, which will
be used as two lines of eight characters.  To label function key three
with "save file" from a macro, you would use:
@.sp
@.nf
	3 label-function-key "save    file"
@.fi
@.sp
Notice the 4 spaces after "save".  This forces "file" to begin on
the second line of the label.
@.AS "Atari 520/1040ST"
@.P
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.
@.sp
@.TS
center expand;
lfB lfB lfB lfB lfB
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	80x50	2	000
@.TE
@.sp
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:
@.ta 9n 17n 25n 33n 41n 49n
@.sp
@.nf
	000700070770007707077777
@.fi
@.sp
which broken up is:
@.sp
@.nf
	000 700 070 770 007 707 077 777
@.fi
@.sp
which means:
@.sp
@.TS
center;
l l.
000	Black
700	Red
070	Green
770	Yellow
007	Blue
707	Magenta
077	Cyan
777	White
@.TE
@.P
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 to IBM-PC.
@.P
Files generated by EMACS on the ATARI ST have a single return
character at the end of each line, unlike the desktop files which want
to have two returns. This makes it display files strangely from GEM's
\&[SHOW] option, but makes the files port to other computers much nicer.
@.P
Currently, when operating under the Mark Williams MSH program,
EMACS can shell out and perform external commands. This capability will
be added later for the Beckmeyer shell and under GEMDOS.
@.AS "Amiga 1000"
@.P
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 \fBM-^S\fP \fIchange-screen-size\fP
takes its numeric argument as the new number
of lines for EMACS to use.  The \fBM-^T\fP \fIchange-screen-width\fP
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.
@.sp
@.tl ''\fINote about Compiling MicroEMACS\fP''
@.sp
@.QS
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.
@.QE
@.AS "UNIX V5, V7, and BSD4.[23]"
@.P
MicroEMACS under UNIX utilizes the \fBTERMCAP\fP
library to provide machine independent screen functions.  Make sure that
your TERM variable is properly set on your account before attempting
to use MicroEMACS.
@.P
Under systems which support job control, you can use the
\fB^X-D\fP \fIsuspend-emacs\fP 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.
@.P
If the symbol VT100 has been set to 1 in the \fIestruct.h\fP
options file, EMACS will recognize the key sequence <ESC>[ as the lead
in sequence for the FN function key prefix.
@.P
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 \fBLOCK.C\fP.
It requires two machine specific functions written and linked into EMACS
for it to operate properly.
@.sp
@.in 1i
@.nf
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".
@.fi
@.in -1i
@.AH "Mode Flags"
@.P
The two environment variables, $cmode and $gmode, contain a
number the corresponds to the modes set for the current buffer and
the editor as a whole.  These are encoded as the sum of the following
numbers for each of the possible modes:
@.sp
@.TS
center expand;
l r l.
WRAP	1	Word wrap
CMODE	2	C indentation and fence match
SPELL	4	Interactive spell checking (Not Implemented Yet)
EXACT	8	Exact matching for searches
VIEW	16	Read-only buffer
OVER	32	Overwrite mode
MAGIC	64	Regular expressions in search
CRYPT	128	Encryption mode active
ASAVE	256	Auto-save mode
@.TE
@.P
So, if you wished to set the current buffer to have CMODE,
EXACT, and MAGIC on, and all the others off, you would add up the values
for those three, CMODE 2  +  EXACT 8  +  MAGIC 64 = 74, and use a
statement like:
@.sp
	set $cmode 74
@.sp
or, use the binary or operator to combine the different modes:
@.sp
	set $cmode &bor &bor 2 8 64
@.sp
@.BG "Internal Flags"
@.P
Some of the ways EMACS controls its internal functions can be
modified by the value in the $gflags environment variable.  Each bit in
this variable will be used to control a different function.
@.sp
@.TS
center expand;
l r l.
GFFLAG	1	If this bit is set to zero, EMACS will not
		automatically switch to the buffer of the
		first file after executing the startup macros.
@.TE
@//E*O*F emacstroff03//
chmod u=rw,g=r,o=r emacstroff03
 
echo Inspecting for damage in transit...
temp=/tmp/shar$$; dtemp=/tmp/.shar$$
trap "rm -f $temp $dtemp; exit" 0 1 2 3 15
cat > $temp <<\!!!
   1203   6315  37253 emacstroff03
!!!
wc  emacstroff03 | sed 's=[^ ]*/==' | diff -b $temp - >$dtemp
if [ -s $dtemp ]
then echo "Ouch [diff of wc output]:" ; cat $dtemp
else echo "No problems found."
fi
exit 0
-- 
+--------------------------------------+-- St. Petersburg Junior College --+
|        Lawrence F. Strickland        |   P.O. Box 13489                  |
| ...gatech!codas!usfvax2!jc3b21!larry |   St. Petersburg, FL 33733        |
+-(or) ...gatech!usfvax2!jc3b21!larry -+-- Phone: +1 813 341 4705 ---------+