mmee -- Command

MicroEMACS screen editor
mmee [-ee _e_r_r_o_r_f_i_l_e] [-ff _b_i_n_d_f_i_l_e] [_t_e_x_t_f_i_l_e ...]

mmee is  the command  for MicroEMACS, the  screen editor for  COHERENT.  With
MicroEMACS,  you can  insert text,  delete  text, move  text, search  for a
string and  replace it, and  perform many other  editing tasks.  MicroEMACS
reads text from files and writes  edited text to files; it can edit several
files simultaneously, while displaying the contents of each file in its own
screen window.

_S_c_r_e_e_n _L_a_y_o_u_t
Before you can use MicroEMACS, you must set the environmental variable TTEERRMM
in your  environment.  If you do  not set this variable  explicitly in your
.pprrooffiillee file, COHERENT sets it by default to aannssiippcc. See the Lexicon entry
TTEERRMM for details.

If  the command  mmee is  used without arguments,  MicroEMACS opens  an empty
buffer.  If used with one or more file name arguments, MicroEMACS will open
each of the  files named, and display its contents  in a window.  If a file
cannot be  found, MicroEMACS will assume  that you are creating  it for the
first time,  and create an  appropriately named buffer  and file descriptor
for it.

The last line  of the screen is used to  print messages and inquiries.  The
rest of the  screen is portioned into one or  more _w_i_n_d_o_w_s in which text is
displayed.  The  last line of each  window shows whether the  text has been
changed, the name  of the buffer, and the name  of the file associated with
the window.

MicroEMACS notes its _c_u_r_r_e_n_t _p_o_s_i_t_i_o_n. It is important to remember that the
current position is always to the  _l_e_f_t of the cursor, and lies _b_e_t_w_e_e_n two
letters, rather than at one letter  or another.  For example, if the cursor
is positioned at  the letter `k' of the phrase  ``Mark Williams'', then the
current position lies _b_e_t_w_e_e_n the letters `r' and `k'.

