Summary: fix, make sure ase-heap emits all symbols it needs
[sxemacs] / info / sxemacs / windows.texi
1 @node Windows, Mule, Buffers, Top
2 @chapter Multiple Windows
3 @cindex windows
4
5   Emacs can split the frame into two or many windows, which can display
6 parts of different buffers or different parts of one buffer.  If you are
7 running SXEmacs under X, that means you can have the X window that contains
8 the Emacs frame have multiple subwindows.
9
10 @menu
11 * Basic Window::     Introduction to Emacs windows.
12 * Split Window::     New windows are made by splitting existing windows.
13 * Other Window::     Moving to another window or doing something to it.
14 * Pop Up Window::    Finding a file or buffer in another window.
15 * Change Window::    Deleting windows and changing their sizes.
16 @end menu
17
18 @node Basic Window, Split Window, Windows, Windows
19 @section Concepts of Emacs Windows
20
21   When Emacs displays multiple windows, each window has one Emacs
22 buffer designated for display.  The same buffer may appear in more
23 than one window; if it does, any changes in its text are displayed in all
24 the windows that display it.  Windows showing the same buffer can
25 show different parts of it, because each window has its own value of point.
26
27 @cindex selected window
28   At any time, one  window is the @dfn{selected window}; the buffer
29  displayed by that window is the current buffer.  The cursor
30 shows the location of point in that window.  Each other window has a
31 location of point as well, but since the terminal has only one cursor, it
32 cannot show the location of point in the other windows.
33
34   Commands to move point affect the value of point for the selected Emacs
35 window only.  They do not change the value of point in any other Emacs
36 window, including those showing the same buffer.  The same is true for commands
37 such as @kbd{C-x b} to change the selected buffer in the selected window;
38 they do not affect other windows at all.  However, there are other commands
39 such as @kbd{C-x 4 b} that select a different window and switch buffers in
40 it.  Also, all commands that display information in a window, including
41 (for example) @kbd{C-h f} (@code{describe-function}) and @kbd{C-x C-b}
42 (@code{list-buffers}), work by switching buffers in a non-selected window
43 without affecting the selected window.
44
45   Each window has its own mode line, which displays the buffer name,
46 modification status, and major and minor modes of the buffer that is
47 displayed in the window.  @xref{Mode Line}, for details on the mode
48 line.
49
50 @node Split Window, Other Window, Basic Window, Windows
51 @section Splitting Windows
52
53 @table @kbd
54 @item C-x 2
55 Split the selected window into two windows, one above the other
56 (@code{split-window-vertically}).
57 @item C-x 3
58 Split the selected window into two windows positioned side by side
59 (@code{split-window-horizontally}).
60 @item C-x 6
61 Save the current window configuration in register @var{reg} (a letter).
62 @item C-x 7
63 Restore (make current) the window configuration in register
64 @var{reg} (a letter).  Use with a register previously set with @kbd{C-x 6}.
65 @end table
66
67 @kindex C-x 2
68 @findex split-window-vertically
69   The command @kbd{C-x 2} (@code{split-window-vertically}) breaks the
70 selected window into two windows, one above the other.  Both windows
71 start out displaying the same buffer, with the same value of point.  By
72 default each of the two windows gets half the height of the window that
73 was split.  A numeric argument specifies how many lines to give to the
74 top window.
75
76 @kindex C-x 3
77 @findex split-window-horizontally
78   @kbd{C-x 3} (@code{split-window-horizontally}) breaks the selected
79 window into two side-by-side windows.  A numeric argument specifies how
80 many columns to give the one on the left.  A line of vertical bars
81 separates the two windows.  Windows that are not the full width of the
82 frame have truncated mode lines which do not always appear in inverse
83 video, because Emacs display routines cannot display a region of inverse
84 video that is only part of a line on the screen.
85
86 @vindex truncate-partial-width-windows
87   When a window is less than the full width, many text lines are too
88 long to fit.  Continuing all those lines might be confusing.  Set the
89 variable @code{truncate-partial-width-windows} to non-@code{nil} to
90 force truncation in all windows less than the full width of the frame,
91 independent of the buffer and its value for @code{truncate-lines}.
92 @xref{Continuation Lines}.@refill
93
94   Horizontal scrolling is often used in side-by-side windows.
95 @xref{Display}.
96
97 @findex jump-to-register
98 @findex window-configuration-to-register
99 You can resize a window and store that configuration in a register by
100 supplying a @var{register} argument to @code{window-configuration-to-register}
101 (@kbd{C-x 6}). To return to the window configuration established with
102 @code{window-configuration-to-register}, use @code{jump-to-register}
103 (@kbd{C-x j}).
104
105 @node Other Window, Pop Up Window, Split Window, Windows
106 @section Using Other Windows
107
108 @table @kbd
109 @item C-x o
110 Select another window (@code{other-window}).  That is the letter `o', not zero.
111 @item M-C-v
112 Scroll the next window (@code{scroll-other-window}).
113 @item M-x compare-windows
114 Find the next place where the text in the selected window does not match
115 the text in the next window.
116 @item M-x other-window-any-frame @var{n}
117 Select the @var{n}th different window on any frame.
118 @end table
119
120 @kindex C-x o
121 @findex other-window
122   To select a different window, use @kbd{C-x o} (@code{other-window}).
123 That is an `o', for `other', not a zero.  When there are more than
124 two windows, the command moves through all the windows in a cyclic
125 order, generally top to bottom and left to right.  From the rightmost
126 and bottommost window, it goes back to the one at the upper left corner.
127 A numeric argument, @var{n}, moves several steps in the cyclic order of
128 windows. A negative numeric argument moves around the cycle in the
129 opposite order.  If the optional second argument @var{which-frames} is
130 non-@code{nil}, the function cycles through all frames.  When the
131 minibuffer is active, the minibuffer is the last window in the cycle;
132 you can switch from the minibuffer window to one of the other windows,
133 and later switch back and finish supplying the minibuffer argument that
134 is requested.  @xref{Minibuffer Edit}.
135
136 @findex other-window-any-frame
137  The command @kbd{M-x other-window-any-frame} also selects the window
138 @var{n} steps away in the cyclic order.  However, unlike @code{other-window},
139 this command selects a window on the next or previous frame instead of
140 wrapping around to the top or bottom of the current frame, when there
141 are no more windows.
142
143 @kindex C-M-v
144 @findex scroll-other-window
145   The usual scrolling commands (@pxref{Display}) apply to the selected
146 window only.  @kbd{M-C-v} (@code{scroll-other-window}) scrolls the
147 window that @kbd{C-x o} would select.  Like @kbd{C-v}, it takes positive
148 and negative arguments.
149
150 @findex compare-windows
151   The command @kbd{M-x compare-windows} compares the text in the current
152 window with the text in the next window.  Comparison starts at point in each
153 window.  Point moves forward in each window, a character at a time,
154 until the next set of characters in the two windows are different.  Then the
155 command is finished.
156
157 A prefix argument @var{ignore-whitespace} means ignore changes in
158 whitespace.  The variable @code{compare-windows-whitespace} controls how
159 whitespace is skipped.
160
161 If @code{compare-ignore-case} is non-@code{nil}, changes in case are
162 also ignored.
163
164 @node Pop Up Window, Change Window, Other Window, Windows
165 @section Displaying in Another Window
166
167 @kindex C-x 4
168   @kbd{C-x 4} is a prefix key for commands that select another window
169 (splitting the window if there is only one) and select a buffer in that
170 window.  Different @kbd{C-x 4} commands have different ways of finding the
171 buffer to select.
172
173 @findex switch-to-buffer-other-window
174 @findex find-file-other-window
175 @findex find-tag-other-window
176 @findex dired-other-window
177 @findex mail-other-window
178 @table @kbd
179 @item C-x 4 b @var{bufname} @key{RET}
180 Select buffer @var{bufname} in another window.  This runs
181 @code{switch-to-buffer-other-window}.
182 @item C-x 4 f @var{filename} @key{RET}
183 Visit file @var{filename} and select its buffer in another window.  This
184 runs @code{find-file-other-window}.  @xref{Visiting}.
185 @item C-x 4 d @var{directory} @key{RET}
186 Select a Dired buffer for directory @var{directory} in another window.
187 This runs @code{dired-other-window}.  @xref{Dired}.
188 @item C-x 4 m
189 Start composing a mail message in another window.  This runs
190 @code{mail-other-window}, and its same-window version is @kbd{C-x m}
191 (@pxref{Sending Mail}).
192 @item C-x 4 .
193 Find a tag in the current tag table in another window.  This runs
194 @code{find-tag-other-window}, the multiple-window variant of @kbd{M-.}
195 (@pxref{Tags}).
196 @end table
197
198 @vindex display-buffer-function
199 If the variable @code{display-buffer-function} is non-@code{nil}, its value is
200 the function to call to handle @code{display-buffer}. It receives two
201 arguments, the buffer and a flag that if non-@code{nil} means that the
202 currently selected window is not acceptable. Commands such as
203 @code{switch-to-buffer-other-window} and @code{find-file-other-window}
204 work using this function.
205
206 @node Change Window,, Pop Up Window, Windows
207 @section Deleting and Rearranging Windows
208
209 @table @kbd
210 @item C-x 0
211 Get rid of the selected window (@code{delete-window}).  That is a zero.
212 If there is more than one Emacs frame, deleting the sole remaining
213 window on that frame deletes the frame as well. If the current frame
214 is the only frame, it is not deleted.
215 @item C-x 1
216 Get rid of all windows except the selected one
217 (@code{delete-other-windows}).
218 @item C-x ^
219 Make the selected window taller, at the expense of the other(s)
220 @*(@code{enlarge-window}).
221 @item C-x @}
222 Make the selected window wider (@code{enlarge-window-horizontally}).
223 @end table
224
225 @kindex C-x 0
226 @findex delete-window
227   To delete a window, type @kbd{C-x 0} (@code{delete-window}).  (That is a
228 zero.)  The space occupied by the deleted window is distributed among the
229 other active windows (but not the minibuffer window, even if that is active
230 at the time).  Once a window is deleted, its attributes are forgotten;
231 there is no automatic way to make another window of the same shape or
232 showing the same buffer.  The buffer continues to exist, and you can
233 select it in any window with @kbd{C-x b}.
234
235 @kindex C-x 1
236 @findex delete-other-windows
237   @kbd{C-x 1} (@code{delete-other-windows}) is more powerful than @kbd{C-x 0};
238 it deletes all the windows except the selected one (and the minibuffer).
239 The selected window expands to use the whole frame except for the echo
240 area.
241
242 @kindex C-x ^
243 @findex enlarge-window
244 @kindex C-x @}
245 @findex enlarge-window-horizontally
246 @vindex window-min-height
247 @vindex window-min-width
248   To readjust the division of space among existing windows, use @kbd{C-x
249 ^} (@code{enlarge-window}).  It makes the currently selected window
250 longer by one line or as many lines as a numeric argument specifies.
251 With a negative argument, it makes the selected window smaller.
252 @kbd{C-x @}} (@code{enlarge-window-horizontally}) makes the selected
253 window wider by the specified number of columns.  The extra screen space
254 given to a window comes from one of its neighbors, if that is possible;
255 otherwise, all the competing windows are shrunk in the same proportion.
256 If this makes some windows too small, those windows are deleted and their
257 space is divided up.   Minimum window size is specified by the variables
258 @code{window-min-height} and @code{window-min-width}.
259
260 You can also resize windows within a frame by clicking the left mouse
261 button on a modeline, and dragging.
262
263 Clicking the right button on a mode line pops up a menu of common window
264 manager operations.  This menu contains the following options:
265
266 @cindex Windows menu
267 @cindex Pull-down Menus
268 @cindex menus
269 @table @b
270 @item Delete Window
271 Remove the window above this modeline from the frame.
272
273 @item Delete Other Windows
274 Delete all windows on the frame except for the one above this modeline.
275
276 @item Split Window
277 Split the window above the mode line in half, creating another window.
278
279 @item Split Window Horizontally
280 Split the window above the mode line in half horizontally, so that there
281 will be two windows side-by-side.
282
283 @item Balance Windows
284 Readjust the sizes of all windows on the frame until all windows have
285 roughly the same number of lines.
286 @end table