annotate man/windows.texi @ 30767:7dc7bfb39bca

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