_C_o_m_m_a_n_d_s _a_n_d _T_e_x_t
The printable  ASCII characters, from  ` ' to  `~', can be  inserted at the
current position.   Control characters and escape  sequences are recognized
as _c_o_m_m_a_n_d_s, described below.  A control character can be inserted into the
text by  prefixing it with <ccttrrll-QQ>  (that is, hold down  the <ccoonnttrrooll> key
and type the letter `Q').

There are  two types  of commands to  remove text.  _D_e_l_e_t_e  commands remove
text and  throw it away, whereas  _k_i_l_l commands remove text  but save it in
the _k_i_l_l _b_u_f_f_e_r. Successive kill  commands append text to the previous kill
buffer.   Moving the  cursor before  you kill  a line  will empty  the kill
buffer, and write the line just killed into it.

Search commands prompt for a  search string terminated by <rreettuurrnn> and then
search  for it.   Case sensitivity  for searching can  be toggled  with the
command <eesscc>@. Typing <rreettuurrnn> instead of a search string tells MicroEMACS
to use the previous search string.

Some commands manipulate  words rather than characters.  MicroEMACS defines
a  word as  consisting  of all  alphabetic  characters, plus  `_' and  `$'.
Usually, a  character command is a control  character and the corresponding
word command  is an escape  sequence.  For example,  <ccttrrll-FF> moves forward
one character and <eesscc>FF moves forward one word.

MicroEMACS  can handle  blocks of  text as  well as  individual characters,
words, and lines.  MicroEMACS defines a  block of text as all the text that
lies between the _m_a_r_k and the current position of the cursor.  For example,
typing <ccttrrll-WW> kills all text from the mark to the current position of the
cursor; this is useful when moving text from one file to another.  When you
invoke MicroEMACS,  the mark is set  at the beginning of  the file; you can
reset the mark to the cursor's current position by typing <ccttrrll-@>.

_U_s_i_n_g _M_i_c_r_o_E_M_A_C_S _w_i_t_h _t_h_e _C_o_m_p_i_l_e_r
MicroEMACS can be invoked automatically  by the compiler command cccc to help
you repair all  errors that occur during compilation.  The  -AA option to cccc
causes MicroEMACS  to be invoked  automatically when an  error occurs.  The
compiler error messages are displayed in one window, the source code in the
other, and  the cursor is  at the line  on which the  first error occurred.
You can  correct the errors one  by one.  To move to the  next error in the
list, type <ccttrrll-XX>>; to move the previous error, type <ccttrrll-XX><.

When  have finished  making  corrections, exit  from  MicroEMACS by  typing
<ccttrrll-ZZ>, as  usual; the compiler  will automatically be  re-invoked to re-
compile the  corrected source code.   If more errors  are found, MicroEMACS
will be re-invoked  with the new list of errors.   This cycle will continue
either until the file compiles without  error, or until you break the cycle
by typing <ccttrrll-UU> <ccttrrll-XX> <ccttrrll-CC>.

The option  -ee to the mmee  command allows you to invoke  the error buffer by
hand.  For example, the commands

    cc myprogram.c 2>errorfile
    me -e errorfile myprogram.c

divert  the compiler's  error  messages into  eerrrroorrffiillee,  and then  invokes
MicroEMACS to let you correct them interactively.

_T_h_e _M_i_c_r_o_E_M_A_C_S _H_e_l_p _F_a_c_i_l_i_t_y
MicroEMACS  has  a  built-in help  facility.   With  it,  you  can ask  for
information either  for a word that  you type in, or for  a word over which
the cursor  is positioned.  The MicroEMACS help  file contains the bindings
for all library functions and macros included with COHERENT.

For example,  consider that  you are  preparing a C  program and  want more
information about the function ffooppeenn. Type <ccttrrll-XX>?.  At the bottom of the
screen will appear the prompt

    Topic:

Type  ffooppeenn.  MicroEMACS  will search  its  help file,  find its  entry for
ffooppeenn, then open a window and print the following:

    Open a stream for standard I/O
    #include <stdio.h>
    FILE *fopen (name, type) char *name, *type;

If you  wish, you can kill  the information in the help  window and copy it
into your program, to ensure that you prepare the function call correctly.

Consider, however, that you are checking a program written earlier, and you
wish to check  the call for a call to  ffooppeenn.  Simply move the cursor until
it  is positioned  over one  of  the letters  in ffooppeenn,  then type  <eesscc>?.
MicroEMACS will open its help window,  and show the same information it did
above.

To erase the help window, type <ccttrrll-XX>11.

_O_p_t_i_o_n_s
The  following list  gives the  MicroEMACS commands.   They are  grouped by
function, e.g.,  _M_o_v_i_n_g _t_h_e  _c_u_r_s_o_r.  Some  commands can take  an _a_r_g_u_m_e_n_t,
which  specifies how  often the  command  is to  be executed.   The default
argument is  1.  The command <ccttrrll-UU> introduces  an argument.  By default,
it sets  the argument to four.   Typing <ccttrrll-UU> followed by  a number sets
the  argument to  that number.   Typing  <ccttrrll-UU> followed  by one  or more
<ccttrrll-UU>s multiplies the argument by four.

_M_o_v_i_n_g _t_h_e _C_u_r_s_o_r

<ccttrrll-AA>
        Move to start of line.

<ccttrrll-BB>
        (Back) Move backward by characters.

<eesscc>BB  Move backward by words.

<ccttrrll-EE>
        (End) Move to end of line.

<ccttrrll-FF>
        (Forward) Move forward by characters.

<eesscc>FF  (Forward) Move forward by words.

<eesscc>GG  Go to an absolute line number in a file.  Same as <ccttrrll-XX>GG.

<ccttrrll-NN>
        (Next) Move to next line.

<ccttrrll-PP>
        (Previous) Move to previous line.

<ccttrrll-VV>
        Move forward by pages.

<eesscc>VV  Move backward by pages.

<ccttrrll-XX>=
        Print the current position.

<ccttrrll-XX>GG
        Go  to an  absolute line  number in  a file.  Can  be used  with an
        argument; otherwise,  it will  prompt for  a line number.   Same as
        <eesscc>GG.

<ccttrrll-XX>[
        Go  to  matching  C  delimiter.   For  example, if  the  cursor  is
        positioned under the character `{', then typing <ccttrrll-XX>[ moves the
        cursor  to the  next `}'.   Likewise, if  the cursor  is positioned
        under the  character }, then  typing <ccttrrll-XX>[ moves  the cursor to
        the first  preceding `{'.  MicroEMACS recognizes  the delimiters [,
        ], {, }, (, ), /*, and */.

<ccttrrll-XX>]
        Toggle  reverse-video  display   of  matching  C  delimiters.   For
        example, if  reverse-video displaying is toggled  on, then whenever
        the cursor is positioned  under a `}' MicroEMACS displays the first
        preceding  '{'  in reverse  video  (should it  be  on the  screen).
        MicroEMACS recognizes the delimiters [, ], {, }, (, ), /*, and */.

