\def\desc#1{\smallskip\leftline{\tt #1}\parskip=0pt\nobreak\noindent}

\section{System Lisp Commands}

All low-level control of the two ``daemon'' process is done through
Lisp commands most of which correspond to the IPC requests described
in the next section.  Since the source editor controls the formatter
and the proof editor, but does not participate in their communications
(the formatter-proof editor link), we have no Lisp commands which
control that edge of the triangle.

\subsection{Proof Editor Commands}

The proof editor presents the same paradigm as the source editor--its
windows operate as do source buffer windows.  Any {\VorTeX} buffer
window may visit a proof buffer; the differences between a source and
a proof window are all implemented at the buffer level.  The commands
listed in this section are the lowest level of all (they generally
translate directly into low-level communications operations).  The
majority of editing functions are more complex functions written in
vLisp and invoked through key strokes in the normal EMACS manner.

\desc{start-proof-editor}%
starts up the proof editor on the specified host if necessary and
connects to it.  The function returns {\bf t} if a sucessful
connection was made and nil otherwise.  If there is a serious
low-level communications failure, an error may occur.

The proof editor is run on the machine given by the value of {\tt
proof-editor-host} by exec'ing the program given by {\tt
proof-editor-program} on that host ({\tt "localhost"} by default).

If the proof editor is already running when this function
is called, the current proof editor is killed (as with
{\tt kill-proof-editor}) and a new one is started.

\desc{kill-proof-editor}%
kills the proof editor if one is running.  If a formatter is running,
it loses its connection to the proof editor also.

\desc{proof-document}%
creates a proof window on the given document at the specified physical
page number, or at page one if none is specified.

\desc{proof-goto-page}%
changes the page being viewed in the current window (or the window
specified by the second argument if there is one) to the specified
physical page number.

The physical page number has nothing to do with the page number {\TeX}
prints on the bottom of each page, it refers to the order of the pages
as laid out in the document.  The first page formatter is page one,
the second page two.

If the specified page does not exist, the editor finds the closest
possible page.  Thus, both zero and one go to the first page and
numbers greater than the length of the document go to the last page.

\desc{proof-next-page}%
changes the page being viewed in the current window (or the window
specified by the second argument if there is one) forward or backward
by the specified count.

\desc{proof-move-absolute}%
moves the current window (or the window specified by the second
argument if there is one) to the given proof editor position.
A proof buffer window position is specified in units of screen pixels.
These routines are normally not needed by the user.

\desc{proof-move-relative}%
moves the current window (or the window specified by the second
argument if there is one) in the given proof editor relative to the
current position.

\desc{proof-select}%
causes the area under or the current mouse position (it must be
invoked interactively) to be selected at the next higher level of
structure.

This function and the other selection functions below, cause {\VorTeX}
to trans\-late the selected structure in the proof window into a source
buffer/region pair as returned from {\tt proof-\-sel\-ected-\-region}.
Proof selections are performed by the proof editor, with the reverse
mapping done by the source editor upon completion.

\desc{proof-select-more}%
causes the area under the mouse cursor (it must be invoked
interactively) and all the text between it and the current selection
(begun with {\tt proof-select}) to become the current selection.  It
always operates at the granularity established by {\tt proof-select}.
Thus, if the user has clicked the left button twice at the same place
(calling {\tt proof-select} to select a word), and then moves to
another word and clicks the middle button (calling {\tt
proof-select-more}), all {\bf words} between and including the ones
clicked on will be selected

\desc{proof-selected-region}% returns the region selected by the user
using the proof editor as a list.  The first element in the list is
the source buffer name (the general buffer handle) and the other two
are offsets into the buffer defining the region, in order.

If no region has been selected with the proof editor, this function
returns nil.

\desc{proof-moveto}%
scrolls the specified proof window to the given offset in the buffer.
If no buffer and window are specified, the last used source and proof
window buffers are used.


\subsection{Formatter Commands}

The formatter does not appear to the user directly.  It is responsible
for formatting the document and performing translation functions in
both directions, but the user never needs to interact with it.  As with
the proof editor, all functionality is implemented through a set of
remote procedure calls.

\desc{start-formatter}%
starts up the formatter on the specified host if necessary and
connects to it.  The function returns t if a sucessful connection was
made and nil otherwise.  If there is a serious low-level
communications failure, an error may occur.

The formatter is run on the machine given by the value of {\tt
formatter-host} by exec'ing the program given by {\tt
formatter-program} on that host ({\tt "localhost"} by default).
If we're already connected to the proof editor and a sucessful
connection is made to the formatter, a connection between the
formatter and the proof editor is established

\desc{kill-formatter}%
kills the formatter if one is running.  If a proof editor is running,
it loses its connection to the formatter also (but doesn't necessarily
die itself).

\desc{make-document}%
creates a new document whose master file is that specified by the
given {\TeX} source file.  If the file is not being visited in any
buffer, it is visited.  Buffers which are visiting {\TeX} source files
are marked as such so that changes to them can be communicated to
the remote {\TeX} formatter.   The user will not allowed to kill this
buffer until the document is closed.

The contents of this master file buffer will be scanned by the
formatter and processed as {\TeX} source code.  Note that changes to
the source buffer are sent to the formatter program when (or before)
the buffer is written or when a {\tt format-document} command is
invoked.

Since only one document is allowed at a time in the current system,
{\tt make-document} will implicitly call {\tt close-document} if
there is a current document when it starts.  To reformat the current
document, use {\tt format-document}.

If a formatter process is not running when this function is called,
one is started.  {\tt make-document} implicitly calls {\tt
start-formatter} in this case.  See the documentation on the latter
function for more information.

The contents of the buffer are sent immediately.  If other files are
required (via a {\tt \\bsl input} statement), they will be sent as
requested by the formatter.

\desc{format-document}%
sends a message to the incremental {\TeX} process to begin
reformatting the current document.  There must be a current document
previously opened with {\tt make-document}.

\desc{close-document}%
closes down the formatter connection, which has the effect of freeing
all resources used by the document.
