COHERENT manpages

This page displays the COHERENT manpage for me [MicroEMACS screen editor].

List of available manpages
Index


me -- Command

MicroEMACS screen editor
me [-e errorfile] [-f bindfile] [textfile ...]

me 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.

Screen Layout

Before you can use MicroEMACS, you must set the environmental variable TERM
in your  environment.  If you do  not set this variable  explicitly in your
.profile file, COHERENT sets it by default to ansipc. See the Lexicon entry
TERM for details.

If  the command  me 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 windows 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 current position. It is important to remember that the
current position is always to the  left of the cursor, and lies between 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 between the letters `r' and `k'.

Commands and Text

The printable  ASCII characters, from  ` ' to  `~', can be  inserted at the
current position.   Control characters and escape  sequences are recognized
as commands, described below.  A control character can be inserted into the
text  by  prefixing  it   with  <ctrl-Q>  (that  is,  hold  down  the
<control> key and type the letter `Q').

There are  two types  of commands to  remove text.  Delete  commands remove
text and  throw it away, whereas  kill commands remove text  but save it in
the kill buffer. 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 <return> and
then search for it.  Case sensitivity for searching can be toggled with the
command  <esc>@. Typing  <return>  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,  <ctrl-F> moves
forward one character and <esc>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 mark and the current position of the cursor.  For example,
typing <ctrl-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 <ctrl-
@>.

Using MicroEMACS with the Compiler

MicroEMACS can be invoked automatically  by the compiler command cc to help
you repair all  errors that occur during compilation.  The  -A option to cc
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  <ctrl-X>>; to move the  previous error, type <ctrl-
X><.

When  have finished  making  corrections, exit  from  MicroEMACS by  typing
<ctrl-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 <ctrl-U> <ctrl-X> <ctrl-C>.

The option  -e to the me  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  errorfile,  and then  invokes
MicroEMACS to let you correct them interactively.

The MicroEMACS Help Facility

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 fopen. Type <ctrl-X>?.  At the bottom
of the screen will appear the prompt

    Topic:

Type  fopen.  MicroEMACS  will search  its  help file,  find its  entry for
fopen, 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  fopen.  Simply move the cursor until
it is positioned over one of  the letters in fopen, then type <esc>?.
MicroEMACS will open its help window,  and show the same information it did
above.

To erase the help window, type <ctrl-X>1.

Options

The  following list  gives the  MicroEMACS commands.   They are  grouped by
function, e.g.,  Moving the  cursor.  Some  commands can take  an argument,
which  specifies how  often the  command  is to  be executed.   The default
argument  is 1.   The command  <ctrl-U>  introduces an  argument.  By
default, it sets the argument to four.  Typing <ctrl-U> followed by a
number sets the argument to that number.  Typing <ctrl-U> followed by
one or more <ctrl-U>s multiplies the argument by four.

Moving the Cursor


<ctrl-A>
        Move to start of line.

<ctrl-B>
        (Back) Move backward by characters.

<esc>B
        Move backward by words.

<ctrl-E>
        (End) Move to end of line.

<ctrl-F>
        (Forward) Move forward by characters.

<esc>F
        (Forward) Move forward by words.

<esc>G
        Go to an absolute line number in a file.  Same as <ctrl-X>G.

<ctrl-N>
        (Next) Move to next line.

<ctrl-P>
        (Previous) Move to previous line.

<ctrl-V>
        Move forward by pages.

<esc>V
        Move backward by pages.

<ctrl-X>=
        Print the current position.

<ctrl-X>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
        <esc>G.

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

<ctrl-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 */.

<esc>!
        Move  the current  line  to the  line  within the  window given  by
        argument; 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.

<esc><
        Move to the beginning of the current buffer.

<esc>>
        Move to the end of the current buffer.

Killing and Deleting


<ctrl-D>
        (Delete) Delete next character.

<esc>D
        Kill the next word.

<ctrl-H>
        If  no  argument,   delete  previous  character.   Otherwise,  kill
        argument previous characters.

<ctrl-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
        argument lines forward (if positive) or backward (if negative).

<ctrl-W>
        Kill text from current position to mark.

<ctrl-X><ctrl-O>
        Kill blank lines at current position.

<ctrl-Y>
        (Yank back) Copy the kill buffer into text at the current position;
        set current position to the end of the new text.

<esc><ctrl-H>
        Kill the previous word.

<esc><DEL>
        Kill the previous word.

<DEL>
        If  no argument,  delete the  previous character.   Otherwise, kill
        argument previous characters.

Windows


<ctrl-X>1
        Display only the current window.

<ctrl-X>2
        Split the current window into two windows.  This command is usually
        followed by <ctrl-X>B or <ctrl-X><ctrl-V>.

<ctrl-X>N
        (Next) Move to next window.

<ctrl-X>P
        (Previous) Move to previous window.

<ctrl-X>Z
        Enlarge the current window by argument lines.

<ctrl-X><ctrl-N>
        Move text in current window down by argument lines.

<ctrl-X><ctrl-P>
        Move text in current window up by argument lines.

<ctrl-X><ctrl-Z>
        Shrink current window by argument lines.

Buffers


<ctrl-X>B
        (Buffer) Prompt  for a buffer  name, and display the  buffer in the
        current window.

<ctrl-X>K
        (Kill) Prompt for a buffer name and delete it.

<ctrl-X><ctrl-B>
        Display a  window showing the  change flag, size,  buffer name, and
        file name of each buffer.

<ctrl-X><ctrl-F>
        (File name) Prompt for a file name for current buffer.

<ctrl-X><ctrl-R>
        (Read) Prompt for a file  name, delete current buffer, and read the
        file.

<ctrl-X><ctrl-V>
        (Visit) Prompt for a file name  and display the file in the current
        window.

Saving Text and Exiting


<ctrl-X><ctrl-C>
        Exit without saving text.

<ctrl-X><ctrl-S>
        (Save) Save current buffer to the associated file.

<ctrl-X><ctrl-W>
        (Write) Prompt for a file name and write the current buffer to it.

<ctrl-Z>
        Save current buffer to associated file and exit.

Compilation Error Handling


<ctrl-X>>
        Move to next error.

<ctrl-X><
        Move to previous error.

Search and Replace


<ctrl-R>
        (Reverse) Incremental search  backward; a pattern is sought as each
        character is typed.

<esc>R
        (Reverse)  Search toward  the  beginning of  the  file.  Waits  for
        entire pattern before search begins.

<ctrl-S>
        (Search)  Incremental  search forward; a pattern  is sought as each
        character is typed.

<esc>S
        (Search)  Search toward  the  end of  the file.   Waits for  entire
        pattern before search begins.

<esc>%
        Search and  replace.  Prompt for  two strings; then  search for the
        first string and replace it with the second.

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

<esc>@
        Toggle  case sensitivity  for searches.   By default,  searches are
        case insensitive.

Keyboard Macros


<ctrl-X>(
        Begin  a macro  definition.  MicroEMACS  collects  everything typed
        until the  next <ctrl-X>) for  subsequent repeated execution.
        <ctrl-G> breaks the definition.

<ctrl-X>)
        End a macro definition.

<ctrl-X>E
        (Execute) Execute the keyboard macro.

<ctrl-X>M
        Bind a newly created keyboard macro  to a given keystroke or set of
        keystrokes.

Flexible Key Bindings


<ctrl-X>R
        Replace one binding with another.

<ctrl-X>X
        Rebind  the  prefix (meta)  keys,  and  the multiple-execution  key
        <ctrl-U>.

<ctrl-X>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.

<ctrl-X>L
        Prompt  for a  file  name, and  read all  flexible keybindings  and
        macros from it.

<ctrl-X>I
        Rebind current macro to the initialization macro.

By default, MicroEMACS checks for the existence of file $HOME/.emacs.rc and
executes it if found.  The -f  option lets you specify an alternate file of
keybindings  macros from  the  me command  line.  After  loading the  file,
MicroEMACS  then executes  the initialization  macro,  if one  exists.  For
example, to load the keybindings  file bindings and edit file textfile, use
the command:

    me -f bindings textfile

Change Case of Text


<esc>C
        (Capitalize) Capitalize the next word.

<ctrl-X><ctrl-L>
        (Lower) Convert  all text from current position  to mark into lower
        case.

<esc>L
        (Lower) Convert the next word to lower case.

<ctrl-X><ctrl-U>
        (Upper) Convert  all text from current position  to mark into upper
        case.

<esc>U
        (Upper) Convert the next word to upper case.

White Space


<ctrl-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  <ctrl-I> moves it  to column
        64.

        When used with a positive  argument, change the behavior of the tab
        key.     For   example,    <ctrl-U>4<ctrl-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, <ctrl-U>-4<ctrl-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
        TABSIZE to a value other than eight.

<ctrl-J>
        Insert a new line and indent  to current level.  This is often used
        in C programs to preserve the current level of indentation.

<ctrl-M>
        (Return) If the following line is  not empty, insert a new line; if
        empty, move to next line.

<ctrl-O>
        Open  a  blank line;  that  is, insert  newline  after the  current
        position.

<tab>
        With  argument, set  tab fields at  every argument  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.

Send Commands to Operating System


<ctrl-C>
        Suspend MicroEMACS  and execute a  subshell.  Typing <ctrl-D>
        returns you to MicroEMACS and allows you to resume editing.

<ctrl-X>!
        Prompt for a shell command and execute it.

These commands recognize the shell variable SHELL to determine the shell to
which it should pass the command.

Setting the Mark


<ctrl-@>
        Set mark at current position.

<esc>.
        Set mark at current position.

Help Window


<ctrl-X>?
        Prompt for word for which information is needed.

<esc>?
        Search for word over which cursor is positioned.

<esc>2
        Erase help window.

Miscellaneous


<ctrl-G>
        Abort a command.

<ctrl-L>
        Redraw the screen.

<ctrl-Q>
        (Quote) Insert the next character into text; used to insert control
        characters.

<esc>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.

<ctrl-T>
        Transpose the characters before and after the current position.

<ctrl-U>
        Specify a numeric argument, as described above.

<ctrl-U><ctrl-X><ctrl-C>
        Abort  editing  and  re-compilation.   Use  this command  to  abort
        editing and return to COHERENT when  you are using the -A option to
        the cc command.

<ctrl-X>H
        Use word-wrap on a region.

<ctrl-X>F
        Set word  wrap to  argument column.  If  argument is one,  set word
        wrap to cursor's current position.

<ctrl-X><ctrl-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.

Diagnostics

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.

See Also

commands,
ed,
elvis,
ex,
sed,
TERM,
vi

Notes

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.

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