<eesscc>!  Move  the current  line  to the  line  within the  window given  by
        _a_r_g_u_m_e_n_t; the  position is  in lines from  the top if  positive, in
        lines from the bottom if negative,  and the center of the window if
        zero.

<eesscc><  Move to the beginning of the current buffer.

<eesscc>>  Move to the end of the current buffer.

_K_i_l_l_i_n_g _a_n_d _D_e_l_e_t_i_n_g

<ccttrrll-DD>
        (Delete) Delete next character.

<eesscc>DD  Kill the next word.

<ccttrrll-HH>
        If  no  argument,   delete  previous  character.   Otherwise,  kill
        _a_r_g_u_m_e_n_t previous characters.

<ccttrrll-KK>
        (Kill) With no argument, kill from current position to end of line;
        if at  the end, kill the  newline.  With argument set  to one, kill
        from  beginning  of  line  to  current position.   Otherwise,  kill
        _a_r_g_u_m_e_n_t lines forward (if positive) or backward (if negative).

<ccttrrll-WW>
        Kill text from current position to mark.

<ccttrrll-XX><ccttrrll-OO>
        Kill blank lines at current position.

<ccttrrll-YY>
        (Yank back) Copy the kill buffer into text at the current position;
        set current position to the end of the new text.

<eesscc><ccttrrll-HH>
        Kill the previous word.

<eesscc><DDEELL>
        Kill the previous word.

<DDEELL>   If  no argument,  delete the  previous character.   Otherwise, kill
        _a_r_g_u_m_e_n_t previous characters.

_W_i_n_d_o_w_s

<ccttrrll-XX>11
        Display only the current window.

<ccttrrll-XX>22
        Split the current window into two windows.  This command is usually
        followed by <ccttrrll-XX>BB or <ccttrrll-XX><ccttrrll-VV>.

<ccttrrll-XX>NN
        (Next) Move to next window.

<ccttrrll-XX>PP
        (Previous) Move to previous window.

<ccttrrll-XX>ZZ
        Enlarge the current window by _a_r_g_u_m_e_n_t lines.

<ccttrrll-XX><ccttrrll-NN>
        Move text in current window down by _a_r_g_u_m_e_n_t lines.

<ccttrrll-XX><ccttrrll-PP>
        Move text in current window up by _a_r_g_u_m_e_n_t lines.

<ccttrrll-XX><ccttrrll-ZZ>
        Shrink current window by _a_r_g_u_m_e_n_t lines.

_B_u_f_f_e_r_s

<ccttrrll-XX>BB
        (Buffer) Prompt  for a buffer  name, and display the  buffer in the
        current window.

<ccttrrll-XX>KK
        (Kill) Prompt for a buffer name and delete it.

<ccttrrll-XX><ccttrrll-BB>
        Display a  window showing the  change flag, size,  buffer name, and
        file name of each buffer.

<ccttrrll-XX><ccttrrll-FF>
        (File name) Prompt for a file name for current buffer.

<ccttrrll-XX><ccttrrll-RR>
        (Read) Prompt for a file  name, delete current buffer, and read the
        file.

<ccttrrll-XX><ccttrrll-VV>
        (Visit) Prompt for a file name  and display the file in the current
        window.

_S_a_v_i_n_g _T_e_x_t _a_n_d _E_x_i_t_i_n_g

<ccttrrll-XX><ccttrrll-CC>
        Exit without saving text.

<ccttrrll-XX><ccttrrll-SS>
        (Save) Save current buffer to the associated file.

<ccttrrll-XX><ccttrrll-WW>
        (Write) Prompt for a file name and write the current buffer to it.

<ccttrrll-ZZ>
        Save current buffer to associated file and exit.

_C_o_m_p_i_l_a_t_i_o_n _E_r_r_o_r _H_a_n_d_l_i_n_g

