[net.emacs] Multiple Windows in CCA EMACS

z@cca.UUCP (06/20/83)

CCA EMACS now supports an arbitrary number of horizontal and vertical
windows on the screen.  Horizontal and vertical windows may be mixed in
any fashion, with the only requirement being that each window must have
a rectangular shape.  As an example of a possible arrangement, I used
the following configuration a number of times during testing:

              
              |----------------------------------------|
              |                    |                   |
              |                    |                   |
              |                    |                   |
              |                    |                   |
              |                    |                   |
              |                    |                   |
              |                    |                   |
              |                    |-------------------|
              |                    |     |             |
              |                    |     |             |
              |                    |     |             |
              |                    |     |             |
              |--------------------|-------------------|
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |                    |         |         |
              |----------------------------------------|

With only one minor exception, the commands used to manipulate
horizontal and vertical windows are completely upwards compatible with
the old two window mode commands.  This means that users who only have
need for two windows can continue using the same commands they have up
until now.  When more windows are needed, the two window commands have
more generalized forms which allow manipulation of an arbitrary number
of windows (i.e., as many as will fit on the screen).

Before describing the new commands, it is necessary to specify what is
meant by horizontal and vertical windows.  Horizontal windows are those
windows which are formed by splitting the screen with horizontal lines;
the old two window mode contained two horizontal windows.  Vertical
windows are those windows formed by splitting the screen with vertical
lines.

The C-X 2 command (^R Two Windows) used to be legal only in one window
mode, and would put the user into two window mode.  It is now legal any
time the current window contains at least three lines, and its function
is now to split the current window into two horizontal windows.  A
similar command, C-C 2 (^R Two Vertical Windows) is used to split the
current window in two vertically.

The C-X 1 (^R One Window) command returns to one window mode and fills
the screen with a specified window.  With no argument, this is the top
window in the current column of windows.  With a C-U argument, it is the
bottom window in the current column.  With two C-U arguments, it is the
current window.  With a numeric argument n, it is the nth window in the
current column.  Windows, like buffers, are numbered starting from 1.
The C-C 1 (^R Vertical One Window) command is like C-X 1, but it is
oriented towards rows rather than columns.

There are two new commands, C-X 0 (^R Kill Window) and C-C 0 (^R Kill
Vertical Window), which are useful for getting rid of a single window.
With no argument, C-X 0 causes the current window to be absorbed into
the window above it.  With a C-U argument, the current window is
absorbed into the window below it.  With a numeric argument, that number
window is absorbed into the window above it, and the currently selected
window does not change.  The top window in a column is always absorbed
into the window below it, and the bottom window in a column is always
absorbed into the window above it.  C-C 0 works similarly with vertical
windows.  Due to the way window data structures must be maintained, it
is not always possible to allow the C-X 0 and C-C 0 commands in those
places where windows appear to line up.  However, you can always use
these commands to kill windows in the reverse order from which they were
created, as well as most other orders.

The C-X 3 (^R View Two Windows) command is like C-X 2 but stays in the
first window; C-C 3 works similarly with regards to C-C 2.

C-X O (^R Other Window) moves to the next window in the current column;
if it is at the last window, it moves to the first window.  Given an
argument, it moves forward that many windows; with a negative argument,
it moves backwards.  C-C O (^R Other Vertical Window) works similarly
with windows in the current row.  If not all rows and columns contain
the same number of windows, then giving the C-X O or C-C O command may
cause both the window row and column to be changed.  This is necessary
in those cases where the implied destination window would not exist.

The C-X 4 (^R Visit in Other Window) command now always splits the
current horizontal window in two and allows the user to select a buffer
or file in the new window.  This is a slight change from the old C-X 4
command, where a new window was created only if the user was in one
window mode.  The new C-X 4 command can be made to select a new file or
buffer in the next window rather than creating a new window by giving it
a C-U argument.  If C-X 4 is given a numeric argument, positive or
negative, it will select a new file or buffer in the window which is
that many windows forwards or backwards from the current window.  The
C-C 4 (^R Visit in Vertical Window) command works similarly for vertical
windows.

