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

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

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then feed it
# into a shell via "sh file" or similar.  To overwrite existing files,
# type "sh file -c".
# The tool that generated this appeared in the comp.sources.unix newsgroup;
# send mail to comp-sources-unix@uunet.uu.net if you want that tool.
# If this archive is complete, you will see the following message at the end:
#		"End of archive 4 (of 6)."
# Contents:  medoc.p03
# Wrapped by klotz@ihlpm on Wed May 24 11:03:31 1989
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'medoc.p03' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'medoc.p03'\"
else
echo shar: Extracting \"'medoc.p03'\" \(32755 characters\)
sed "s/^X//" >'medoc.p03' <<'END_OF_FILE'
XFor example, in default mode, press the tab key and then type the word\fBTest\fR. ``Test'' appears at the eighth column. Move your cursor to the
Xbeginning of the word and delete the backward character. The word
Xdoesn't move back just one character, but flushes to the left margin. 
XThe reason for this behavior is easily explained. In tab default, EMACS
Xinserts a 'real' tab character when you press the tab key. This
Xcharacter is inserted at the default position, but NO SPACES are
Xinserted between the tab character and the margin (or previous tab
Xcharacter). As you will recall, EMACS only recognizes characters (such
Xas spaces or letters) and thus when the tab character is removed, the
Xtext beyond the tab is flushed back to the margin or previous tab mark.
X
XThis situation changes if you alter the default configuration. The
Xdefault value may be changed by entering a numeric argument before
Xpressing the tab key. As we saw earlier, pressing the \fBMETA\fR key and
Xentering a number allows you to specify how EMACS performs a given
Xaction. In this case, let's specify an argument of 10 and hit the tab
Xkey. 
X
XNow hit the tab key again and type \fBTest\fR. Notice the word now
Xappears at the tenth column. Now move to the beginning of the word and
Xdelete the backward character. ``Test'' moves back by one character. 
X
XEMACS behaves differently in these circumstances because the \fB^I\fR \fIhandle-tab\fR  function deals
Xwith tabbing in two distinct ways. In default conditions, or if the
Xnumeric argument of zero is used, \fIhandle-tab\fR inserts a true tab
Xcharacter. If, however, a non-zero numeric argument is specified,\fIhandle-tab\fR inserts the correct number of spaces needed to position
Xthe cursor at the next specified tab position. It does NOT insert the
Xsingle tab character and hence any editing functions should take account
Xof the number of spaces between tabbed columns.
X
XThe distance which a true tab character moves the cursor can be
Xmodified by changing the value of the $hardtab environment variable. 
XInitially set to 8, this will determine how far each tab stop is placed
Xfrom the previous one. (Use the ^XA \fIset\fR command to set
Xthe value of an environment variable).
X
XMany times you would like to take text which has been created using
Xthe tab character and change it to use just spaces. The command\fB^X^D\fR \fIdetab-region\fR  changes any tabs 
Xin the currently selected region into the right number of spaces so
Xthe text does not change. This is very useful for times when the file
Xmust be printed or transferred to a machine which does not understand
Xtabs. 
X
XAlso, the inverse command, \fB^X^E\fR \fIentab-region\fR changes multiple spaces to tabs where possible. 
XThis is a good way to shrink the size of large documents, especially
Xwith data tables. Both of these commands can take a numeric argument
Xwhich will be interpreted as the number of lines to en/detab. 
X
XAnother function, related to those above is provided for by the \fB^X^T\fR\fItrim-region\fR when invoked will delete any trailing
Xwhite space in the selected region. A preceding numeric argument will do
Xthis for that number of lines.
X.bp
X.fi
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XIn Chapter \n(ch introduced some of the formatting features of
XEMACS. Text-wrap, paragraph reformatting, and tabs were discussed in
Xsome detail. The commands in the following table were covered in the
Xchapter. 
X
X.nf
X.ft CW
X
X
X.us  "Key Binding		Keystroke		    Effect"
X
Xadd-mode/WRAP		\fB^XM\f(CW    [WRAP]	Add wrap mode to current buffer
X
Xdelete-mode/WRAP	\fB^X^M\f(CW    [WRAP]	Remove wrap mode from current buffer
X
Xset-fill-column 	\fB^XF\f(CW     	Set fill column to given numeric
X					argument  
X
Xfill-paragraph		\fBM-Q\f(CW     	Logically reformats the current
X					paragraph
X
Xcase-word-upper 	\fBM-U\f(CW     	Text from point to end of the
X					current word is changed to uppercase
X
Xcase-word-lower 	\fBM-L\f(CW     	Text from point to end of the 
X					current word is changed to lowercase
X
Xcase-word-capitalize	\fBM-C\f(CW     	First word (or letter) after the
X					point is capitalized
X
Xcase-region-upper	\fB^X^U\f(CW    	The current region is uppercased
X
Xcase-region-lower	\fB^X^L\f(CW    	The current region is lowercased
X
Xhandle-tab		\fB^I\f(CW    		Tab interval is set to the given
X					numeric argument
X
Xentab-region		\fB^X^E\f(CW    	Changes multiple spaces to tabs
X					characters where possible
X
Xdetab-region		\fB^X^D\f(CW    	Changes tab characters to the
X					appropriate number of spaces
X
Xtrim-region		\fB^X^T\f(CW    	Trims white space from the end
X					of the lines in the current region\fR
X.fi
X
X\fR
X.CH "Access to the Outside World"
X
X
X EMACS has the ability to interface to other programs and the
Xenvironment of the computer outside of itself. It does this through a
Xseries of commands that allow it to talk to the computer's \fBcommand
Xprocessor\fR  or \fBshell\fR  . Just
Xwhat this is varies between different computers. Under MSDOS or PCDOS
Xthis is the \fBcommand.com\fR  command processor. 
XUnder UNIX it is the \fBcsh\fR  shell. On the Atari ST is
Xcan be the Mark Williams \fBMSH\fR or the Beckmeyer shell. In each case,
Xit is the part of the computer's operating system that is responsible
Xfor determining what programs are executed, and when. 
X
X The \fB^X!\fR \fIshell-command\fR  command
Xprompts the user for a command line to send out to the shell to execute.
XThis can be very useful for doing file listings and changing the
Xcurrent directory or folder. EMACS gives control to the shell, which
Xexecuted the command, and then types \fB[END]\fR and waits for the user to
Xtype a character before redrawing the screen and resuming editing. If
Xthe \fIshell-command\fR command is used from within the macro language,
Xthere is no pause.
X
X \fB^X@\fR \fIpipe-command\fR  command allows
XEMACS to execute a shell command, and if the particular computer allows
Xit, send the results into a buffer which is automatically displayed on
Xthe screen. The resulting buffer, called ``command'' can be manipulated
Xjust like any other editing buffer. Text can be copied out of it or
Xrearranged as needed. This buffer is originally created in \fBVIEW\fR mode,
Xso remember to \fB^X^Mview<NL>\fR in order to change it.
X
X Many computers provide tools which will allow you to \fBfilter\fR text, making some modifications to it along the way. A
Xvery common tool is the \fBSORT\fR program which accepts a file, sorts
Xit, and prints the result out. The EMACS command, \fB^X#\fR\fIfilter-buffer\fR sends the current buffer through
Xsuch a filter. Therefore, if you wished to sort the current buffer on
Xa system which supplied a sort filter, you would type \fB^X#sort<NL>\fR. 
XYou can also create your own filters by writing programs and utilities
Xwhich read text from the keyboard and display the results. EMACS will
Xuse any of these which would normally be available from the current
Xshell.
X
X If you would like to execute another program directly, without
Xthe overhead of an intervening shell, you can use the \fB^X$\fR\fIexecute-program\fR  command. It will prompt you
Xfor an external program and its arguments and attempt to execute it. 
XLike when EMACS looks for command files, EMACS will look first in the
XHOME directory, then down the execute PATH, and finally in the current
Xdirectory for the named program. On some systems, it will automatically
Xtack the proper extension on the file name to indicate it is a program.
XOn some systems that don't support this function, \fB^X$\fR will be
Xequivalent to \fB^X!\fR \fIshell-command\fR.
X
X Sometimes, you would like to get back to the shell and execute
Xother commands, without losing the current contents of EMACS. The\fB^XC\fR \fIi-shell\fR  command shells out of EMACS,
Xleaving EMACS in the computer and executing another command shell. Most
Xsystems would allow you to return to EMACS with the ``exit'' command. 
X\fI On some systems, mainly advanced versions of UNIX, you can
Xdirect EMACS to ``go into the background'' with the \fB^XD\fB suspend-emacs command. This places EMACS in the background
Xreturning you to the original command shell. EMACS can then be returned
Xto at any time with the ``fg'' foreground command.\fR
X.bp
X.fi
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XIn Chapter \n(ch introduced different ways to access the
Xcomputers shell or command processor from within EMACS. The commands
Xin the following table were covered in the chapter. 
X
X.nf
X.ft CW
X
X
X.us  "Key Binding		Keystroke		    Effect"
X
Xexecute-program 	\fB^X$\f(CW     	Execute an external program
X					directly
X
Xfilter-command		\fB^X#\f(CW     	Send the current buffer through
X					a shell filter
X
Xi-shell 		\fB^XC\f(CW     	Escape to a new shell
X
Xpipe-command		\fB^X@\f(CW    	Send the results of an external
X					shell command to a buffer
X
Xshell-command		\fB^X!\f(CW     	Execute one shell command
X
Xsuspend-emacs		\fB^XD\f(CW     	Place EMACS in the background
X					(some UNIX systems only)\fR
X.fi
X
X\fR
X.CH "Keyboard Macros"
X
X
XIn many applications, it may be necessary to repeat a series of
Xcharacters or commands frequently. For example, a paper may require the
Xfrequent repetition of a complex formula or a long name. You may also
Xhave a series of EMACS commands that you invoke frequently. Keyboard
Xmacros offer a convenient method of recording and repeating these
Xcommands. 
X
XImagine, for example, you are writing a scholarly paper on \fIAsplenium
Xplatyneuron\fR, the spleenwort fern. Even the dedicated botanist would
Xprobably find it a task bordering on the agonizing to type\fIAsplenium platyneuron\fR frequently throughout the paper. An
Xalternative method is 'record' the name in a keyboard macro. Try it
Xyourself.
X
XThe command \fB^X(\fR \fIbegin-macro\fR  starts
Xrecording the all the keystrokes and commands you input. After you've
Xtyped it, enter \fBAsplenium platyneuron\fR. To stop recording, type\fB^X)\fR \fIend-macro\fR  . EMACS has stored all the
Xkeystrokes between the two commands. To repeat the name you've stored,
Xjust enter \fB^XE\fR \fIexecute-macro\fR  , and the
Xname ``Asplenium platyneuron'' appears. You can repeat this action as
Xoften as you want, and of course as with any EMACS command, you may
Xprecede it with a numerical argument. 
X
XBecause EMACS records keystrokes, you may freely intermix commands and
Xtext. Unfortunately, you can only store one macro at a time. Thus, if
Xyou begin to record another macro, the previously defined macro is
Xlost. Be careful to ensure that you've finished with one macro before
Xdefining another. If you have a series of commands that you would like
Xto 'record' for future use, use the macro or procedure facilities
Xdetailed in chapter <X>.
X.bp
X.fi
X
X.sp
X.ce 1
X\fBChapter \n(ch Summary\fR
X
X
XChapter \n(ch covered keyboard macros. You learned how to
Xrecord keystrokes and how to repeat the stored sequence. 
X
X.nf
X.ft CW
X
X.us  "Key Binding		Keystroke		Effect"
X
X
Xstart-macro		\fB^X(\f(CW     	Starts recording all keyboard input
X
Xend-macro		\fB^X)\f(CW     	Stops recording keystrokes for macro
X
Xexecute-macro		\fB^XE\f(CW     	Entire sequence of recorded
X					keystrokes is replayed\fR
X.fi
X
X\fR
X.CH "MicroEMACS Macros"
X
X
X Macros are programs that are used to customize the editor and to
Xperform complicated editing tasks. They may be stored in files or
Xbuffers and may be executed using an appropriate command, or bound to a
Xparticular keystroke. Portions of the standard start-up file are
Ximplemented via macros, as well as the example menu system. The\fIexecute-macro-<n>\fR  commands cause the
Xmacro, numbered from 1 to 40, to be executed. The \fIexecute-file\fR command allows you to execute a macro stored in a
Xdisk file, and the \fIexecute-buffer\fR  command
Xallows you to execute a macro stored in a buffer. Macros are stored for
Xeasy execution by executing files that contain the store-macro command. 
X
X If you need more than 40 macros, named macroes, called\fBprocedures\fR,  can be used. The \fIstore-procedure\fR command takes a string argument which is the
Xname of a procedure to store. These procedures than can be executed
Xwith the \fBM-^E\fR \fIexecute-procedure\fR  or the\fIrun\fR  commands. Also, giving the name of a stored
Xprocedure within another macro will executed that named procedure as if
Xit had been called up with the \fIrun\fR command.
X
X Some fairly length examples of MicroEMACS macroes can be seen by
Xexamining the standard files that come with EMACS. The \fBemacs.rc\fR file (called \fB.emacsrc\fR\fIdex[.emacsrc]) under UNIX)
Xis the EMACS macro file which is executed when EMACS is normally run. 
XIt contains a number of different stored macroes along with the lines to
Xsetup and display the Function key window  and to call up other commands and macro files using function keys.
X
X There are many different aspects to the macro language within
XMicroEMACS. Editor commands are the various commands that manipulate
Xtext, buffers, windows, et cetera, within the editor. Directives are
Xcommands which control what lines get executed within a macro. Also
Xthere are various types of variables. Environmental variables both
Xcontrol and report on different aspects of the editor. User variables
Xhold string values which may be changed and inspected. Buffer
Xvariables allow text to be placed into variables. Interactive variable
Xallow the program to prompt the user for information. Functions can be
Xused to manipulate all these variables. 
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBConstants\fB"
X
X
X All constants and variable contents in EMACS are stored as
Xstrings of characters. Numbers are stored digit by digit as characters.
XThis allows EMACS to be ``typeless'', not having different variables types
Xbe legal in different contexts. This has the disadvantage of forcing the
Xuser to be more careful about the context of the statements variables
Xare placed in, but in turn gives them more flexibility in where they
Xcan place variables. Needless to say, this also allows EMACS's expression
Xevaluator to be both concise and quick.
X
X Wherever statements need to have arguments, it is legal to place
Xconstants. A constant is a double quote character, followed by a string
Xof characters, and terminated by another double quote character. To
Xrepresent various special characters within a constant, the tilde (~)
Xcharacter is used. The character following the tilde is interpreted
Xaccording to the following table:
X
X.nf
X.ft CW
X
X.us  "Sequence	Result"
X
X~n			EMACS newline character (breaks lines)
X~r		^M	carriage return
X~l		^J	linefeed
X~~		~	tilde
X~b		^H	backspace
X~f		^L	formfeed
X~t		^I	tab
X~"		"	quote\fR
X.fi
X
X\fB
X
X Any character not in the table which follows a tilde will be
Xpassed unmodified. This action is similar to the \fB^Q\fB\fIquote-character command available from the keyboard. 
X
X EMACS may use different characters for line terminators
Xon different computers. The ~n combination will always get the proper
Xline terminating sequence for the current system.
X
X The double quotes around constants are not needed if the
Xconstant contains no internal white space and it also does not happen to
Xmeet the rules for any other EMACS commands, directives, variables, or
Xfunctions. This is reasonable useful for numeric constants.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBVariables\fB"
X
X
X Variables in MicroEMACS can be used to return values within
Xexpressions, as repeat counts to editing commands, or as text to be
Xinserted into buffers and messages. The value of these variables is set
Xusing the set (^XA) command. For example, to set the current fill
Xcolumn to 64 characters, the following macro line would be used:
X
X set $fillcol 64
X
X or to have the contents of \fB%name\fB inserted at the point in the
Xcurrent buffer, the command to use would be:
X
X insert-string %name
X.bp
X.fi
X
X.ne 1.0i
X.sp 2
X.SS "\fBEnvironmental Variables\fB"
X
X
X ``What good is a quote if you can't change it?''
X
X These variables are used to change different aspects of the way
Xthe editor works. Also they will return the current settings if used as
Xpart of an expression. All environmental variable names begin with a
Xdollar sign ($) and are in lower case.
X
X
X.ev 1
X
X
X.ti -1.0i
X\fB$acount\fB	The countdown of inserted characters until the next save-file
X
X
X.ti -1.0i
X\fB$asave\fB	The number of inserted characters between automatic file-saves
Xin ASAVE mode
X
X
X.ti -1.0i
X\fB$bufhook\fB	The function named in this variable is run when a buffer is
Xentered. It can be used to implement modes which are specific to a
Xparicular file or file type.
X
X
X.ti -1.0i
X\fB$cbflags\fB	Current buffer attribute flags (See appendix G for details)
X
X
X.ti -1.0i
X\fB$cbufname\fB	Name of the current buffer
X
X
X.ti -1.0i
X\fB$cfname\fB	File name of the current buffer
X
X
X.ti -1.0i
X\fB$cmdhook\fB	Name of function to run before accepting a command. This is
Xby default set to \fInop
X
X
X.ti -1.0i
X\fB$cmode\fB	Integer containing the mode of the current buffer. (See Appendix F
Xfor values)
X
X
X.ti -1.0i
X\fB$curchar\fB	Ascii value of the character currently at the point
X
X
X.ti -1.0i
X\fB$curcol\fB	Current column of point in current buffer
X
X
X.ti -1.0i
X\fB$curline\fB	Current line of point in current buffer
X
X
X.ti -1.0i
X\fB$curwidth\fB	Number of columns used currently
X
X
X.ti -1.0i
X\fB$cwline\fB	Current display line in current window
X
X
X.ti -1.0i
X\fB$debug\fB	Flag to trigger macro debugging
X
X
X.ti -1.0i
X\fB$diagflag\fB	If set to TRUE, diagonal dragging of text and mode lines is
Xenabled. If FALSE, text and modelines can only be dragged horizontally
Xor vertically at one time.
X
X
X.ti -1.0i
X\fB$discmd\fB	Flag to disable the echoing of messages on the command line
X
X
X.ti -1.0i
X\fB$disinp\fB	Flag to disable the echoing of characters during command line input
X
X
X.ti -1.0i
X\fB$exbhook\fB	This variable holds the name of a function or macro which is
Xrun whenever you are switching out of a buffer.
X
X
X.ti -1.0i
X\fB$fcol\fB	The current line position being displayed in the first column of
Xthe current window.
X
X
X.ti -1.0i
X\fB$fillcol\fB	Current fill column
X
X
X.ti -1.0i
X\fB$flicker\fB	Flicker Flag set to TRUE if IBM CGA set to FALSE for most others
X
X
X.ti -1.0i
X\fB$gflags\fB	Global flags controlling some EMACS internal functions (See
Xappendix G for details)
X
X
X.ti -1.0i
X\fB$gmode\fB	Global mode flags. (See Appendix F for values)
X
X
X.ti -1.0i
X\fB$hardtab\fB	Number of spaces between hard tab stops. Normally 8, this can
Xbe used to change indentation only within the editor. 
X.ti -1.0i
X\fB$hjump\fB	The number in here tells EMACS how many columns to scroll the
Xscreen horizontally when a horizontal scroll is required.
X
X
X.ti -1.0i
X\fB$hscroll\fB	This flag determines if EMACS will scroll the entire current
Xwindow horizontally, or just the current line. The default value, TRUE,
Xresults in the entire current window being shifted left and right when
Xthe cursor goes off the edge of the screen.
X
X
X.ti -1.0i
X\fB$kill\fB	This contains the first 127 characters currently in the kill
Xbuffer and can be used to set the contents of the kill buffer
X
X
X.ti -1.0i
X\fB$language\fB	[READ ONLY]Contains the name of the language which the
Xcurrent EMACS's message will display. (Currently EMACS is available in
XEnglish, French, Spanish, Pig Latin, Portuguese, Dutch, German and
XEsperonto).
X
X
X.ti -1.0i
X\fB$lastkey\fB	[READ ONLY]Last keyboard character typed
X
X
X.ti -1.0i
X\fB$lastmesg\fB	[READ ONLY]Contains the text of the last message which
Xemacs wrote on the command line
X
X
X.ti -1.0i
X\fB$line\fB	The current line in the current buffer can be retrieved and
Xset with this environment variable
X
X
X.ti -1.0i
X\fB$lwidth\fB	[READ ONLY]Returns the number of characters in the current line
X
X
X.ti -1.0i
X\fB$match\fB	[READ ONLY]Last string matched in a magic mode search
X
X
X.ti -1.0i
X\fB$modeflag\fB	Determines if mode lines are currently displayed
X
X
X.ti -1.0i
X\fB$msflag\fB	If TRUE, the mouse (if present) is active. If FALSE, no mouse
Xcursor is displayed, and no mouse actions are taken. 
X.ti -1.0i
X\fB$pagelen\fB	Number of screen lines used currently
X
X
X.ti -1.0i
X\fB$palette\fB	string used to control the palette register settings on
Xgraphics versions. The usually form consists of groups of three octal
Xdigits setting the red, green, and blue levels. 
X.ti -1.0i
X\fB$pending\fB	[READ ONLY]Flag to determine if there are user keystrokes
Xwaiting to be processed.
X
X
X.ti -1.0i
X\fB$progname\fB	[READ ONLY]Always contains the string ``MicroEMACS'' for
Xstandard MicroEMACS. Could be something else if EMACS is incorporated
Xas part of someone else's program
X
X
X.ti -1.0i
X\fB$readhook\fB	This variable holds the name of a function to execute
Xwhenever a file is read into EMACS. Normally, using the standard\fBemacs.rc\fB file, this is bound to a function which places EMACS into
XCMODE if the extension of the file read is .c or .h
X
X
X.ti -1.0i
X\fB$replace\fB	Current default replace string
X
X
X.ti -1.0i
X\fB$rval\fB	This contains the return value from the last subprocess which was
Xinvoked from EMACS
X
X
X.ti -1.0i
X\fB$search\fB	Current default search string
X
X
X.ti -1.0i
X\fB$seed\fB	Integer seed of the random number generator
X
X
X.ti -1.0i
X\fB$softtab\fB	Number of spaces inserted by EMACS when the handle-tab command
X(which is normally bound to the TAB key) is invoked. 
X.ti -1.0i
X\fB$sres\fB	Current screen resolution (CGA, MONO, EGA or VGA on the IBM-PC
Xdriver. LOW, MEDIUM, HIGH or DENSE on the Atari ST1040, NORMAL on all
Xothers) 
X.ti -1.0i
X\fB$ssave\fB	If TRUE, when EMACS is asked to save the current file, it
Xwrites all files out to a temporary file, deletes the original, and
Xthen renames the temporary to the old file name. The default value of
Xthis is TRUE.
X
X
X.ti -1.0i
X\fB$sscroll\fB	Changes EMACS, when set to TRUE, to smoothly scroll windows
X(one line at a time) when cursoring off the ends of the current
Xwindow.
X
X
X.ti -1.0i
X\fB$status\fB	[READ ONLY]Status of the success of the last command (TRUE or
XFALSE). This is usually used with !force to check on the success of a
Xsearch, or a file operation. 
X
X
X.ti -1.0i
X\fB$sterm\fB	This is the character used to terminate search string inputs.
XThe default for this is the last key bound to \fImeta-prefix
X
X
X.ti -1.0i
X\fB$target\fB	Current target for line moves (setting this fool's EMACS into
Xbelieving the last command was a line move)
X
X
X.ti -1.0i
X\fB$time\fB	[READ ONLY]Contains a string corresponding to the current date
Xand time. Usually this is in a form similar to ``Mon May 09 10:10:58 1988''.
XNot all operating systems will support this.
X
X
X.ti -1.0i
X\fB$tpause\fB	Controls the length of the pause to display a matched fence
Xwhen the current buffer is in CMODE and a close fence has been typed
X
X
X.ti -1.0i
X\fB$version\fB	[READ ONLY]Contains the current MicroEMACS version number
X
X
X.ti -1.0i
X\fB$wline\fB	Number of display lines in current window
X
X
X.ti -1.0i
X\fB$wraphook\fB	This variable contains the name of an EMACS function which is
Xexecuted when a buffer is in WRAP mode and it is time to wrap. By
Xdefault this is bound to \fIwrap-word.
X
X
X.ti -1.0i
X\fB$writehook\fB	This variable contains the name of an EMACS function or
Xmacro which is invoked whenever EMACS attempts to write a file out to
Xdisk. This is executed before the file is written, allowing you to
Xprocess a file on the way out.
X
X
X.ti -1.0i
X\fB$xpos\fB	The column the mouse was at the last mouse button press
X
X
X.ti -1.0i
X\fB$ypos\fB	The line which the mouse was on during the last mouse button press
X
X.ev 0
X
X
X Obviously, many more of these variables will be available in
Xfuture releases of MicroEMACS. (Yes, send a vote for your favorite new
Xenvironmental variables today).
X
X.ne 1.0i
X.sp 2
X.SS "\fBUser variables\fB"
X
X
X User variables allow you, the user, to store strings and
Xmanipulate them. These strings can be pieces of text, numbers (in text
Xform), or the logical values \fBTRUE\fB and \fBFALSE\fB. These variables
Xcan be combined, tested, inserted into buffers, and otherwise used to
Xcontrol the way your macros execute. At the moment, up to 255 user
Xvariables may be in use in one editing session. All users variable
Xnames must begin with a percent sign (%) and may contain any printing
Xcharacters. Only the first 10 characters are significant (IE
Xdifferences beyond the tenth character are ignored). Most operators
Xwill truncate strings to a length of 128 characters. 
X
X.ne 1.0i
X.sp 2
X.SS "\fBBuffer Variables\fB"
X
X
X Buffer variables are special in that they can only be queried
Xand cannot be set. What buffer variables are is a way to take text from
Xa buffer and place it in a variable. For example, if I have a buffer by
Xthe name of RIGEL2, and it contains the text:
X
X.nf
X.ft CW
X
X	Richmond
X	Lafayette
X	<*>Bloomington		(where <*> is the current point)
X	Indianapolis
X	Gary
X	=* MicroEMACS 3.10 (WRAP) == rigel2 == File: /data/rigel2.txt =====
X\fR
X.fi
X
X\fB
X
X and within a command I reference #rigel2, like:
X
X insert-string #rigel2
X
X MicroEMACS would start at the current point in the RIGEL2
Xbuffer and grab all the text up to the end of that line and pass that
Xback. Then it would advance the point to the beginning of the next line.
XThus, after our last command executes, the string ``Bloomington'' gets
Xinserted into the current buffer, and the buffer RIGEL2 now looks like
Xthis:
X
X.nf
X.ft CW
X
X	Richmond
X	Lafayette
X	Bloomington
X	<*>Indianapolis 	(where <*> is the current point)
X	Gary
X	=* MicroEMACS 3.10 (WRAP) == rigel2 == File: /data/rigel2.txt =====
X\fR
X.fi
X
X\fB
X
X as you have probably noticed, a buffer variable consists of the
Xbuffer name, preceded by a pound sign (#).
X
X.ne 1.0i
X.sp 2
X.SS "\fBInteractive variables\fB"
X
X
X Interactive variables are actually a method to prompt the user
Xfor a string. This is done by using an at sign (@) followed either with
Xa quoted string, or a variable containing a string. The string is the
Xplaced on the bottom line, and the editor waits for the user to type in
Xa string. Then the string typed in by the users is returned as the
Xvalue of the interactive variable. For example:
X
X.nf
X.ft CW
X
X	set %quest "What file? "
X	find-file @%quest\fR
X.fi
X
X\fB
X
X will ask the user for a file name, and then attempt to find it.
XNote also that complex expressions can be built up with these
Xoperators, such as:
X
X.ft CW
X@&cat &cat "File to decode[" %default "]: "\fB
X
X
X which prompts the user with the concatenated string.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBFunctions\fB"
X
X
X Functions can be used to manipulate variables in various ways. 
XFunctions can have one, two, or three arguments. These arguments will
Xalways be placed after the function on the current command line. For
Xexample, if we wanted to increase the current fill column by two, using
Xemacs's set (^XA) command, we would write:
X
X.nf
X.ft CW
X
X	set $fillcol &add $fillcol 2
X	 \\	\\      \\      \\     \\____second operand
X	  \\	 \\	\\      \\_________first operand
X	   \\	  \\	 \\_______________function to execute
X	    \\	   \\_____________________variable to set
X	     \\___________________________set (^XA) command\fR
X.fi
X
X\fB
X
X
X Function names always begin with the ampersand (&) character,
Xand are only significant to the first three characters after the
Xampersand. Functions will normal expect one of three types of
Xarguments, and will automatically convert types when needed.
X
X
X.ev 1
X
X
X.ti -1.0i
X\fB<num>\fB	an ascii string of digits which is interpreted as a numeric value. 
XAny string which does not start with a digit or a minus sign (-) will be
X
Xconsidered zero. 
X
X
X.ti -1.0i
X\fB<str>\fB	An arbitrary string of characters. At the moment, strings are
Xlimited to 128 characters in length. 
X
X
X.ti -1.0i
X\fB<log>\fB	A logical value consisting of the string ``TRUE'' or ``FALSE''. 
XNumeric strings will also evaluate to ``FALSE'' if they are equal to zero,
Xand ``TRUE'' if they are non-zero. Arbitrary text strings will have the
Xvalue of ``FALSE''. 
X
X.ev 0
X
X
X A list of the currently available functions follows: (Once
Xagain, send in those votes on what kind of functions you would like to
Xsee added!) Functions are always used in lower case, the uppercase
Xletters in the function table are the short form of the function (IE
X&div for &divide).
X
X.nf
X.ft CW
X
XNumeric Functions:	(returns <num>)
X
X&ADD		<num> <num>	Add two numbers
X&SUB		<num> <num>	Subtract the second number from the first
X&TIMes		<num> <num>	Multiply two numbers
X&DIVide 	<num> <num>	Divide the first number by the second
X				giving an integer result
X&MOD		<num> <num>	Return the reminder of dividing the
X				first number by the second
X&NEGate 	<neg>		Multiply the arg by -1
X&LENgth 	<str>		Returns length of string
X&SINdex 	<str1> <str2>	Finds the position of <str2> within
X				<str1>. Returns zero if not found.
X&ASCii		<str>		Return the ascii code of the first
X				character in <str>
X&RND		<num>		Returns a random integer between 1 and <num>
X&ABS		<num>		Returns the absolute value of <num>
X&BANd		<num> <num>	Bitwise AND function
X&BOR		<num> <num>	Bitwise OR function
X&BXOr		<num> <num>	Bitwise XOR function
X&BNOt		<num>		Bitwise NOT function
X
XString manipulation functions:	(returns <str>)
X
X&CAT		<str> <str>	Concatenate the two strings to form one
X&LEFt		<str> <num>	return the <num> leftmost characters
X				from <str>
X&RIGht		<str> <num>	return the <num> rightmost characters
X				from <str>
X&MID		<str> <num1> <num2>
X				Starting from <num1> position in <str>,
X				return <num2> characters.
X&UPPer		<str>		Uppercase <str>
X&LOWer		<str>		lowercase <str>
X&CHR		<num>		return a string with the character
X				represented by ascii code <num>
X&GTC				returns a string of characters
X				containing a EMACS command input from
X				the user
X&GTK				return a string containing a single
X				keystroke from the user
X&ENV		<str>		If the operating system is capable, this
X				returns the environment string associated
X				with <str>
X&BIND		<str>		return the function name bound to the
X				keystroke <str>
X&XLATE		<str1> <str2> <str3>
X&FINd		<str>		Find the named file <str> along the
X				path and return its full file specification
X				or an empty string if none exists
X&TRIM		<str>		Trim the trailing whitespace from a string
X
XLogical Testing functions:	(returns <log>)
X
X&NOT		<log>		Return the opposite logical value
X&AND		<log1> <log2>	Returns TRUE if BOTH logical arguments
X				are TRUE
X&OR		<log1> <log2>	Returns TRUE if either argument
X				is TRUE
X&EQUal		<num> <num>	If <num> and <num> are numerically
X				equal, return TRUE
X&LESs		<num1> <num2>	If <num1> is less than <num2>, return
X				TRUE.
X&GREater	<num1> <num2>	If <num1> is greater than, or equal to
X				<num2>, return TRUE.
X&SEQual 	<str1> <str2>	If the two strings are the same, return
X				TRUE.
X&SLEss		<str1> <str2>	If <str1> is less alphabetically than
X				<str2>, return TRUE.
X&SGReater	<str1> <str2>	If <str1> is alphabetically greater than
X				or equal to <str2>, return TRUE.
X&EXIst		<str>		Does the named file <str> exist?
X
XSpecial Functions:
X
X&INDirect	<str>		Evaluate <str> as a variable.\fR
X.fi
X
X\fB
X
X This last function deserves more explanation. The &IND function
Xevaluates its argument, takes the resulting string, and then uses it as
Xa variable name. For example, given the following code sequence:
X
X.nf
X.ft CW
X
X	; set up reference table
X
X	set %one	"elephant"
X	set %two	"giraffe"
X	set %three	"donkey"
X
X	set %index "two"
X	insert-string &ind %index\fR
X.fi
X
X\fB
X
X the string ``giraffe'' would have been inserted at the point in
Xthe current buffer. This indirection can be safely nested up to about
X10 levels.
X
X.br
X.ne 1.0i
X.sp 2
X.SE "\fBDirectives\fB"
X
X
X Directives are commands which only operate within an executing
Xmacro, IE they do not make sense as a single command. As such, they
Xcannot be called up singly or bound to keystroke. Used within macros,
Xthey control what lines are executed and in what order.
X
X Directives always start with the exclamation mark (!) character
Xand must be the first thing placed on a line. Directives executed
Xinteractively (via the execute-command-line command) will be ignored. 
X
X.ne 1.0i
X.sp 2
X.SS "\fB!ENDM Directive\fB"
X
X
X This directive is used to terminate a macro being stored. For
Xexample, if a file is being executed contains the text:
X
X.nf
X.ft CW
X
X	;	Read in a file in view mode, and make the window red
X
X	26	store-macro
X		find-file @"File to view: "
X		add-mode "view"
X		add-mode "red"
X	!endm
X
X	write-message "[Consult macro has been loaded]"\fR
X.fi
X
X\fB
X
X only the lines between the store-macro command and the !ENDM
Xdirective are stored in macro 26. Both numbered macroes and named
Xprocedures (via the \fIstore-procedure command) should be terminated with
Xthis directive.
X
X.ne 1.0i
X.sp 2
X.SS "\fB!FORCE Directive\fB"
X
X
X When MicroEMACS executes a macro, if any command fails, the
Xmacro is terminated at that point. If a line is preceded by a !FORCE
Xdirective, execution continues whether the command succeeds or not. For
Xexample:
X
X.nf
X.ft CW
X
X	;	Merge the top two windows
X
X	save-window		;remember what window we are at
X	1 next-window		;go to the top window
X	delete-window		;merge it with the second window
X	!force restore-window	;This will continue regardless
X	add-mode "red"\fR
X.fi
X
X\fB

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

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