\begindata{text,268694064}
\textdsversion{12}
\template{help}


\chapter{\center{Mtext: An editing package for

Modula-2 Programmers}}


\section{What Mtext is 

}\leftindent{
Mtext is an editing package for Modula-2 programmers.  It provides an editing 
interface similar to that used for text files in EZ, but shows the text of 
Modula programs in a fixed-width font.  Mtext provides keybindings and menu 
features to support indentation of Modula program code and uses styles 
specified in the mtext template.


An interactive diff package called ezdiff is available for comparing your 
Mtext files.  See the \italic{ez-diff}  help document for details.

}
\section{Starting Mtext}

\leftindent{
At the Typescript prompt, type "ez \italic{file}.m" or "ez\italic{ file}.mod" 
and press Enter.  Use of a .m or .mod extension tells EZ to load the mtext 
editing package, according to specifications in the global initialization file 
for EZ.  


If you create your own .ezinit file, you can override the global.ezinit file 
or add other file extensions that will load the mtext package.  You can also 
set various parameters of mtext, which are listed in the section below, 
"Customizing Mtext in your .ezinit file."  For details about initialization 
files, see the \italic{initfiles} help document.

}
\section{How Mtext works}

\leftindent{
When a mtext dataobject (usually a normal Modula source file) is read in, a 
set of styles are superimposed on it for the convenience of the programmer. 
 Comments are put in italic and Modula keywords are put in bold.  None of the 
styles are actually written out with the code--they exist only during editing. 
  Modula keywords are automatically capitalized.


Mtext adds these keybindings to those provided by EZ:


\bold{The tab key.} Tab has three uses:

\leftindent{
1) If there is a selected region, all the lines within that region will be 
re-indented to what mtext considers the "correct" indentation.  


2) If there is no selected region and the text caret is positioned before any 
text on the current line (within the initial whitespace), then the line will 
be re-indented as above. 


3) If the text caret is positioned after some non-whitespace text on the line, 
it will insert enough whitespace to move to the caret to the next tab column. 
 Tab columns are positioned at multiples of four.  Any existing whitespace at 
the caret position will be counted as if it were inserted (so the tab key will 
skip over whitespace to the next tab column if it is sitting on whitespace). }


\bold{The Linefeed (^J) key.}   Linefeed does two things:  


\leftindent{1) It re-indents the current line, just in case it needs to be 
fixed up (since sometimes the indentation after typing something is different 
than without it, i.e., else). 


2) It inserts a newline, and then inserts the correct indentation for the new 
line (moving the caret to that point).  }


\bold{Note:} When the mtext package inserts whitespace, it automatically 
inserts the correct combination of tab and space characters, replacing spaces 
by tabs when possible without changing the look of the line.  (This applies 
unless the mtext-use-tabs parameter is set to 0.  See below.)}


\section{Pop-up Menu Meanings}

\leftindent{
In addition to the regular EZ menu options, Mtext supplies a fourth menu, the 
Modula-2 Text menu.  It contains two options:

\leftindent{
\bold{Redo M-2 Styles:}  Invokes the "Redo M-2 Styles" function which will 
redo the styles in the mtext dataobject that is displayed. 


\bold{Indent line/region:}  Equivalent to pressing the tab key.

 }}\section{

Customizing Mtext in your .ezinit file}

\leftindent{
Mtext has several parameters controlling its behavior which you can set in 
your own .ezinit file.  They are listed in bold with the default setting in 
italic:  


\leftindent{\bold{mtext-brace-indent  \italic{0} }

Controls indentation of braces at the start of a line.


\bold{mtext-use-tabs\italic{  1}}

If 0, don't use tabs for whitespace.


\bold{mtext-cont-indent  }\italic{\bold{4}}    

Controls indentation of continued single statements.


\bold{\bold{mtext-level-indent}  \italic{4}}  

Controls indentation of nested block statements.


\bold{\bold{mtext-case-level-indent}}\bold{ \italic{8}}  

Controls indentation of statements within a case statement.}


You should put each of the parameters you want to change at the end of each 
addfiletype to which it applies.  For example:


\typewriter{\smaller{addfiletype .m mtext 
"mtext-level-indent=2;mtext-use-tabs=0"}}}


\section{Related Tools}


Select (highlight) one of the italicized names and choose "Show Help on 
Selected Word" from the pop-up menu to see the help file for:


\leftindent{\italic{ctext}}

\leftindent{\italic{ltext}}

\leftindent{\italic{ptext}}

\leftindent{\italic{ez

ez-diff       }  (An interactive diff package for EZ)

\italic{initfiles}}

\enddata{text,268694064}
