[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Emacs can split a frame into two or many windows. Multiple windows can display parts of different buffers, or different parts of one buffer. Multiple frames always imply multiple windows, because each frame has its own set of windows. Each window belongs to one and only one frame.
1.1 Concepts of Emacs Windows | Introduction to Emacs windows. | |
1.2 Splitting Windows | New windows are made by splitting existing windows. | |
1.3 Using Other Windows | Moving to another window or doing something to it. | |
1.4 Displaying in Another Window | Finding a file or buffer in another window. | |
1.5 Deleting and Rearranging Windows | Deleting windows and changing their sizes. |
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Each Emacs window displays one Emacs buffer at any time. A single buffer may appear in more than one window; if it does, any changes in its text are displayed in all the windows where it appears. But the windows showing the same buffer can show different parts of it, because each window has its own value of point.
At any time, one of the windows is the selected window; the buffer this window is displaying is the current buffer. The terminal’s cursor shows the location of point in this window. Each other window has a location of point as well, but since the terminal has only one cursor there is no way to show where those locations are. When you make multiple frames, each frame has a cursor which appears in the frame’s selected window. The cursor in the selected frame is solid; the cursor in other frames is a hollow box.
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, even one showing the same buffer. The same is true for commands
such as 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 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) C-h f (describe-function
) and C-x C-b
(list-buffers
), work by switching buffers in a nonselected window
without affecting the selected window.
When multiple windows show the same buffer, they can have different regions, because they can have different values of point. This means that in Transient Mark mode, each window highlights a different part of the buffer. The part that is highlighted in the selected window is the region that editing commands use.
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 full details on the mode line.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Split the selected window into two windows, one above the other
(split-window-vertically
).
Split the selected window into two windows positioned side by side
(split-window-horizontally
).
In the mode line or scroll bar of a window, split that window.
The command C-x 2 (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
the two windows each get half the height of the window that was split; a
numeric argument specifies how many lines to give to the top window.
C-x 3 (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
screen have mode lines, but they are truncated; also, they do not
always appear in inverse video, because the Emacs display routines
have not been taught how to display a region of inverse video that is
only part of a line on the screen.
You can split a window horizontally or vertically by clicking C-Mouse-2 in the mode line or the scroll bar. The line of splitting goes through the place where you click: if you click on the mode line, the new scroll bar goes above the spot; if you click in the scroll bar, the mode line of the split window is side by side with your click.
When a window is less than the full width, text lines too long to fit are
frequent. Continuing all those lines might be confusing. The variable
truncate-partial-width-windows
can be set non-nil
to force
truncation in all windows less than the full width of the screen,
independent of the buffer being displayed and its value for
truncate-lines
. @xref{Continuation Lines}.
Horizontal scrolling is often used in side-by-side windows. @xref{Display}.
If split-window-keep-point
is non-nil, C-x 2 tries to
avoid shifting any text on the screen by putting point in whichever
window happens to contain the screen line the cursor is already on. The
default is that split-window-keep-point
is non-nil on slow
terminals.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Select another window (other-window
). That is o, not zero.
Scroll the next window (scroll-other-window
).
Find next place where the text in the selected window does not match the text in the next window.
Mouse-1, in a window’s mode line, selects that window
but does not move point in it (mouse-select-region
).
To select a different window, click with Mouse-1 on its mode
line. With the keyboard, you can switch windows by typing C-x o
(other-window
). That is an o, for ‘other’, not a zero.
When there are more than two windows, this command moves through all the
windows in a cyclic order, generally top to bottom and left to right.
After the rightmost and bottommost window, it goes back to the one at
the upper left corner. A numeric argument means to move several steps
in the cyclic order of windows. A negative argument moves around the
cycle in the opposite order. 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}.
The usual scrolling commands (@pxref{Display}) apply to the selected
window only, but there is one command to scroll the next window.
C-M-v (scroll-other-window
) scrolls the window that
C-x o would select. It takes arguments, positive and negative,
like C-v. (In the minibuffer, C-M-v scrolls the window
that contains the minibuffer help display, if any, rather than the
next window in the standard cyclic order.)
The command M-x compare-windows
lets you compare two files or
buffers visible in two windows, by moving through them to the next
mismatch. @xref{Comparing Files}, for details.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
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 C-x 4 commands have different ways of finding the buffer to select.
Select buffer bufname in another window. This runs
switch-to-buffer-other-window
.
Display buffer bufname in another window, but
don’t select that buffer or that window. This runs
display-buffer
.
Visit file filename and select its buffer in another window. This
runs find-file-other-window
. @xref{Visiting}.
Select a Dired buffer for directory directory in another window.
This runs dired-other-window
. @xref{Dired}.
Start composing a mail message in another window. This runs
mail-other-window
; its same-window analogue is C-x m
(@pxref{Sending Mail}).
Find a tag in the current tags table, in another window. This runs
find-tag-other-window
, the multiple-window variant of M-.
(@pxref{Tags}).
Visit file filename read-only, and select its buffer in another
window. This runs find-file-read-only-other-window
.
@xref{Visiting}.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Delete the selected window (delete-window
). That is a zero.
Delete all windows in the selected frame except the selected window
(delete-other-windows
).
Make selected window taller (enlarge-window
).
Make selected window wider (enlarge-window-horizontally
).
Mouse-2 in a window’s mode line deletes all other windows in the frame
(mouse-delete-other-windows
).
Mouse-3 in a window’s mode line deletes that window
(mouse-delete-window
).
To delete a window, type C-x 0 (delete-window
). (That is
a zero.) The space occupied by the deleted window is given to an
adjacent window (but not the minibuffer window, even if that is active
at the time). Once a window is deleted, its attributes are forgotten;
only restoring a window configuration can bring it back. Deleting the
window has no effect on the buffer it used to display; the buffer
continues to exist, and you can select it in any window with C-x
b.
C-x 1 (delete-other-windows
) is more powerful than
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.
You can also delete a window by clicking on its mode line with Mouse-2, and expand a window to full screen by clicking on its mode line with Mouse-3.
To readjust the division of space among vertically adjacent windows,
use C-x ^ (enlarge-window
). It makes the currently
selected window get one line bigger, or as many lines as is specified
with a numeric argument. With a negative argument, it makes the
selected window smaller. C-x }
(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. If this
makes any window too small, it is deleted and its space is given to an
adjacent window. The minimum size is specified by the variables
window-min-height
and window-min-width
.
@xref{Minibuffer Edit}, for information about the Resize-Minibuffer mode, which automatically changes the size of the minibuffer window to fit the text in the minibuffer.
[Top] | [Contents] | [Index] | [ ? ] |
This document was generated on January 15, 2023 using texi2html 5.0.
The buttons in the navigation panels have the following meaning:
Button | Name | Go to | From 1.2.3 go to |
---|---|---|---|
[ << ] | FastBack | Beginning of this chapter or previous chapter | 1 |
[ < ] | Back | Previous section in reading order | 1.2.2 |
[ Up ] | Up | Up section | 1.2 |
[ > ] | Forward | Next section in reading order | 1.2.4 |
[ >> ] | FastForward | Next chapter | 2 |
[Top] | Top | Cover (top) of document | |
[Contents] | Contents | Table of contents | |
[Index] | Index | Index | |
[ ? ] | About | About (help) |
where the Example assumes that the current position is at Subsubsection One-Two-Three of a document of the following structure:
This document was generated on January 15, 2023 using texi2html 5.0.