Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!mnetor!uunet!husc6!necntc!ncoast!allbery
From: nwd@j.cc.purdue.edu (Daniel Lawrence)
Newsgroups: comp.sources.misc
Subject: MicroEmacs 3.9 Documentation (4 of 4)
Message-ID: <5706@ncoast.UUCP>
Date: Wed, 18-Nov-87 19:18:29 EST
Article-I.D.: ncoast.5706
Posted: Wed Nov 18 19:18:29 1987
Date-Received: Sat, 21-Nov-87 11:58:28 EST
Sender: allbery@ncoast.UUCP
Lines: 888
Approved: allbery@ncoast.UUCP
X-Archive: comp.sources.misc/uemacs-3.9-doc/4


# This is a shar archive.
# Remove everything above this line.
# Run the file through sh, not csh.
# (type `sh med.4')
# If you do not see the message
#	`med.4 completed!'
# then the file was incomplete.
echo extracting - readme
sed 's/^X//' > readme << 'FRIDAY_NIGHT'
X		MicroEMACS 3.9 Release Notes	July 22, 1987
X
X**********************************************************************
X
X	(C)opyright 1987 by Daniel M. Lawrence
X	MicroEMACS 3.9 can be copied and distributed freely for any
X	non-commercial purposes. MicroEMACS 3.9 can only be incorporated
X	into commercial software with the permission of the current author.
X
X**********************************************************************
X
X	MicroEMACS 3.9 is availible in a couple of different ways. 
XFirst, it is availible via my bulletin board system..... 
X
X	The Programmer's Room
X	FIDO 201/2
X	(317) 742-5533
X	24 hours  300/1200 baud
X
X	Also it should be online on the following BBS's:
X
X	The Starship Trooper	Fido 201/1	(317) 423-2281	2400
X
X	[These following two are open from 10pm till 5pm
X				and only while Purdue is in session]
X	The NightStaff		Fido 201/4	(317) 495-4270	1200
X	The Access Violation	Fido 201/5	(317) 495-4270	9600
X
X	There it is arranged as three MSDOS .ARC files, EMACSDOC.ARC
Xwhich contains the documentation and command files, EMACSSRC.ARC which
Xcontains the sources and the UNIX Makefile, and EMACSEXE.EXE which
Xcontains the MSDOS executables.  Also all the various executables are
Xavailable individually.
X
XEMACSDOC.ARC includes the files:
X
X	README		This file
X	
X	(These four files should be in your path for the standard setup)
X	EMACS.RC	Standard startup file
X	NEWPAGE.CMD	Shifted Function key Pager
X	PPAGE.CMD	Programming page
X	WPAGE.CMD	Word processing page
X	BPAGE.CMD	Block and box manipulation page
X
X	ME110.RC	HP110 startup file
X	ME150.RC	HP150 startup file
X	AMIGA.RC	AMIGA ".emacsrc" startup file
X	ST520.RC	ATARI ST startup file
X
X	EMACS.HLP	Online help file
X	EMACS.MSS	MicroSCRIBE format of EMACS.TXT
X	EMACS.TXT       EMACS BEGINNER'S/REFERENCE MANUAL
X
X	AZMAP.CMD	Translate AZTEC .SYM files to .MAP
X	BDATA.CMD	BASIC Data statement builder
X	FINDCOM.CMD	Find mismatched C comments
X	FUNC.CMD	Allow function keys on systems with non (like UNIX)
X	MENU.CMD	Sample Menu system
X	MENU1		   datafile for menu system
X	SHELL.CMD	Sample interactive MSDOS shell
X	TRAND.CMD	Generate random numbers and do statistics on them
X
XEMACSSRC.ARC includes the files:
X
X	ALINE.H		Atari ST graphic header file
X	ANSI.C		ANSI screen driver
X	BASIC.C		basic cursor movement
X	BIND.C		key binding commands
X	BUFFER.C	buffer manipulation commands
X	CRYPT.C		encryption functions
X	DOLOCK		file locking stub routines
X	DG10.C		Data General 10 screen driver
X	DISPLAY.C	main display driver
X	EBIND.H		binding list
X	EDEF.H		global variable declarations
X	EFUNC.H		function name list
X	EPATH.H		default path settings
X	ESTRUCT.H	configuration and structure definitions
X	EVAL.C		expression evaluator
X	EVAR.H		EMACS macro variable declarations
X	EXEC.C		macro execution functions
X	FILE.C		user file functions
X	FILEIO.C	low level file I/O driver
X	HP110.C		HP110 screen driver
X	HP150.C		HP150(A or C) screen driver
X	IBMPC.C		IBM-PC CGA and MONOCHROME driver
X	INPUT.C		low level user input driver
X	ISEARCH.C	incremental search functions
X	LINE.C		text line manipulation functions
X	LOCK.C		file locking functions
X	MAIN.C		argument parsing and command loop
X	RANDOM.C	other random user functions
X	REGION.C	region cut & paste functions
X	SEARCH.C	search and replace functions
X	SPAWN.C		OS interface driver
X	ST520.C		ATARI ST1040 screen driver
X	TCAP.C		Termcap screen driver
X	TERMIO.C	low level I/O driver
X	TIPC.C		TI-PC screen driver
X	VMSVT.C		VMS screen driver
X	VT52.C		VT52 screen driver
X	WINDOW.C	window manipulation functions
X	WORD.C		word manipulation functions
X	Z309.C		Zenith 100 PC series terminal driver
X
XEMACSEXE.ARC includes the files:
X
X	MEIBM.EXE	IBM-PC CGA/MONO/EGA version
X	MEANSI.EXE	MSDOS ANSI graphics version
X	ME110.EXE	HP110 portable version
X	ME150.EXE	HP150 version
X	ME309.EXE	Zenith 100 PC series version
X	ME520.PRG	Atari 520/1040ST version
X	MEAMIGA.	Amiga 1000 version
X
X	Recently, MicroSPELL 1.0 has been released.  This program allows
Xyou to spell check text files and uses MicroEMACS to scan the file,
Xdoing various corrections. 
X
X	MicroSCRIBE, a fairly SCRIBE compatible text formatter to go
Xalong with these programs will probably be available for beta testing
Xearly spring 1988.  This program is turning out to be a lot more complex
Xthan I thought it would be, and is taking more time to get out.
X
X	I have in my possesion a port of MicroEMACS 3.8i to the
XMacintosh, and I will be incorporating the needed changes for the current
Xversion to support the Macintosh.
X
X	As before, I will continue to support these programs, and
Xencourage everyone to spread them around as much as they can.  If you
Xmake what you think are changes that are useful to many, send me the
Xupdates, and as time permits, I will incorporate the ones I understand,
Xand agree with into the master sources.
X
X	MicroEMACS is available on disk directly from my by sending me
X$25 per order and a note specifying the disk format and the product that
Xyou need.  I can fill orders for IBM-PC high/low density 5 1/4 and 3
X1/5, ATARI ST single and double density, AMIGA disks and HP150 disks. 
X(You do not need to send disks or mailers, I will provide these.) The
Xdistribution set includes on disk all docs, executables and sources. 
XAlso I will register you and you will receive automatic notices of new
Xversions of all the programs I am releasing.
X
X	Commercial lisences to allow MicroEMACS to be incorporated into
Xother software packages are also available at a reasonable per package
Xprice. Also I am available to do customization of MicroEMACS at an
Xhourly rate. Send all requests to the address below:
X
X	USmail:	Daniel Lawrence
X		617 New York St
X		Lafayette, IN 47901
X
X	UUCP:	pur-ee!j.cc.purdue.edu!nwd
X	ARPA:	nwd@j.cc.purdue.edu
X	FIDO:	The Programmer's Room 201/2
X		(317) 742-5533
X	ATT:	(317) 742-5153
X
X	
X		New Features since version 3.8i
X		===============================
X
X**	New standard startup file
X
X	The new emacs.rc file is segmented into more parts and loads much
Xfaster than before. Separate "pages" of shifted function keys are
Xavailable. Users can write their own "pages".
X
X***	New Variables (there are a lot...)
X
X	$status		returns status of last command
X	$palette	color palette settings
X	$lastkey	returns last keystroke
X	$curchar	returns and set the ascii number of the
X			character under the point
X	$progname	always returns "MicroEMACS"
X	$version	always returns the current version ("3.9")
X	$discmd		sets display of messages on the command
X			line (except via the write-message command)
X	$disinp		sets echoing of characters during input on the
X			command line
X	$wline		returns and sets # lines in current window
X	$cwline		returns and set current line within window
X	$target		returns/sets target for line moves
X	$search		returns/sets default search string
X	$replace	returns/sets default replace string
X	$match		returns last matched string in magic search
X	$cmode		returns/sets encoded mode of current buffer
X	$gmode		returns/sets encoded global mode (see appendix E
X			in emacs.mss to decode this)
X	$tpause		returns/sets the pause for fence matching
X			(this is in rather arbitrary units which
X			WILL vary from machine to machine)
X	$line		return/sets the contents of the current line
X	$gflags		global operations flag (see emacs.txt Appendix G)
X	$rval		child process return value
X
X***	New computers supported
X
X	Atari 1040ST	all three graphics modes and 50 line mode on a
X			monochrome monitor. The mouse is bound to the 
X			cursor keys for now.
X
X***	New Compilers supported
X
X	Turbo C v1.0 under MSDOS is now a supported compiler.
X	Mark Williams C on the Atari ST is also supported.
X
X**	New directives
X
X	!while 	loops while  is true
X
X		!break		breaks out of the innermost !while
X
X	!endwhile		delimits the end of a !while loop
X
X	All !gotos are legal into and out of a !while loop.
X
X***	Autosave mode
X
X	This mode saves the file out to disk every time 256 have been
Xinserted. $asave controls the # of characters between saves, $acount
Xcontrols the # of chars to the next save.
X
X***	New functions
X
X	&and	 	Logical AND
X	&or	 	Logical OR
X	&len			returns length of 
X	&lower			lowercase 
X	&upper			uppercase 
X	&rnd			generate a random integer between 1 and 
X	&sindex  	search for string 2 within string 1
X				returning its position, or zero if it fails
X	&env			return value of DOS environment
X				variable 
X	&bind			returns the function name bound to the
X				key 
X	&exist			Does file  exist?
X	&find			find file  along the PATH
X	&band	 	bitwise and
X	&bor	 	bitwise or
X	&bxor	 	bitwise xor
X	&bnot			bitwise not
X	&xlate	  
X				scan  replacing characters in
X				 with the coresponding characters
X				in 
X
X***	Advanced word processing commands
X
X	^X^T	trim-line	trim all trailing whitespace
X	^X^E	entab-line	change all multiple char runs to tabs
X	^X^D	detab-line	change all tabs to multiple spaces
X
X***	Merged EGA driver
X
X	The EGA driver is now part of the IBM-PC driver. This driver now
Xsupports MONO, CGA and EGA cards/modes. (settable by using the $sres
Xvariable)
X
X***	8 bit characters fully supported
X
X	Eight bit characters (including foreign language and line
Xdrawing characters) are now supported on the various micro environments)
X
X***	List Buffers expanded
X
X	Given a numeric argument, ^X^B (list-buffers) will now also list
Xall the hidden internal buffers.
X
X***	-k switch enhanced
X
X	If you use the -k (encrypted file) switch on the command line
Xwithout a key immediatly following it, it will prompt you for the key to
Xuse to decrypt with.
X
X***	word delete enhanced
X
X	with a zero (0) argument, M-D (delete-next-word) deletes the
Xnext word and not any intervening whitespace or special characters.
X
X***	New File read hook
X
X	Whenever MicroEMACS reads a file from disk, right before it is
Xread, whatever function is bound to M-FNR (which is an illegal
Xkeystroke) will execute. By default this would be (nop), but the
Xstandard emacs.rc binds this to a file that examines the file name and
Xplaces the buffer int CMODE if the extension ends in a .c or .h. You can
Xof course redefine this macro to taste.
X
X***	Search Path modified
X
X	The order in which emacs looks for all .rc (startup) and
X.cmd (command macros) is as follows:
X
X	$HOME			(the HOME environment variable if it exists)
X	the current directory
X	$PATH			(executable PATH)
X	default list contained in epath.h
X
X***	Line length limits removed
X
X	Lines of arbitrary length may be read, edited, and written.
X
X***	Out of memory handling improved
X
X	EMACS will announce "OUT OF MEMORY" when it runs out of dynamic
Xmemory while reading files or inserting new text.  It should then be
Xsafe to save buffers out IF THE CONTENTS OF THE BUFFER ARE COMPLETE at
Xthat time.  When a buffer has been truncated while reading, a pound sign
X"#" will appear in the first position of the mode line.  Also a # will
Xappear in a buffer listing.  If you attempt to save a truncated buffer,
XEMACS will ask if you are certain before allowing the truncated file to
Xbe written.  As before, still beware of killing blocks of text after you
Xhave run out of memory. 
X
X***	DENSE mode on the Atari ST
X
X	On an Atari ST monochrome monitor, setting $sres to "DENSE" will
Xresult in a 50 line display.
X
X***	Execute command
X
X	Execute-program (^X-$) will execute an external program without
Xcalling up an intervening shell is possible.
X
X***	Better close braces in CMODE
X
X	The name says it all, try it.
FRIDAY_NIGHT
echo extracting - shell.cmd
sed 's/^X//' > shell.cmd << 'FRIDAY_NIGHT'
X;	Shell.cmd:	MSDOS shell within MicroEMACS
X;			written 1987 by Daniel Lawrence
X
X	write-message "[Setting up SHELL window]"
X
Xstore-procedure	getdir
X	shell-command "cd > eshell"
X	set %shtmp $cbufname
X	!force delete-buffer eshell
X	find-file eshell
X	beginning-of-file
X	set %shdir $line
X	select-buffer %shtmp
X	delete-buffer eshell
X!endm
X
Xstore-procedure prompt
X	!if ¬ &equ $curcol 0
X		newline
X	!endif
X	!if ¬ &seq $line ""
X		open-line
X	!endif
X	insert-string &cat %shdir ">"
X!endm
X
Xstore-procedure getline
X	beginning-of-line
X	set %shtmp $curline
X	!force search-forward ">"
X	!if ¬ &equ $curline %shtmp
X		set $curline %shtmp
X	!endif
X	!if &equ $curchar 10
X		set %shline ""
X	!else
X		kill-to-end-of-line
X		yank
X		set %shline $kill
X	!endif
X	newline
X!endm
X
Xstore-procedure execline
X	shell-command &cat %shline " > shtmp"
X	!force insert-file shtmp
X!endm
X
X;	prompt and execute a command
X
X4	store-macro
X	run getline
X	!if ¬ &seq %shline ""
X		!if &or &seq &left %shline 2 "cd" &seq &right %shline 1 ":"
X			shell-command %shline
X			run getdir
X		!else
X			run execline
X		!endif
X	!endif
X	run prompt
X!endm
X
Xstore-procedure checkmode
X	!if &and %shmode ¬ &seq $cbufname "[I-SHELL]"
X		set $discmd FALSE
X		bind-to-key newline ^M
X		add-mode blue
X		add-mode WHITE
X		write-message "[Exiting Shell window]"
X		set %shmode FALSE
X		set $discmd TRUE
X	!endif
X	!if &and ¬ %shmode &seq $cbufname "[I-SHELL]"
X		set $discmd FALSE
X		write-message "[Entering Shell window]"
X		bind-to-key execute-macro-4 ^M
X		run getdir
X		add-mode black
X		add-mode GREEN
X		end-of-file
X		run prompt
X		set %shmode TRUE
X		set $discmd TRUE
X	!endif
X!endm
X
X;	window movement (and deactivate us)
X
X5	store-macro
X	next-window
X	run checkmode
X!endm
X
X6	store-macro
X	previous-window
X	run checkmode
X!endm
X
X7	store-macro
X	delete-window
X	run checkmode
X!endm
X
X8	store-macro
X	find-file @"Find file:"
X	run checkmode
X!endm
X
X9	store-macro
X	next-buffer
X	run checkmode
X!endm
X
Xstore-procedure openshell
X	set $discmd FALSE
X	bind-to-key execute-macro-5 ^XO
X	bind-to-key execute-macro-6 ^XP
X	bind-to-key execute-macro-7 ^X0
X	bind-to-key execute-macro-8 ^X^F
X	bind-to-key execute-macro-9 ^XX
X	select-buffer "[I-SHELL]"
X	run checkmode
X	set $discmd TRUE
X!endm
X
X	set %shmode FALSE
X	run openshell
FRIDAY_NIGHT
echo extracting - st520.rc
sed 's/^X//' > st520.rc << 'FRIDAY_NIGHT'
X;	EMACS.RC:	Standard micro Startup program
X;			for MicroEMACS 3.9d and above
X;			(C)opyright 1987 by Daniel M Lawrence
X;			Last Update: 10/20/87
X
Xset $discmd FALSE
Xwrite-message "[Setting up....]"
X
X; If you screen "SNOWS", uncomment this line
X;	set $flicker "TRUE"
X
X; To use an IBM-PC EGA card, uncomment the following line
X;	set $sres "EGA"
X
X;	***** Rebind the Function key group
X
Xbind-to-key search-forward		FN;
Xbind-to-key search-reverse		FN<
Xbind-to-key hunt-forward		FN=
Xbind-to-key hunt-backward		FN>
Xbind-to-key execute-macro-1		FN?
Xbind-to-key execute-macro-2		FN@
Xbind-to-key next-window			FNA
Xbind-to-key execute-macro-3		FNB
Xbind-to-key save-file			FNC
Xbind-to-key exit-emacs			FND
X
Xbind-to-key execute-macro-10		FNT
Xbind-to-key execute-macro-11		FNU
Xbind-to-key execute-macro-12		FNV
Xbind-to-key execute-macro-13		FNW
Xbind-to-key execute-macro-14		FNX
Xbind-to-key execute-macro-15		FNY
Xbind-to-key execute-macro-16		FNZ
Xbind-to-key execute-macro-17		FN[
Xbind-to-key execute-macro-18		FN\
Xbind-to-key execute-macro-19		FN]
X
X;	Set Default Global modes
X
Xadd-global-mode "blue"
Xbind-to-key next-page FNG
Xbind-to-key previous-page FNR
X
X;	Toggle function key window display
X
X1	store-macro
X	!if %rcfkeys
X		!goto rcfoff
X	!endif
X
X;	toggle function key window on
X	save-window
X	1 next-window
X	!if &sequal $cbufname "emacs.hlp"
X		delete-window
X	!endif
X	!if ¬ &sequal $cbufname "Function Keys"
X		1 split-current-window
X		select-buffer "Function Keys"
X		add-mode "red"
X		!force 5 resize-window
X		1 goto-line
X	!endif
X	set %rcfkeys TRUE
X	!force restore-window
X	!if &sequal $cbufname "Function Keys"
X		next-window
X	!endif
X	write-message "[Function key window ON]"
X	!return
X
X	;Toggle the function key window off
X*rcfoff
X	save-window
X	1 next-window
X	!if &sequal "Function Keys" $cbufname
X		delete-window
X	!endif
X	!force restore-window
X	write-message "[Function key window OFF]"
X	set %rcfkeys FALSE
X!endm
X
X;	Toggle HELP file onscreen
X
X2 store-macro
X	1 next-window
X
X	;Make sure the function key window isn't up!
X	!if &sequal $cbufname "Function Keys"
X		delete-window
X	!endif
X	set %rcfkeys FALSE
X
X	;Bring up page 1
X	!if ¬ &seq $cbufname "emacs.hlp"
X		help
X		8 resize-window
X		add-mode "red"
X		beginning-of-file
X		2 forward-character
X	!endif
X
X*rchelp
X
X	write-message "[INS/HOME] Page    [FN6] EXIT     ^G  Exit leaving page on screen"
X	update-screen
X	set %rctmp >key
X	!if &equ &asc %rctmp 0
X		set %rctmp >key
X		!if &seq %rctmp R
X			beginning-of-line
X			!force search-reverse "=>"
X			1 redraw-display
X			!goto rchelp
X		!endif
X		!if &seq %rctmp G
X			beginning-of-line
X			2 forward-character
X			!force search-forward "=>"
X			1 redraw-display
X			!goto rchelp
X		!endif
X		!if &seq %rctmp "~@"
X			delete-window
X			!if &seq %rcfkeys TRUE
X				set %rcfkeys FALSE
X				execute-macro-1
X			!endif
X			write-message "[Help Exited]"
X			!return
X		!endif
X	!endif
X	!if &equ &asc %rctmp 7
X		next-window
X		set %rcfkeys FALSE
X		write-message "[Help Aborted]"
X		!return
X	!endif
X	!goto rchelp
X!endm
X
X;	Load a new page
X
X3	store-macro
X	!if &seq &find newpage.cmd ""
X		write-message "[Can not find NEWPAGE.CMD]"
X		!return
X	!endif
X	execute-file newpage.cmd
X!endm
X
X;procedure to clean out the current page (which is nothing right now)
X
Xstore-procedure	clean
X	; nothing by default
X!endm
X
X;	Set up auto CMODE
X
X20	store-macro
X	set %rctmp &sin $cfname "."
X	!if &equ %rctmp 0
X		!return
X	!endif
X	set %rctmp &mid $cfname &add %rctmp 1 5
X	!if &or &seq %rctmp "c" &seq %rctmp "h"
X		add-mode "cmode"
X	!endif
X!endm
Xbind-to-key execute-macro-20	M-FNR
X
X;	bring up the function key window
X
X	1 split-current-window
X	select-buffer "Function Keys"
X	insert-string "f1 search-> f2 <-search |    MicroEMACS:  Text Editor~n"
X	insert-string "f3 hunt->   f4 <-hunt   | ~n"
X	insert-string "f5 fkeys    f6 help     |  Available function key Pages include:~n"
X	insert-string "f7 nxt wind f8 pg[    ] |    WORD  PROG  BOX~n"
X	insert-string "f9 save     f10 exit    |  [use the f8 key to load Pages]~n"
X	unmark-buffer
X	delete-window
X	set %rcfkeys FALSE
X	execute-macro-1
X	set $discmd TRUE
FRIDAY_NIGHT
echo extracting - trand.cmd
sed 's/^X//' > trand.cmd << 'FRIDAY_NIGHT'
X	set %try 0
X	set %sum 0
X	insert-string "Rolls: "
X*nextry
X	set %roll &rnd 100
X	!if &greater $curcol 70
X		newline
X		insert-string "       "
X	!endif
X	set %sum &add %sum %roll
X	insert-string &cat %roll " "
X	update-screen
X	set %try &add %try 1
X	!if &less %try 300
X		!goto nextry
X	!endif
X
X	newline
X	newline
X	insert-string &cat &cat "Sum of rolls: " %sum "~n"
X	insert-string &cat &cat "Average roll: " &div %sum 300 "~n"
X	update-screen
X	unmark-buffer
FRIDAY_NIGHT
echo extracting - wpage.cmd
sed 's/^X//' > wpage.cmd << 'FRIDAY_NIGHT'
X;	WPAGE.CMD:	Wordprocessing Macro Page
X;			for MicroEMACS 3.9d and above
X;			(C)opyright 1987 by Daniel M Lawrence
X
X; set the clean procedure up
Xstore-procedure clean
X	delete-buffer "[Macro 10]"
X       	bind-to-key execute-macro-11 FNU
X	bind-to-key execute-macro-12 FNV
X	delete-buffer "[Macro 13]"
X	delete-buffer "[Macro 14]"
X	delete-buffer "[Macro 15]"
X	delete-buffer "[Macro 16]"
X	delete-buffer "[Macro 17]"
X	bind-to-key execute-macro-18 FN\
X	delete-buffer "[Macro 19]"
X	set $cmode %oldmode
X	set $gmode %oldgmode
X!endm
X
X; make sure the function key window is up
X	set %rcfkeys FALSE
X	execute-macro-1
X	write-message "Loading..."
X
X; Write out the page instructions
X	save-window
X	1 next-window
X	beginning-of-file
X	set $curcol 25
X	overwrite-string " F1 center line                                     "
X	next-line
X	set $curcol 25
X	overwrite-string " F3 reformat paragraph     F4 spell check file      "
X	next-line
X	set $curcol 25
X	overwrite-string " F5 ref indented paragraph F6 PREVIEW output        "
X	next-line
X	set $curcol 18
X	overwrite-string "WORD"
X	set $curcol 25
X	overwrite-string " F7 toggle words           F8 output DRAFT          "
X	next-line
X	set $curcol 25
X	overwrite-string " F9 count words           F10 output FINAL          "
X	unmark-buffer
X	beginning-of-file
X	!force restore-window
X	update-screen
X
X; Center the current line
X
X10	store-macro
X	end-of-line
X	set %rctmp $curcol
X	beginning-of-line
X	&div &sub $fillcol %rctmp 2 insert-space
X	beginning-of-line
X!endm
X
Xbind-to-key nop FNU
Xbind-to-key fill-paragraph FNV
X
X;	Spell check the current buffer
X
X13	store-macro
X	set %rctmp @"User dictionary( if none): "
X	!if &seq %rctmp "ERROR"
X		!return
X	!endif
X	!if ¬ &seq %rctmp ""
X		set %rctmp &cat &cat "-u" %rctmp " "
X	!endif
X	save-file
X	set %rcspell TRUE
X	write-message ~n
X	shell-command &cat &cat "spell " %rctmp $cfname
X	execute-file "scan.cmd"
X	delete-other-windows
X	!if &seq %rcfkeys TRUE
X		set %rcfkeys FALSE
X		execute-macro-1
X	!endif
X	update-screen
X	write-message "[Spell Check complete]"
X!endm
X
X;	reformat indented paragraph
X
X14	store-macro
X	write-message "                    [Fixing paragraph]"
X
X	;remember where we are..and set up
X	set %endpos $cwline
X	set $discmd "FALSE"
X
X	;snarf the paragraph and put it in its own buffer
X	kill-region
X	2 split-current-window
X	select-buffer "[temp]"
X	yank
X
X	;get rid of the blank lines at the end
X	end-of-file
X	!while &and &seq $line "" ¬ &equ $curline 1
X		delete-previous-character
X	!endwhile
X	forward-character
X
X	;get rid of the indents
X	set %endline $curline
X	beginning-of-file
X	!while &gre %endline $curline
X		!while &or &equ $curchar 32 &equ $curchar 9
X			delete-next-character
X		!endwhile
X		next-line
X	!endwhile
X
X	;re-format it
X	&sub $fillcol 8 set-fill-column
X	1 goto-line
X	fill-paragraph
X	&add $fillcol 8 set-fill-column
X
X	;insert new indents
X	end-of-file
X	set %endline $curline
X	beginning-of-file
X	!while &less $curline &sub %endline 1
X		beginning-of-line
X		handle-tab
X		next-line
X	!endwhile
X
X	;move it back into the original buffer
X	beginning-of-file
X	set-mark
X	end-of-file
X	kill-region
X	unmark-buffer
X	delete-window
X	yank
X
X	;and clean up
X	delete-buffer "[temp]"
X	set $cwline %endpos
X	set $discmd TRUE
X	write-message "                    [Fixed paragraph]"
X!endm
X
X15	store-macro
X	write-message "[MicroSCRIBE not ready]"
X!endm
X
X;	swap the word the cursor is on and it's predisesor
X
X16	store-macro
X	set %rctmp $search
X	forward-character
X	previous-word
X	0 delete-next-word
X	set %second $kill
X	insert-string "~~"
X	!force previous-word
X	!if &seq $status FALSE
X		set %first %second
X	!else
X		0 delete-next-word
X		set %first $kill
X		insert-string %second
X	!endif
X	search-forward "~~"
X	delete-previous-character
X	insert-string %first
X	previous-word
X	set $search %rctmp
X!endm
X
X17	store-macro
X	write-message "[MicroSCRIBE not ready]"
X!endm
X
Xbind-to-key count-words FN\
X
X19	store-macro
X	write-message "[MicroSCRIBE not ready]"
X!endm
X
X	set %oldmode $cmode
X	set %oldgmode $gmode
X	add-mode wrap
X	add-global-mode wrap
X	write-message "[Wordprocesing mode loaded]"
FRIDAY_NIGHT
echo extracting - 
sed 's/^X//' >  << 'FRIDAY_NIGHT'
XXFRIDAY_NIGHT