1 4/16/79  -- Information on new window and buffer management system
  2             in Multics Emacs. (Last update 11/4/79)
  3 
  4 **This file is intended to be perused via dprint, print, or via an**
  5 **editor.  It is not intended to be perused with the help command**
  6 
  7 
  8 
  9 
 10 ^L
 11      The latest version of Multics Emacs contains a new "menu"-type scheme to
 12 manipulate buffers and windows, and supports as many windows as can be fit on
 13 the screen without any window going to less than 3 lines.
 14 
 15      First, some definitions:
 16 
 17           o buffer - a body of text in Emacs identified by a buffer
 18             name. This concept has not changed.
 19 
 20           o window - an area of the screen delimited by "boundary lines"
 21             (lines of "-----"), the top of the screen, or the modeline.
 22             A window is said to be displaying a buffer if the text of that
 23             buffer can be seen in that window.
 24 
 25           o "on display in" - a buffer is on display in a given window
 26             if the text of that buffer can be seen in that window.
 27 
 28           o topline - the boundary line on the top of a window.
 29             The uppermost window has no topline.
 30 
 31           o bottomline - the boundary line on the bottom of a window.
 32             The bottom-most window has no bottomline.
 33 
 34           o Selected window - the window in which the cursor now appears
 35             (when not in the minibuffer).
 36 
 37           o Current buffer - the buffer on display in the selected window.
 38             The modeline gives the name of the current buffer.
 39 
 40           o LRU window - the least-recently used window, i.e., the
 41             window which has been the selected window least recently.
 42 
 43           o Previous window - the next-most recently used window other than the
 44             selected window itself.  The selected window is always the
 45             most recently used.
 46 
 47 
 48     There are several basic techniques for manipulating windows.  The simple
 49 keyboard commands ^XO, ^X0, ^X1, ^X2, ^X3, and ^X4 may be used to create,
 50 destroy, and select windows in a manner roughly analogous to the old use
 51 of ^XO, ^X1, ^X2, and ^X3.  At low speed, this may be the only convenient way.
 52 Alternatively, the "window editor" may be used.  The window editor, invoked by
 53 ^Z^W, puts up a display of the numbers, positions, sizes, and contents of all
 54 extant windows, and allows destruction, selection, and size-adjustment of
 55 windows by positioning to the line describing the window to be dealt with and
 56 issuing commands.
 57 
 58      First we describe the simple keyboard commands, beginning with the ones
 59 which had been used previously:
 60 
 61   ^X2 creates a new window on the screen, and selects that window.  If there
 62       was only one window on the screen, this is the same as it had been
 63       before.  If there are any number of windows on the screen, ^X2 will make
 64       one more, and select it.  The buffer placed on display in that window
 65       will be one whose name is constructed as "Window ## Default" (where ##
 66       is the window number, the top one being window 1), no longer
 67       "alternate".  Arguments may no longer be used to ^X2 to specify the top
 68       window size; the window editor must be used for this purpose.
 69 
 70   ^X3 Creates a new window at the bottom of the screen, but keeps the
 71       currently selected window selected. The name of the buffer placed in
 72       that window is constructed as described above.  The new window becomes
 73       the LRU window, so ^X4 ^X^E (command) CR will put file output in a new
 74       window (see below).  Note that if there is only one window on the screen
 75       this is compatible with what it had done before.  Again, arguments are
 76       ignored.
 77 
 78   ^X1 Gets rid of all windows except the currently selected window, which then
 79       grows to occupy the whole screen.  This is compatible with what it did
 80       before.  Getting rid of a window does NOT mean getting rid of the text
 81       or buffer which is on display in that window, it just means taking the
 82       window off the screen.
 83 
 84   ^XO Selects the previous window, which is the window you had last been in
 85       before you were in this window.  Note that this makes the window you
 86       issue the ^XO in the previous window, so successive ^XO's will switch
 87       windows back and forth like it has always done.  Selecting a window, of
 88       course, may potentially (and usually does) switch buffers, too.  The
 89       modeline always tells you what buffer is current, the cursor tells you
 90       what window is selected.
 91 
 92      The following two new commands augment the repertoire of the above:
 93 
 94   ^X0 (control x zero, as opposed to control x "oh".) Removes the selected
 95       window from the screen, giving the space it occupied to the windows
 96       that were on either side of it.  The previous window will become
 97       the new selected window.  With an argument, deletes the specified
 98       window (the top window is number 1).
 99 
