annotate man/windows.texi @ 75913:da54ad41c8f3

*** empty log message ***
author Glenn Morris <rgm@gnu.org>
date Thu, 15 Feb 2007 03:43:29 +0000
parents 3d45362f1d38
children 02b9a9aa5b0c 95d0cdf160ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
1 @c This is part of the Emacs manual.
64890
3723093a21fd Update years in copyright notice; nfc.
Thien-Thi Nguyen <ttn@gnuvola.org>
parents: 64870
diff changeset
2 @c Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2000, 2001,
75348
3d45362f1d38 Add 2007 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 73179
diff changeset
3 @c 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
4 @c See file emacs.texi for copying conditions.
Dave Love <fx@gnu.org>
parents:
diff changeset
5 @node Windows, Frames, Buffers, Top
Dave Love <fx@gnu.org>
parents:
diff changeset
6 @chapter Multiple Windows
Dave Love <fx@gnu.org>
parents:
diff changeset
7 @cindex windows in Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
8 @cindex multiple windows in Emacs
Dave Love <fx@gnu.org>
parents:
diff changeset
9
Dave Love <fx@gnu.org>
parents:
diff changeset
10 Emacs can split a frame into two or many windows. Multiple windows
Dave Love <fx@gnu.org>
parents:
diff changeset
11 can display parts of different buffers, or different parts of one
Dave Love <fx@gnu.org>
parents:
diff changeset
12 buffer. Multiple frames always imply multiple windows, because each
Dave Love <fx@gnu.org>
parents:
diff changeset
13 frame has its own set of windows. Each window belongs to one and only
Dave Love <fx@gnu.org>
parents:
diff changeset
14 one frame.
Dave Love <fx@gnu.org>
parents:
diff changeset
15
Dave Love <fx@gnu.org>
parents:
diff changeset
16 @menu
Dave Love <fx@gnu.org>
parents:
diff changeset
17 * Basic Window:: Introduction to Emacs windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
18 * Split Window:: New windows are made by splitting existing windows.
Dave Love <fx@gnu.org>
parents:
diff changeset
19 * Other Window:: Moving to another window or doing something to it.
Dave Love <fx@gnu.org>
parents:
diff changeset
20 * Pop Up Window:: Finding a file or buffer in another window.
Dave Love <fx@gnu.org>
parents:
diff changeset
21 * Force Same Window:: Forcing certain buffers to appear in the selected
Dave Love <fx@gnu.org>
parents:
diff changeset
22 window rather than in another window.
Dave Love <fx@gnu.org>
parents:
diff changeset
23 * Change Window:: Deleting windows and changing their sizes.
28551
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
24 * Window Convenience:: Convenience functions for window handling.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
25 @end menu
Dave Love <fx@gnu.org>
parents:
diff changeset
26
Dave Love <fx@gnu.org>
parents:
diff changeset
27 @node Basic Window
Dave Love <fx@gnu.org>
parents:
diff changeset
28 @section Concepts of Emacs Windows
Dave Love <fx@gnu.org>
parents:
diff changeset
29
Dave Love <fx@gnu.org>
parents:
diff changeset
30 Each Emacs window displays one Emacs buffer at any time. A single
Dave Love <fx@gnu.org>
parents:
diff changeset
31 buffer may appear in more than one window; if it does, any changes in
68545
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
32 its text are displayed in all the windows where it appears. But these
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
33 windows can show different parts of the buffer, because each window
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
34 has its own value of point.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
35
Dave Love <fx@gnu.org>
parents:
diff changeset
36 @cindex selected window
68545
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
37 At any time, one Emacs window is the @dfn{selected window}; the
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
38 buffer this window is displaying is the current buffer. The terminal's
Dave Love <fx@gnu.org>
parents:
diff changeset
39 cursor shows the location of point in this window. Each other window
56821
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
40 has a location of point as well. On text-only terminals, there is no
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
41 way to show where those locations are, since the terminal has only one
68545
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
42 cursor. On a graphical display, the location of point in a
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
43 non-selected window is indicated by a hollow box; the cursor in the
56821
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
44 selected window is blinking or solid.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
45
Dave Love <fx@gnu.org>
parents:
diff changeset
46 Commands to move point affect the value of point for the selected Emacs
68545
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
47 window only. They do not change the value of point in other Emacs
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
48 windows, even those showing the same buffer. The same is true for commands
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
49 such as @kbd{C-x b} to switch buffers in the selected window;
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
50 they do not affect other windows at all. However, there are other commands
Dave Love <fx@gnu.org>
parents:
diff changeset
51 such as @kbd{C-x 4 b} that select a different window and switch buffers in
Dave Love <fx@gnu.org>
parents:
diff changeset
52 it. Also, all commands that display information in a window, including
Dave Love <fx@gnu.org>
parents:
diff changeset
53 (for example) @kbd{C-h f} (@code{describe-function}) and @kbd{C-x C-b}
Dave Love <fx@gnu.org>
parents:
diff changeset
54 (@code{list-buffers}), work by switching buffers in a nonselected window
Dave Love <fx@gnu.org>
parents:
diff changeset
55 without affecting the selected window.
Dave Love <fx@gnu.org>
parents:
diff changeset
56
Dave Love <fx@gnu.org>
parents:
diff changeset
57 When multiple windows show the same buffer, they can have different
Dave Love <fx@gnu.org>
parents:
diff changeset
58 regions, because they can have different values of point. However,
Dave Love <fx@gnu.org>
parents:
diff changeset
59 they all have the same value for the mark, because each buffer has
Dave Love <fx@gnu.org>
parents:
diff changeset
60 only one mark position.
Dave Love <fx@gnu.org>
parents:
diff changeset
61
Dave Love <fx@gnu.org>
parents:
diff changeset
62 Each window has its own mode line, which displays the buffer name,
Dave Love <fx@gnu.org>
parents:
diff changeset
63 modification status and major and minor modes of the buffer that is
59890
fecf0bc95c49 (Basic Window): Mention color-change in mode line.
Richard M. Stallman <rms@gnu.org>
parents: 56821
diff changeset
64 displayed in the window. The selected window's mode line appears in a
fecf0bc95c49 (Basic Window): Mention color-change in mode line.
Richard M. Stallman <rms@gnu.org>
parents: 56821
diff changeset
65 different color. @xref{Mode Line}, for full details on the mode line.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
66
Dave Love <fx@gnu.org>
parents:
diff changeset
67 @node Split Window
Dave Love <fx@gnu.org>
parents:
diff changeset
68 @section Splitting Windows
Dave Love <fx@gnu.org>
parents:
diff changeset
69
Dave Love <fx@gnu.org>
parents:
diff changeset
70 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
71 @item C-x 2
Dave Love <fx@gnu.org>
parents:
diff changeset
72 Split the selected window into two windows, one above the other
Dave Love <fx@gnu.org>
parents:
diff changeset
73 (@code{split-window-vertically}).
Dave Love <fx@gnu.org>
parents:
diff changeset
74 @item C-x 3
Dave Love <fx@gnu.org>
parents:
diff changeset
75 Split the selected window into two windows positioned side by side
Dave Love <fx@gnu.org>
parents:
diff changeset
76 (@code{split-window-horizontally}).
Dave Love <fx@gnu.org>
parents:
diff changeset
77 @item C-Mouse-2
Dave Love <fx@gnu.org>
parents:
diff changeset
78 In the mode line or scroll bar of a window, split that window.
Dave Love <fx@gnu.org>
parents:
diff changeset
79 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
80
Dave Love <fx@gnu.org>
parents:
diff changeset
81 @kindex C-x 2
Dave Love <fx@gnu.org>
parents:
diff changeset
82 @findex split-window-vertically
Dave Love <fx@gnu.org>
parents:
diff changeset
83 The command @kbd{C-x 2} (@code{split-window-vertically}) breaks the
Dave Love <fx@gnu.org>
parents:
diff changeset
84 selected window into two windows, one above the other. Both windows start
Dave Love <fx@gnu.org>
parents:
diff changeset
85 out displaying the same buffer, with the same value of point. By default
Dave Love <fx@gnu.org>
parents:
diff changeset
86 the two windows each get half the height of the window that was split; a
Dave Love <fx@gnu.org>
parents:
diff changeset
87 numeric argument specifies how many lines to give to the top window.
Dave Love <fx@gnu.org>
parents:
diff changeset
88
Dave Love <fx@gnu.org>
parents:
diff changeset
89 @kindex C-x 3
Dave Love <fx@gnu.org>
parents:
diff changeset
90 @findex split-window-horizontally
Dave Love <fx@gnu.org>
parents:
diff changeset
91 @kbd{C-x 3} (@code{split-window-horizontally}) breaks the selected
Dave Love <fx@gnu.org>
parents:
diff changeset
92 window into two side-by-side windows. A numeric argument specifies how
56821
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
93 many columns to give the one on the left. If you are not using
64870
6bdeb6321248 (Split Window): Simplify phrase and mention vertical-border face.
Juri Linkov <juri@jurta.org>
parents: 60116
diff changeset
94 scrollbars, a vertical line separates the two windows.
6bdeb6321248 (Split Window): Simplify phrase and mention vertical-border face.
Juri Linkov <juri@jurta.org>
parents: 60116
diff changeset
95 You can customize its color with the face @code{vertical-border}.
56821
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
96 Windows that are not the full width of the screen have mode lines, but
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
97 they are truncated. On terminals where Emacs does not support
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
98 highlighting, truncated mode lines sometimes do not appear in inverse
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
99 video.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
100
Dave Love <fx@gnu.org>
parents:
diff changeset
101 @kindex C-Mouse-2 @r{(scroll bar)}
Dave Love <fx@gnu.org>
parents:
diff changeset
102 You can split a window horizontally or vertically by clicking
56821
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
103 @kbd{C-Mouse-2} in the mode line or the scroll bar. The line of
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
104 splitting goes through the place where you click: if you click on the
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
105 mode line, the new scroll bar goes above the spot; if you click in the
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
106 scroll bar, the mode line of the split window is side by side with
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
107 your click.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
108
Dave Love <fx@gnu.org>
parents:
diff changeset
109 @vindex truncate-partial-width-windows
60116
a07572b6589b (Split Window): Simplify line truncation info
Richard M. Stallman <rms@gnu.org>
parents: 59890
diff changeset
110 When a window is less than the full width, text lines too long to
a07572b6589b (Split Window): Simplify line truncation info
Richard M. Stallman <rms@gnu.org>
parents: 59890
diff changeset
111 fit are frequent. Continuing all those lines might be confusing, so
a07572b6589b (Split Window): Simplify line truncation info
Richard M. Stallman <rms@gnu.org>
parents: 59890
diff changeset
112 if the variable @code{truncate-partial-width-windows} is
a07572b6589b (Split Window): Simplify line truncation info
Richard M. Stallman <rms@gnu.org>
parents: 59890
diff changeset
113 non-@code{nil}, that forces truncation in all windows less than the
a07572b6589b (Split Window): Simplify line truncation info
Richard M. Stallman <rms@gnu.org>
parents: 59890
diff changeset
114 full width of the screen, independent of the buffer being displayed
72560
53d9c140485f (Split Window): Update xref.
Richard M. Stallman <rms@gnu.org>
parents: 68639
diff changeset
115 and its value for @code{truncate-lines}. @xref{Line Truncation}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
116
Dave Love <fx@gnu.org>
parents:
diff changeset
117 Horizontal scrolling is often used in side-by-side windows.
60116
a07572b6589b (Split Window): Simplify line truncation info
Richard M. Stallman <rms@gnu.org>
parents: 59890
diff changeset
118 @xref{Horizontal Scrolling}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
119
Dave Love <fx@gnu.org>
parents:
diff changeset
120 @vindex split-window-keep-point
37121
f9bd7ef13ddb Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 36875
diff changeset
121 If @code{split-window-keep-point} is non-@code{nil}, the default,
f9bd7ef13ddb Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 36875
diff changeset
122 both of the windows resulting from @kbd{C-x 2} inherit the value of
f9bd7ef13ddb Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 36875
diff changeset
123 point from the window that was split. This means that scrolling is
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
124 inevitable. If this variable is @code{nil}, then @kbd{C-x 2} tries to
37121
f9bd7ef13ddb Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 36875
diff changeset
125 avoid scrolling the text currently visible on the screen, by putting
f9bd7ef13ddb Minor changes.
Richard M. Stallman <rms@gnu.org>
parents: 36875
diff changeset
126 point in each window at a position already visible in the window. It
56404
ab69405dae2e (Split Window): Fix typo.
Luc Teirlinck <teirllm@auburn.edu>
parents: 52401
diff changeset
127 also selects whichever window contains the screen line that the cursor
68545
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
128 was previously on. Some users prefer that mode on slow terminals.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
129
Dave Love <fx@gnu.org>
parents:
diff changeset
130 @node Other Window
Dave Love <fx@gnu.org>
parents:
diff changeset
131 @section Using Other Windows
Dave Love <fx@gnu.org>
parents:
diff changeset
132
Dave Love <fx@gnu.org>
parents:
diff changeset
133 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
134 @item C-x o
Dave Love <fx@gnu.org>
parents:
diff changeset
135 Select another window (@code{other-window}). That is @kbd{o}, not zero.
Dave Love <fx@gnu.org>
parents:
diff changeset
136 @item C-M-v
Dave Love <fx@gnu.org>
parents:
diff changeset
137 Scroll the next window (@code{scroll-other-window}).
Dave Love <fx@gnu.org>
parents:
diff changeset
138 @item M-x compare-windows
Dave Love <fx@gnu.org>
parents:
diff changeset
139 Find next place where the text in the selected window does not match
Dave Love <fx@gnu.org>
parents:
diff changeset
140 the text in the next window.
Dave Love <fx@gnu.org>
parents:
diff changeset
141 @item Mouse-1
Dave Love <fx@gnu.org>
parents:
diff changeset
142 @kbd{Mouse-1}, in a window's mode line, selects that window
Dave Love <fx@gnu.org>
parents:
diff changeset
143 but does not move point in it (@code{mouse-select-window}).
Dave Love <fx@gnu.org>
parents:
diff changeset
144 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
145
Dave Love <fx@gnu.org>
parents:
diff changeset
146 @kindex C-x o
Dave Love <fx@gnu.org>
parents:
diff changeset
147 @findex other-window
Dave Love <fx@gnu.org>
parents:
diff changeset
148 To select a different window, click with @kbd{Mouse-1} on its mode
Dave Love <fx@gnu.org>
parents:
diff changeset
149 line. With the keyboard, you can switch windows by typing @kbd{C-x o}
36185
62cf166239f3 Change in quoting.
Richard M. Stallman <rms@gnu.org>
parents: 36182
diff changeset
150 (@code{other-window}). That is an @kbd{o}, for ``other,'' not a zero.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
151 When there are more than two windows, this command moves through all the
Dave Love <fx@gnu.org>
parents:
diff changeset
152 windows in a cyclic order, generally top to bottom and left to right.
Dave Love <fx@gnu.org>
parents:
diff changeset
153 After the rightmost and bottommost window, it goes back to the one at
Dave Love <fx@gnu.org>
parents:
diff changeset
154 the upper left corner. A numeric argument means to move several steps
Dave Love <fx@gnu.org>
parents:
diff changeset
155 in the cyclic order of windows. A negative argument moves around the
Dave Love <fx@gnu.org>
parents:
diff changeset
156 cycle in the opposite order. When the minibuffer is active, the
Dave Love <fx@gnu.org>
parents:
diff changeset
157 minibuffer is the last window in the cycle; you can switch from the
Dave Love <fx@gnu.org>
parents:
diff changeset
158 minibuffer window to one of the other windows, and later switch back and
Dave Love <fx@gnu.org>
parents:
diff changeset
159 finish supplying the minibuffer argument that is requested.
Dave Love <fx@gnu.org>
parents:
diff changeset
160 @xref{Minibuffer Edit}.
Dave Love <fx@gnu.org>
parents:
diff changeset
161
Dave Love <fx@gnu.org>
parents:
diff changeset
162 @kindex C-M-v
Dave Love <fx@gnu.org>
parents:
diff changeset
163 @findex scroll-other-window
Dave Love <fx@gnu.org>
parents:
diff changeset
164 The usual scrolling commands (@pxref{Display}) apply to the selected
Dave Love <fx@gnu.org>
parents:
diff changeset
165 window only, but there is one command to scroll the next window.
Dave Love <fx@gnu.org>
parents:
diff changeset
166 @kbd{C-M-v} (@code{scroll-other-window}) scrolls the window that
Dave Love <fx@gnu.org>
parents:
diff changeset
167 @kbd{C-x o} would select. It takes arguments, positive and negative,
Dave Love <fx@gnu.org>
parents:
diff changeset
168 like @kbd{C-v}. (In the minibuffer, @kbd{C-M-v} scrolls the window
Dave Love <fx@gnu.org>
parents:
diff changeset
169 that contains the minibuffer help display, if any, rather than the
Dave Love <fx@gnu.org>
parents:
diff changeset
170 next window in the standard cyclic order.)
Dave Love <fx@gnu.org>
parents:
diff changeset
171
Dave Love <fx@gnu.org>
parents:
diff changeset
172 The command @kbd{M-x compare-windows} lets you compare two files or
Dave Love <fx@gnu.org>
parents:
diff changeset
173 buffers visible in two windows, by moving through them to the next
Dave Love <fx@gnu.org>
parents:
diff changeset
174 mismatch. @xref{Comparing Files}, for details.
Dave Love <fx@gnu.org>
parents:
diff changeset
175
46208
19cf9993da08 Add mouse-autoselect-window.
Richard M. Stallman <rms@gnu.org>
parents: 39287
diff changeset
176 @vindex mouse-autoselect-window
19cf9993da08 Add mouse-autoselect-window.
Richard M. Stallman <rms@gnu.org>
parents: 39287
diff changeset
177 If you set @code{mouse-autoselect-window} to a non-@code{nil} value,
19cf9993da08 Add mouse-autoselect-window.
Richard M. Stallman <rms@gnu.org>
parents: 39287
diff changeset
178 moving the mouse into a different window selects that window. This
19cf9993da08 Add mouse-autoselect-window.
Richard M. Stallman <rms@gnu.org>
parents: 39287
diff changeset
179 feature is off by default.
19cf9993da08 Add mouse-autoselect-window.
Richard M. Stallman <rms@gnu.org>
parents: 39287
diff changeset
180
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
181 @node Pop Up Window
Dave Love <fx@gnu.org>
parents:
diff changeset
182 @section Displaying in Another Window
Dave Love <fx@gnu.org>
parents:
diff changeset
183
Dave Love <fx@gnu.org>
parents:
diff changeset
184 @cindex selecting buffers in other windows
Dave Love <fx@gnu.org>
parents:
diff changeset
185 @kindex C-x 4
Dave Love <fx@gnu.org>
parents:
diff changeset
186 @kbd{C-x 4} is a prefix key for commands that select another window
Dave Love <fx@gnu.org>
parents:
diff changeset
187 (splitting the window if there is only one) and select a buffer in that
Dave Love <fx@gnu.org>
parents:
diff changeset
188 window. Different @kbd{C-x 4} commands have different ways of finding the
Dave Love <fx@gnu.org>
parents:
diff changeset
189 buffer to select.
Dave Love <fx@gnu.org>
parents:
diff changeset
190
Dave Love <fx@gnu.org>
parents:
diff changeset
191 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
192 @item C-x 4 b @var{bufname} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
193 Select buffer @var{bufname} in another window. This runs
Dave Love <fx@gnu.org>
parents:
diff changeset
194 @code{switch-to-buffer-other-window}.
Dave Love <fx@gnu.org>
parents:
diff changeset
195 @item C-x 4 C-o @var{bufname} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
196 Display buffer @var{bufname} in another window, but
Dave Love <fx@gnu.org>
parents:
diff changeset
197 don't select that buffer or that window. This runs
Dave Love <fx@gnu.org>
parents:
diff changeset
198 @code{display-buffer}.
Dave Love <fx@gnu.org>
parents:
diff changeset
199 @item C-x 4 f @var{filename} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
200 Visit file @var{filename} and select its buffer in another window. This
Dave Love <fx@gnu.org>
parents:
diff changeset
201 runs @code{find-file-other-window}. @xref{Visiting}.
Dave Love <fx@gnu.org>
parents:
diff changeset
202 @item C-x 4 d @var{directory} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
203 Select a Dired buffer for directory @var{directory} in another window.
Dave Love <fx@gnu.org>
parents:
diff changeset
204 This runs @code{dired-other-window}. @xref{Dired}.
Dave Love <fx@gnu.org>
parents:
diff changeset
205 @item C-x 4 m
Dave Love <fx@gnu.org>
parents:
diff changeset
206 Start composing a mail message in another window. This runs
Dave Love <fx@gnu.org>
parents:
diff changeset
207 @code{mail-other-window}; its same-window analogue is @kbd{C-x m}
Dave Love <fx@gnu.org>
parents:
diff changeset
208 (@pxref{Sending Mail}).
Dave Love <fx@gnu.org>
parents:
diff changeset
209 @item C-x 4 .
Dave Love <fx@gnu.org>
parents:
diff changeset
210 Find a tag in the current tags table, in another window. This runs
Dave Love <fx@gnu.org>
parents:
diff changeset
211 @code{find-tag-other-window}, the multiple-window variant of @kbd{M-.}
Dave Love <fx@gnu.org>
parents:
diff changeset
212 (@pxref{Tags}).
Dave Love <fx@gnu.org>
parents:
diff changeset
213 @item C-x 4 r @var{filename} @key{RET}
Dave Love <fx@gnu.org>
parents:
diff changeset
214 Visit file @var{filename} read-only, and select its buffer in another
Dave Love <fx@gnu.org>
parents:
diff changeset
215 window. This runs @code{find-file-read-only-other-window}.
Dave Love <fx@gnu.org>
parents:
diff changeset
216 @xref{Visiting}.
Dave Love <fx@gnu.org>
parents:
diff changeset
217 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
218
Dave Love <fx@gnu.org>
parents:
diff changeset
219 @node Force Same Window
Dave Love <fx@gnu.org>
parents:
diff changeset
220 @section Forcing Display in the Same Window
Dave Love <fx@gnu.org>
parents:
diff changeset
221
Dave Love <fx@gnu.org>
parents:
diff changeset
222 Certain Emacs commands switch to a specific buffer with special
Dave Love <fx@gnu.org>
parents:
diff changeset
223 contents. For example, @kbd{M-x shell} switches to a buffer named
66581
fc256e77595d * files.texi (Compressed Files): Fix typo.
Romain Francoise <romain@orebokech.com>
parents: 64890
diff changeset
224 @samp{*shell*}. By convention, all these commands are written to pop up
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
225 the buffer in a separate window. But you can specify that certain of
Dave Love <fx@gnu.org>
parents:
diff changeset
226 these buffers should appear in the selected window.
Dave Love <fx@gnu.org>
parents:
diff changeset
227
Dave Love <fx@gnu.org>
parents:
diff changeset
228 @vindex same-window-buffer-names
Dave Love <fx@gnu.org>
parents:
diff changeset
229 If you add a buffer name to the list @code{same-window-buffer-names},
Dave Love <fx@gnu.org>
parents:
diff changeset
230 the effect is that such commands display that particular buffer by
Dave Love <fx@gnu.org>
parents:
diff changeset
231 switching to it in the selected window. For example, if you add the
Dave Love <fx@gnu.org>
parents:
diff changeset
232 element @code{"*grep*"} to the list, the @code{grep} command will
Dave Love <fx@gnu.org>
parents:
diff changeset
233 display its output buffer in the selected window.
Dave Love <fx@gnu.org>
parents:
diff changeset
234
Dave Love <fx@gnu.org>
parents:
diff changeset
235 The default value of @code{same-window-buffer-names} is not
Dave Love <fx@gnu.org>
parents:
diff changeset
236 @code{nil}: it specifies buffer names @samp{*info*}, @samp{*mail*} and
Dave Love <fx@gnu.org>
parents:
diff changeset
237 @samp{*shell*} (as well as others used by more obscure Emacs packages).
Dave Love <fx@gnu.org>
parents:
diff changeset
238 This is why @kbd{M-x shell} normally switches to the @samp{*shell*}
Dave Love <fx@gnu.org>
parents:
diff changeset
239 buffer in the selected window. If you delete this element from the
Dave Love <fx@gnu.org>
parents:
diff changeset
240 value of @code{same-window-buffer-names}, the behavior of @kbd{M-x
Dave Love <fx@gnu.org>
parents:
diff changeset
241 shell} will change---it will pop up the buffer in another window
Dave Love <fx@gnu.org>
parents:
diff changeset
242 instead.
Dave Love <fx@gnu.org>
parents:
diff changeset
243
Dave Love <fx@gnu.org>
parents:
diff changeset
244 @vindex same-window-regexps
Dave Love <fx@gnu.org>
parents:
diff changeset
245 You can specify these buffers more generally with the variable
Dave Love <fx@gnu.org>
parents:
diff changeset
246 @code{same-window-regexps}. Set it to a list of regular expressions;
Dave Love <fx@gnu.org>
parents:
diff changeset
247 then any buffer whose name matches one of those regular expressions is
Dave Love <fx@gnu.org>
parents:
diff changeset
248 displayed by switching to it in the selected window. (Once again, this
Dave Love <fx@gnu.org>
parents:
diff changeset
249 applies only to buffers that normally get displayed for you in a
Dave Love <fx@gnu.org>
parents:
diff changeset
250 separate window.) The default value of this variable specifies Telnet
Dave Love <fx@gnu.org>
parents:
diff changeset
251 and rlogin buffers.
Dave Love <fx@gnu.org>
parents:
diff changeset
252
Dave Love <fx@gnu.org>
parents:
diff changeset
253 An analogous feature lets you specify buffers which should be
Dave Love <fx@gnu.org>
parents:
diff changeset
254 displayed in their own individual frames. @xref{Special Buffer Frames}.
Dave Love <fx@gnu.org>
parents:
diff changeset
255
Dave Love <fx@gnu.org>
parents:
diff changeset
256 @node Change Window
Dave Love <fx@gnu.org>
parents:
diff changeset
257 @section Deleting and Rearranging Windows
Dave Love <fx@gnu.org>
parents:
diff changeset
258
Dave Love <fx@gnu.org>
parents:
diff changeset
259 @table @kbd
Dave Love <fx@gnu.org>
parents:
diff changeset
260 @item C-x 0
Dave Love <fx@gnu.org>
parents:
diff changeset
261 Delete the selected window (@code{delete-window}). The last character
Dave Love <fx@gnu.org>
parents:
diff changeset
262 in this key sequence is a zero.
Dave Love <fx@gnu.org>
parents:
diff changeset
263 @item C-x 1
Dave Love <fx@gnu.org>
parents:
diff changeset
264 Delete all windows in the selected frame except the selected window
Dave Love <fx@gnu.org>
parents:
diff changeset
265 (@code{delete-other-windows}).
Dave Love <fx@gnu.org>
parents:
diff changeset
266 @item C-x 4 0
Dave Love <fx@gnu.org>
parents:
diff changeset
267 Delete the selected window and kill the buffer that was showing in it
Dave Love <fx@gnu.org>
parents:
diff changeset
268 (@code{kill-buffer-and-window}). The last character in this key
Dave Love <fx@gnu.org>
parents:
diff changeset
269 sequence is a zero.
Dave Love <fx@gnu.org>
parents:
diff changeset
270 @item C-x ^
Dave Love <fx@gnu.org>
parents:
diff changeset
271 Make selected window taller (@code{enlarge-window}).
Dave Love <fx@gnu.org>
parents:
diff changeset
272 @item C-x @}
Dave Love <fx@gnu.org>
parents:
diff changeset
273 Make selected window wider (@code{enlarge-window-horizontally}).
Dave Love <fx@gnu.org>
parents:
diff changeset
274 @item C-x @{
Dave Love <fx@gnu.org>
parents:
diff changeset
275 Make selected window narrower (@code{shrink-window-horizontally}).
Dave Love <fx@gnu.org>
parents:
diff changeset
276 @item C-x -
Dave Love <fx@gnu.org>
parents:
diff changeset
277 Shrink this window if its buffer doesn't need so many lines
Dave Love <fx@gnu.org>
parents:
diff changeset
278 (@code{shrink-window-if-larger-than-buffer}).
Dave Love <fx@gnu.org>
parents:
diff changeset
279 @item C-x +
Dave Love <fx@gnu.org>
parents:
diff changeset
280 Make all windows the same height (@code{balance-windows}).
Dave Love <fx@gnu.org>
parents:
diff changeset
281 @end table
Dave Love <fx@gnu.org>
parents:
diff changeset
282
Dave Love <fx@gnu.org>
parents:
diff changeset
283 @kindex C-x 0
Dave Love <fx@gnu.org>
parents:
diff changeset
284 @findex delete-window
Dave Love <fx@gnu.org>
parents:
diff changeset
285 To delete a window, type @kbd{C-x 0} (@code{delete-window}). (That is
Dave Love <fx@gnu.org>
parents:
diff changeset
286 a zero.) The space occupied by the deleted window is given to an
Dave Love <fx@gnu.org>
parents:
diff changeset
287 adjacent window (but not the minibuffer window, even if that is active
Dave Love <fx@gnu.org>
parents:
diff changeset
288 at the time). Once a window is deleted, its attributes are forgotten;
Dave Love <fx@gnu.org>
parents:
diff changeset
289 only restoring a window configuration can bring it back. Deleting the
Dave Love <fx@gnu.org>
parents:
diff changeset
290 window has no effect on the buffer it used to display; the buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
291 continues to exist, and you can select it in any window with @kbd{C-x
Dave Love <fx@gnu.org>
parents:
diff changeset
292 b}.
Dave Love <fx@gnu.org>
parents:
diff changeset
293
Dave Love <fx@gnu.org>
parents:
diff changeset
294 @findex kill-buffer-and-window
Dave Love <fx@gnu.org>
parents:
diff changeset
295 @kindex C-x 4 0
Dave Love <fx@gnu.org>
parents:
diff changeset
296 @kbd{C-x 4 0} (@code{kill-buffer-and-window}) is a stronger command
Dave Love <fx@gnu.org>
parents:
diff changeset
297 than @kbd{C-x 0}; it kills the current buffer and then deletes the
Dave Love <fx@gnu.org>
parents:
diff changeset
298 selected window.
Dave Love <fx@gnu.org>
parents:
diff changeset
299
Dave Love <fx@gnu.org>
parents:
diff changeset
300 @kindex C-x 1
Dave Love <fx@gnu.org>
parents:
diff changeset
301 @findex delete-other-windows
Dave Love <fx@gnu.org>
parents:
diff changeset
302 @kbd{C-x 1} (@code{delete-other-windows}) is more powerful in a
Dave Love <fx@gnu.org>
parents:
diff changeset
303 different way; it deletes all the windows except the selected one (and
Dave Love <fx@gnu.org>
parents:
diff changeset
304 the minibuffer); the selected window expands to use the whole frame
Dave Love <fx@gnu.org>
parents:
diff changeset
305 except for the echo area.
Dave Love <fx@gnu.org>
parents:
diff changeset
306
Dave Love <fx@gnu.org>
parents:
diff changeset
307 @kindex C-x ^
Dave Love <fx@gnu.org>
parents:
diff changeset
308 @findex enlarge-window
Dave Love <fx@gnu.org>
parents:
diff changeset
309 @kindex C-x @}
Dave Love <fx@gnu.org>
parents:
diff changeset
310 @findex enlarge-window-horizontally
Dave Love <fx@gnu.org>
parents:
diff changeset
311 @vindex window-min-height
Dave Love <fx@gnu.org>
parents:
diff changeset
312 @vindex window-min-width
Dave Love <fx@gnu.org>
parents:
diff changeset
313 To readjust the division of space among vertically adjacent windows,
Dave Love <fx@gnu.org>
parents:
diff changeset
314 use @kbd{C-x ^} (@code{enlarge-window}). It makes the currently
68545
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
315 selected window one line bigger, or as many lines as is specified
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
316 with a numeric argument. With a negative argument, it makes the
Dave Love <fx@gnu.org>
parents:
diff changeset
317 selected window smaller. @kbd{C-x @}}
Dave Love <fx@gnu.org>
parents:
diff changeset
318 (@code{enlarge-window-horizontally}) makes the selected window wider by
Dave Love <fx@gnu.org>
parents:
diff changeset
319 the specified number of columns. @kbd{C-x @{}
Dave Love <fx@gnu.org>
parents:
diff changeset
320 (@code{shrink-window-horizontally}) makes the selected window narrower
Dave Love <fx@gnu.org>
parents:
diff changeset
321 by the specified number of columns.
Dave Love <fx@gnu.org>
parents:
diff changeset
322
68545
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
323 When you make a window bigger, the space comes from its peers. If
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
324 this makes any window too small, it is deleted and its space is given
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
325 to an adjacent window. The minimum size is specified by the variables
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
326 @code{window-min-height} and @code{window-min-width}.
25829
Dave Love <fx@gnu.org>
parents:
diff changeset
327
Dave Love <fx@gnu.org>
parents:
diff changeset
328 @kindex C-x -
Dave Love <fx@gnu.org>
parents:
diff changeset
329 @findex shrink-window-if-larger-than-buffer
Dave Love <fx@gnu.org>
parents:
diff changeset
330 The command @kbd{C-x -} (@code{shrink-window-if-larger-than-buffer})
Dave Love <fx@gnu.org>
parents:
diff changeset
331 reduces the height of the selected window, if it is taller than
Dave Love <fx@gnu.org>
parents:
diff changeset
332 necessary to show the whole text of the buffer it is displaying. It
Dave Love <fx@gnu.org>
parents:
diff changeset
333 gives the extra lines to other windows in the frame.
Dave Love <fx@gnu.org>
parents:
diff changeset
334
Dave Love <fx@gnu.org>
parents:
diff changeset
335 @kindex C-x +
Dave Love <fx@gnu.org>
parents:
diff changeset
336 @findex balance-windows
Dave Love <fx@gnu.org>
parents:
diff changeset
337 You can also use @kbd{C-x +} (@code{balance-windows}) to even out the
Dave Love <fx@gnu.org>
parents:
diff changeset
338 heights of all the windows in the selected frame.
Dave Love <fx@gnu.org>
parents:
diff changeset
339
68545
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
340 Mouse clicks on the mode line provide another way to change window
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
341 heights and to delete windows. @xref{Mode Line Mouse}.
c93440097bdb Minor clarifications.
Richard M. Stallman <rms@gnu.org>
parents: 66581
diff changeset
342
28551
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
343 @node Window Convenience
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
344 @section Window Handling Convenience Features and Customization
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
345
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
346 @findex winner-mode
30875
e86dbf76e699 mainly indexing
Dave Love <fx@gnu.org>
parents: 28796
diff changeset
347 @cindex Winner mode
e86dbf76e699 mainly indexing
Dave Love <fx@gnu.org>
parents: 28796
diff changeset
348 @cindex mode, Winner
28551
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
349 @cindex undoing window configuration changes
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
350 @cindex window configuration changes, undoing
36182
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
351 @kbd{M-x winner-mode} is a global minor mode that records the
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
352 changes in the window configuration (i.e. how the frames are
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
353 partitioned into windows), so that you can ``undo'' them. To undo,
56821
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
354 use @kbd{C-c left} (@code{winner-undo}). If you change your mind
a6b7cffd2a54 (Basic Window): When using a window system, the value of point in a
Luc Teirlinck <teirllm@auburn.edu>
parents: 56404
diff changeset
355 while undoing, you can redo the changes you had undone using @kbd{C-c
36182
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
356 right} (@code{M-x winner-redo}). Another way to enable Winner mode is
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
357 by customizing the variable @code{winner-mode}.
28551
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
358
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
359 @cindex Windmove package
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
360 @cindex directional window selection
30875
e86dbf76e699 mainly indexing
Dave Love <fx@gnu.org>
parents: 28796
diff changeset
361 @findex windmove-right
e86dbf76e699 mainly indexing
Dave Love <fx@gnu.org>
parents: 28796
diff changeset
362 @findex windmove-default-keybindings
39268
5a3dae2132b4 Spelling correction.
Richard M. Stallman <rms@gnu.org>
parents: 37986
diff changeset
363 The Windmove commands move directionally between neighboring windows in
30875
e86dbf76e699 mainly indexing
Dave Love <fx@gnu.org>
parents: 28796
diff changeset
364 a frame. @kbd{M-x windmove-right} selects the window immediately to the
36182
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
365 right of the currently selected one, and similarly for the ``left,'' ``up,''
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
366 and ``down'' counterparts. @kbd{M-x windmove-default-keybindings} binds
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
367 these commands to @kbd{S-right} etc. (Not all terminals support shifted
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
368 arrow keys, however.)
28551
d212ead1f461 No resize-minibuffer.
Dave Love <fx@gnu.org>
parents: 25829
diff changeset
369
36182
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
370 Follow minor mode (@kbd{M-x follow-mode}) synchronizes several
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
371 windows on the same buffer so that they always display adjacent
36263
11db0318031d Remove redundant index entries.
Eli Zaretskii <eliz@gnu.org>
parents: 36185
diff changeset
372 sections of that buffer. @xref{Follow Mode}.
36182
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
373
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
374 @vindex scroll-all-mode
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
375 @cindex scrolling windows together
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
376 @cindex Scroll-all mode
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
377 @cindex mode, Scroll-all
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
378 @kbd{M-x scroll-all-mode} provides commands to scroll all visible
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
379 windows together. You can also turn it on by customizing the variable
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
380 @code{scroll-all-mode}. The commands provided are @kbd{M-x
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
381 scroll-all-scroll-down-all}, @kbd{M-x scroll-all-page-down-all} and
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
382 their corresponding ``up'' equivalents. To make this mode useful,
add12d9a298a Major rewrite in Window Convenience node.
Richard M. Stallman <rms@gnu.org>
parents: 35954
diff changeset
383 you should bind these commands to appropriate keys.
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46208
diff changeset
384
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46208
diff changeset
385 @ignore
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46208
diff changeset
386 arch-tag: 8bea7453-d4b1-49b1-9bf4-cfe4383e1113
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 46208
diff changeset
387 @end ignore