<ccttrrll-XX>>
        Move to next error.

<ccttrrll-XX><
        Move to previous error.

_S_e_a_r_c_h _a_n_d _R_e_p_l_a_c_e

<ccttrrll-RR>
        (Reverse) Incremental search  backward; a pattern is sought as each
        character is typed.

<eesscc>RR  (Reverse)  Search toward  the  beginning of  the  file.  Waits  for
        entire pattern before search begins.

<ccttrrll-SS>
        (Search)  Incremental  search forward; a pattern  is sought as each
        character is typed.

<eesscc>SS  (Search)  Search toward  the  end of  the file.   Waits for  entire
        pattern before search begins.

<eesscc>%  Search and  replace.  Prompt for  two strings; then  search for the
        first string and replace it with the second.

<eesscc>/  Search for  next occurrence of a string entered  with the <eesscc>SS or
        <eesscc>RR  commands; this  remembers whether  the previous  search had
        been forward or backward.

<eesscc>@  Toggle  case sensitivity  for searches.   By default,  searches are
        case insensitive.

_K_e_y_b_o_a_r_d _M_a_c_r_o_s

<ccttrrll-XX>(
        Begin  a macro  definition.  MicroEMACS  collects  everything typed
        until the next <ccttrrll-XX>) for subsequent repeated execution.  <ccttrrll-
        GG> breaks the definition.

<ccttrrll-XX>)
        End a macro definition.

<ccttrrll-XX>EE
        (Execute) Execute the keyboard macro.

<ccttrrll-XX>MM
        Bind a newly created keyboard macro  to a given keystroke or set of
        keystrokes.

_F_l_e_x_i_b_l_e _K_e_y _B_i_n_d_i_n_g_s

<ccttrrll-XX>RR
        Replace one binding with another.

<ccttrrll-XX>XX
        Rebind  the  prefix (meta)  keys,  and  the multiple-execution  key
        <ccttrrll-UU>.

<ccttrrll-XX>SS
        Prompt  for a  file name,  and write  all flexible  keybindings and
        macros into it.  This  command also saves information about how you
        have configured MicroEMACS;  for example, it notes whether you have
        turned on word-wrapping.

<ccttrrll-XX>LL
        Prompt  for a  file  name, and  read all  flexible keybindings  and
        macros from it.

<ccttrrll-XX>II
        Rebind current macro to the initialization macro.

By default, MicroEMACS checks for the existence of file $HHOOMMEE/.eemmaaccss.rrcc and
executes it if found.  The -ff  option lets you specify an alternate file of
keybindings  macros from  the  mmee command  line.  After  loading the  file,
MicroEMACS  then executes  the initialization  macro,  if one  exists.  For
example, to load the keybindings  file bbiinnddiinnggss and edit file tteexxttffiillee, use
the command:

    me -f bindings textfile

_C_h_a_n_g_e _C_a_s_e _o_f _T_e_x_t

<eesscc>CC  (Capitalize) Capitalize the next word.

<ccttrrll-XX><ccttrrll-LL>
        (Lower) Convert  all text from current position  to mark into lower
        case.

<eesscc>LL  (Lower) Convert the next word to lower case.

<ccttrrll-XX><ccttrrll-UU>
        (Upper) Convert  all text from current position  to mark into upper
        case.

<eesscc>UU  (Upper) Convert the next word to upper case.

_W_h_i_t_e _S_p_a_c_e

<ccttrrll-II>
        Insert  a tab.   Default  behavior is  to  move the  cursor to  the
        nearest 8's  boundary; for  example, if the  cursor is in  the 62nd
        column on the screen, pressing <ccttrrll-II> moves it to column 64.

        When used with a positive  argument, change the behavior of the tab
        key.  For example,  <ccttrrll-UU>44<ccttrrll-II> commands MicroEMACS to insert
        enough spaces for a tab key to reach a four's boundary.

        When used with a negative  argument, change the behavior of the tab
        character.   For  example,   <ccttrrll-UU>-44<ccttrrll-II>  says  that  a  tab
        character  on a  file will  take you to  the nearest  4's boundary.
        Thus, if  you have  a file with  tabs in it  and you use  `-4', the
        appearance of  the file on the  screen will change; but  if you use
        `4' the appearance of the file on the screen will not change.

        To change the default size of a tab, set the environmental variable
        TTAABBSSIIZZEE to a value other than eight.

