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