100   ^X4 Selects the LRU window.  The idea of this is to implement "Get me a
101       window I haven't looked at recently for the thing I'm about to do
102       (such as a ^XB or ^X^F)".  You would want to do this if you had
103       several (at least 2) windows on the screen, cared about some of them,
104       didn't care about some other of them, and wanted to find one you didn't
105       care about to do some new thing in.
106 
107       Note that selecting the LRU window makes it the MOST recently used
108       (i.e., selected).  So some other window is now LRU, and another ^X4 will
109       select _^Ht_^Hh_^Ha_^Ht window.  Thus, successive ^X4's (or ^X4 ^C ^C ...)
110       will cycle through all windows on the screen.
111 
112      Several Emacs commands always switch into a new buffer to present
113 their goods, and leave you in it. For example, the directory editor, ^X^E
114 (comout), which leaves you in file_output, and RMAIL (both inbound and
115 outbound).  Some of these commands (and this is surely an area for debate)
116 think they know that what you ask of them is not what you are "really doing".
117 For instance, send-mail (^XM) believes that when you wish to send mail, it is
118 on a spur-of-the-moment impulse, and you wish to keep what you were doing on
119 the screen.  Similarly, comout (^X^E) believes that you are looking at
120 file_output just to see how the "results" of your editing suceeded, and you do
121 not wish to obliterate what you are editing from the screen.
122 
123      These commands perform what is called a "find buffer in window" (which,
124 incidentally, is available to the extension programmer by that name with
125 hyphens in it).  What this means is that if the buffer they wish to go
126 to/display (e.g., "file_output" for ^X^E (comout)) is already on display in
127 some window, they will select that window.  If the buffer is not on display,
128 they will select the LRU window in which to _^Hp_^Hu_^Ht it on display, and so do.  The
129 directory editor will put its "examine" buffer on display with a "find buffer
130 in window", replacing the content of the LRU window if its examine buffer is
131 not already on display.  Ditto the RMAIL reply buffer.
132 
133               --------------------------------------------------
134 
135      The window editor provides an interactive way to manipulate windows in an
136 integrated fashion, allowing the screen to be conveniently reorganized.  The
137 window editor puts a formatted display in a dedicated buffer, which will
138 appear on the screen, in the selected window.  ^Z^W causes this to happen.  If
139 you want it to do a find-buffer-in-window on itself (e.g., you want to see the
140 effect of reorganizing the screen on the material in the selected window),
141 give it an argument, i.e., ^U^Z^W.  A typical window editor display looks like
142 this:
143 
144           1   0     0    12   term-paper          appear on
145           2*  2     13   3    WINDOWSTAT          2*
146           3   4     17   2    Messages from COMSAT
147 
148 Each line speaks of the contents of one window on the screen at the time
149 the window editor was entered.  There are as many lines as there are windows.
150 You may not use normal Emacs commands to change the content of the display; it
151 is read-only.  You may, however, use normal Emacs commands (e.g., searches,
152 etc.) to position around in it.   The cursor, when in the window-editor's
153 buffer, is always on some line of the buffer (beware, the buffer may be larger
154 than the window it is in, like most Emacs buffers!).  That line speaks of some
155 window; the window's window-number from the top of the screen is the first
156 number on that line.  The window designated by the line on which the cursor is
157 will be called the "designated window (do not confuse this with the selected
158 window, which will always be the window containing the window editor's
159 display).
160 
161      The window number will be followed by a star for the window that was the
162 selected window at the time the window editor was entered.   The next number
163 on each line is called the "internal window number", and is usually not of
164 interest.  The remaining two numbers on each line are the position and size of
165 each window, the position being the starting line-number on the screen (the
166 top line is 0) and the number of lines in it.
167 
168      Following the position and size is the buffer name of the buffer
169 currently on display in that window.  Following the buffer name are the first
170 ten characters of the "point line" in that window.  The "point line" is the
171 line in the window that the cursor will go to if that window is selected.
172 
173      One operates the window editor by invoking it, positioning to some line,
174 thus designating some window, and issuing commands to affect that window.
175 The following requests are recognized: note that they are "printing" (i.e., not
176 control) characters, for ease of typing, since you may not enter text into a
177 read-only buffer (like that of the window-editor or DIRED).  They are:
178 
179      g     Go to, or select that window, leaving the window editor, and
180            moving the cursor to that window.   given window in a many-window
181            situation, as opposed to a large number of ^X4's.
182 
183      f     same as g, for compatibility with the buffer editor.
184 
185      k     Kill, i.e., remove this window from the screen.  This will be done
186            immediately, and the buffer editor display will be updated to
187            reflect the new screen layout.  The space occupied by that window
188            will be distributed among its neighbors.
189 
190      d     same as k, for DIRED compatibility.
191 
192      ^     (think of the shape of this character, "pushing up").  Move the
193            topline of the designated window up by one, increasing the size
194            of this window, and deducting one from its upstairs neighbor.
195            With a numeric argument, do that many lines instead of one.
196            The buffer editor display will be updated to reflect the new
197            screen layout.
198 
199      v     (think of the shape of this character, "pushing down".)  Moves the
200            bottomline of the designated window down.  Same rules and features
201            as ^.
202 
203      a     (think of the shape of a capital A).  Bring the topline of this
204            window down, same rules and features as ^.
205 
206      u     (think of the shape of a U). Pull the bottomline of this window
207            up, same rules and features as ^.
208 
209      The following requests do not deal with the designated window, and may be
210 issued at any time in the window editor:
211 
212      n     Go to the next line of the window editor display.  Although you
213            could use ^N as always, n is easier here, since this is a read-only
214            buffer.  If on the last line, goes to the first.
215 
216      p     Same rationale and idea as n, except goes to the previous line (or
217            the last if issued on the first).
218 
219      b     Exits the window editor by entering the buffer editor in the
220            window now occupied by the window editor's display.
221 
222      c     Creates a new window (like ^X3), except leaves you in the
223            window editor's display, with the display updated to reflect the
224            new state of the screen, with the new window as designated window.
225 
226      3     Same as c, for mnemonic ease with ^X3.
227 
228      The window editor is normally exited by selecting some other window with
229 the "g" request; indeed, one may often enter the window editor for no other
230 reason than to do this!  Once can also exit via the "b" request to the buffer
231 editor, or just ^XB or ^X^F of whatever one normally does to go wherever one
232 wants to go.  Beware of window editor windows left lying around on the screen:
233 while attractive and interesting, they are NOT updated dynamically by Emacs
234 if windows and buffers are changed around.
235 
236 
237          %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238 
239      The buffer editor provides a facility for cleaning out, examining, and
240 selecting buffers, similar to DIRED and the window editor.  Like both of these
241 other menu-type editors, the buffer editor creates a read-only display in a
242 special buffer, and selects it in a window of your choice.  Again as with these
243 others, printing-character requests are use to select options to deal with the
244 buffer whose name appears on the line with the cursor on it.
245 
246      The buffer editor is entered via ^Z^B.  It will put its display in the
247 window in which it was invoked.  If you want it to find-buffer-in-window itself
248 (e.g., it is on the screen already, or you don't want to overwrite the current
249 window), do a ^U^Z^B.
250 
251      Each line of the buffer-editor's display contains a buffer's name, a
252 pathname, if the buffer has a pathname associated with it, and possible flags.
253 The flags appear at the left margin, and they are:
254 
255           *  The buffer is "modified" (needs writing out)
256           >  The buffer that was current when the buffer editor was entered.
257           X  The buffer editor has marked this buffer for deletion.
258 
259      There may be more buffers (i.e., lines in the buffer editor's display)
260 than are on display in the window in which this display appears; like any
261 other Emacs buffer on display, ^V, ESC-V, or any other standard Emacs
262 technique may be used to position around in it.
263 
264      Buffers may be killed (as ^XK normally does) with the buffer editor
265 "k" (or "d") request.  Buffers so killed are not actually destroyed until the
266 buffer editor is exited via a g, w, f, q (or ^X^Q) request, at which time you
267 will be asked (if you have marked buffers for deletion) if you really want to
268 delete them (they will be listed as local display).
269 
270      The following requests are known to the buffer editor:
271 
272      n     Go to next line (see window editor's similar request for the
273            rationale for this ^N substitute) or first if now on last.
274 
275      p     Go to previous line (or last if now on first).
276 
277      k     Mark the designated buffer for deletion when the buffer editor
278            is exited, move to the next line.
279 
280      d     same as k, for DIRED compatibility.
281 
282      u     Undelete, i.e., unmark for deletion, the designated buffer.
283            The X will be removed from the display, and the cursor will
284            be positioned to the next line.
285 
286      e     Examine the designated buffer.  In one-window mode, this is
287            kind of worthless, you should just go there.  But with two or more
288            windows, a find-buffer-in-window is done on the designated buffer,
289            putting it on display if not already on display. A message will
290            be printed in the minibuffer about where (in what window) it
291            appears.
292 
293      These next requests cause the buffer editor to be exited: you will be
294      interrogated about pending deletions if you have any:
295 
296      g     Go to the designated buffer, exiting the buffer editor, replacing
297            its display in the current (selected) window, with this buffer.
298            This is just like doing a ^XB: as matter of fact, the buffer editor
299            may be used for just seeing what buffers there are and going to
300            one, to save typing!  This may also be useful for buffers with
301            long and complex names, like "Messages from Brzezinski".
302 
303      f     Find-buffer-in-window the designated buffer.  Since the buffer
304            editor makes its own window LRU when it exits, if you "f"
305            a buffer not currently on display in any window, it is the same
306            as "g"ing it, replacing the buffer editor's window.
307 
308            However, if the designated buffer is on the screen somewhere, the
309            cursor will simply be moved into that window (and thus, into
310            that buffer).  If you use multiple windows, you will find that you
311            will use "f" all the time, and will rarely use "g".
312 
313      s     Writes out, i.e., saves the designated buffer to its default
314            pathname, unmarking it as modified.
315 
316      w     Exit the buffer editor to the window editor in the current window.
317 
318      q     Exit the buffer editor to the buffer from which it was invoked, in
319            the current window, if it was invoked via ^Z^W, or find-buffer-in-window
320            the buffer from which you came if the buffer editor was invoked
321            by beargumented ^Z^B, i.e., was find-buffered-in-windowed
322            itself.
323 
324      ^X^Q  Same as q.