<ccttrrll-JJ>
        Insert a new line and indent  to current level.  This is often used
        in C programs to preserve the current level of indentation.

<ccttrrll-MM>
        (Return) If the following line is  not empty, insert a new line; if
        empty, move to next line.

<ccttrrll-OO>
        Open  a  blank line;  that  is, insert  newline  after the  current
        position.

<ttaabb>   With  argument, set  tab fields at  every _a_r_g_u_m_e_n_t  characters.  An
        argument of zero restores the default of eight characters.  Setting
        the tab  to any character other than  eight causes space characters
        to be set in your file instead of tab characters.

_S_e_n_d _C_o_m_m_a_n_d_s _t_o _O_p_e_r_a_t_i_n_g _S_y_s_t_e_m

<ccttrrll-CC>
        Suspend MicroEMACS and execute a subshell.  Typing <ccttrrll-DD> returns
        you to MicroEMACS and allows you to resume editing.

<ccttrrll-XX>!
        Prompt for a shell command and execute it.

These commands recognize the shell variable SSHHEELLLL to determine the shell to
which it should pass the command.

_S_e_t_t_i_n_g _t_h_e _M_a_r_k

<ccttrrll-@>
        Set mark at current position.

<eesscc>.  Set mark at current position.

_H_e_l_p _W_i_n_d_o_w

<ccttrrll-XX>?
        Prompt for word for which information is needed.

<eesscc>?  Search for word over which cursor is positioned.

<eesscc>22  Erase help window.

_M_i_s_c_e_l_l_a_n_e_o_u_s

<ccttrrll-GG>
        Abort a command.

<ccttrrll-LL>
        Redraw the screen.

<ccttrrll-QQ>
        (Quote) Insert the next character into text; used to insert control
        characters.

<eesscc>QQ  Quote a  character by numeric  value.  When you  type this command,
        MicroEMACS prompts  you for a  numeric value, in  decimal.  It then
        inserts into  your text the  character whose value  you type.  This
        command is  useful when you wish to enter  characters with the high
        bit set.

<ccttrrll-TT>
        Transpose the characters before and after the current position.

<ccttrrll-UU>
        Specify a numeric argument, as described above.

<ccttrrll-UU><ccttrrll-XX><ccttrrll-CC>
        Abort  editing  and  re-compilation.   Use  this command  to  abort
        editing and return to COHERENT when  you are using the -AA option to
        the cccc command.

<ccttrrll-XX>HH
        Use word-wrap on a region.

<ccttrrll-XX>FF
        Set word  wrap to  _a_r_g_u_m_e_n_t column.  If  argument is one,  set word
        wrap to cursor's current position.

<ccttrrll-XX><ccttrrll-XX>
        Mark the current position, then jump to the previous setting of the
        mark.  This is useful when moving  text from one place in a file to
        another.

_D_i_a_g_n_o_s_t_i_c_s
MicroEMACS  prints error  messages on  the bottom line  of the  screen.  It
prints informational  messages (enclosed in square brackets  `[' and `]' to
distinguish them from error messages) in the same place.

MicroEMACS manipulates text  in memory rather than in a  file.  The file on
disk is  not changed until you  save the edited text.   MicroEMACS prints a
warning and prompts  you whenever a command would cause  it to lose changed
text.

_S_e_e _A_l_s_o
ccoommmmaannddss, eedd, eellvviiss, eexx, sseedd, TTEERRMM, vvii

_N_o_t_e_s
Because MicroEMACS  keeps text  in memory, it  does not work  for extremely
large files.   It prints an error  message if a file is  too large to edit.
If this  happens when  you first  invoke a file,  you should exit  from the
editor immediately.   Otherwise, your file  on disk will  be truncated.  If
this  happens in  the middle  of an editing  session, however,  delete text
until the message disappears, then save your file and exit.  Due to the way
MicroEMACS works, saving a file  after this error message has appeared will
take more time than usual.

The source  code for MicroEMACS is  included with COHERENT, and  is kept in
directory /uussrr/ssrrcc/llooccaall.  You are invited to  experiment with source code,
to modify existing features or add new ones for your own use.

MicroEMACS is based upon the public domain editor by David G. Conroy.