The command C-M-V (^R Scroll Other Window) now scrolls the horizontal
window which was selected most recently, while the command C-C C-S (^R
Scroll Vertical Window) scrolls the vertical window which was selected
most recently.

Since windows may now be surrounded by other windows on all sides, they
can now grow or shrink in up to four different directions.  The command
C-X ^ (^R Grow Window Up) will now raise the upper boundary of a window,
or shrink it if given a negative argument.  The command C-X Linefeed
works similarly on a window's lower boundary.  If a window is either the
top or bottom window of a column, then both of these commands work on
its only movable boundary, with a positive argument expanding the window
and a negative one contracting it.  In a similar way, the commands C-C <
(^R Grow Window Left) and C-C > (^R Grow Window Right) work on a
window's left and right boundaries.

All windows have their own mode lines.  However, when windows are split
vertically, sometimes there is not very much of the mode line which is
left showing.  Therefore, there is a new command Help M (C-_ M) which
will display the current mode line in the echo area.  (The echo area is
always a full screen width.)

The C-L command (^R New Window) also has a new option.  A C-L with no
arguments is normally used to redisplay the current window.  A C-L with
one C-U argument is used to redisplay the current line.  Now, a C-L
command with two C-U arguments can be used to redisplay all of the
windows on the screen.

In order to implement ^R Other Vertical Window on C-C O, it was
necessary to move M-X Occur from C-C O to C-C P.  This is still somewhat
mnemonic if you think of the P as standing for the "Pattern:" that M-X
Occur always prompts for.

This version of CCA EMACS also has a couple of other new features
unrelated to multiple windows.  The first of these is that the
restriction that the last page of a file be no longer than 100 lines
long for local modes to be recognized has been removed.  The modes list
itself must still be within the last 100 lines, though.  This change
makes it easier to use local modes in program files where the language
being used does not recognize page breaks.

The second change is that a new variable Truncate Wrapped Lines has been
added.  When this variable is set, the parts of long lines that extend
beyond the right margin are not displayed.  Point may still be located
in this text; if it is, the cursor is positioned at the exclamation
point in the right margin.

z@cca.UUCP (06/26/83)

The multiple window commands for CCA EMACS have been revised somewhat to
be easier to use with large numbers of windows.  It was found that the
original scheme of addressing windows by rows and columns did not work
well when there many windows of varying sizes, as it was not always easy
to tell to which row and column a given window belonged.  Therefore,
under the revised scheme, all windows are addressed by a single unique
window number.  In multiple window mode, this window number is displayed
in the extreme left of the mode line.  This way, the window number is
always visible, no matter how narrow the window is.  The changes in the
window commands all have to do with addressing this new window number.

The C-X O (^R Other Window) command with no argument will now change to
the previous window.  It can be given a numeric argument to change to a
specific numbered window.  With just a C-U argument, it changes to the
window with the next higher number, and with a negative argument, it
changes to the window with the next lower number.  This behavior is
analogous to that of the C-X B (Select Buffer) command.  The C-C O
command is no longer needed, and has been deleted.  Instead, M-X Occur
has been moved back to its old place on C-C O.

The limitation on killing windows mentioned in the previous message has
been removed; C-X 0 and C-C 0 will cause one window to be absorbed into
another provided that the new resulting window will still be rectangular
in shape.

The C-X 1 (^R One Window) command with a numeric argument will now go
into one window mode with the screen being filled with that number
window.  C-C 1 is now identical to C-X 1.

The C-X 4 (^R Visit in Other Window) and C-C 4 (Visit in Vertical
Window) commands with no arguments behave as before.  With arguments,
they first use their arguments to select a window in the same way C-X O
(^R Other Window) does, and then select a file or buffer in that window.

C-M-V (^R Scroll Other Window) now always scrolls the previous window.
C-C C-S is no longer needed, and has been deleted.