This is Info file ../info/emacs, produced by Makeinfo-1.55 from the
input file emacs.texi.


File: emacs,  Node: List Buffers,  Next: Misc Buffer,  Prev: Select Buffer,  Up: Buffers

Listing Existing Buffers
========================

`C-x C-b'
     List the existing buffers (`list-buffers').

   To display a list of all the buffers that exist, type `C-x C-b'.
Each line in the list shows one buffer's name, major mode and visited
file.  The buffers are listed in the order, most recently visited first.

   `*' at the beginning of a line indicates the buffer is "modified".
If several buffers are modified, it may be time to save some with `C-x
s' (*note Saving::.).  `%' indicates a read-only buffer.  `.' marks the
selected buffer.  Here is an example of a buffer list:

      MR Buffer         Size  Mode           File
      -- ------         ----  ----           ----
     .*  emacs.tex      383402 Texinfo       /u2/emacs/man/emacs.tex
         *Help*         1287  Fundamental
         files.el       23076 Emacs-Lisp     /u2/emacs/lisp/files.el
       % RMAIL          64042 RMAIL          /u/rms/RMAIL
      *% man            747   Dired          /u2/emacs/man/
         net.emacs      343885 Fundamental   /u/rms/net.emacs
         fileio.c       27691 C              /u2/emacs/src/fileio.c
         NEWS           67340 Text           /u2/emacs/etc/NEWS
         *scratch*	   0	 Lisp Interaction

Note that the buffer `*Help*' was made by a help request; it is not
visiting any file.  The buffer `man' was made by Dired on the directory
`/u2/emacs/man/'.


File: emacs,  Node: Misc Buffer,  Next: Kill Buffer,  Prev: List Buffers,  Up: Buffers

Miscellaneous Buffer Operations
===============================

`C-x C-q'
     Toggle read-only status of buffer (`vc-toggle-read-only').

`M-x rename-buffer RET NAME RET'
     Change the name of the current buffer.

`M-x rename-uniquely'
     Rename the current buffer by adding `<NUMBER>' to the end.

`M-x view-buffer RET BUFFER RET'
     Scroll through buffer BUFFER.

   A buffer can be "read-only", which means that commands to change its
contents are not allowed.  The mode line indicates read-only buffers
with `%%' or `%*' near the left margin.  Read-only buffers are usually
made by subsystems such as Dired and Rmail that have special commands
to operate on the text; also by visiting a file whose access control
says you cannot write it.

   If you wish to make changes in a read-only buffer, use the command
`C-x C-q' (`vc-toggle-read-only').  It makes a read-only buffer
writable, and makes a writable buffer read-only.  In most cases, this
works by setting the variable `buffer-read-only', which has a local
value in each buffer and makes the buffer read-only if its value is
non-`nil'.  If the file is maintained with version control, `C-x C-q'
works through the version control system to change the read-only status
of the file as well as the buffer.  *Note Version Control::.

   `M-x rename-buffer' changes the name of the current buffer.  Specify
the new name as a minibuffer argument.  There is no default.  If you
specify a name that is in use for some other buffer, an error happens
and no renaming is done.

   `M-x rename-uniquely' renames the current buffer to a similar name
with a numeric suffix added to make it both different and unique.  This
command does not need an argument.  It is useful for creating multiple
shell buffers: if you rename the `*Shell*' buffer, then do `M-x shell'
again, it makes a new shell buffer named `*Shell*'; meanwhile, the old
shell buffer continues to exist under its new name.  This method is
also good for mail buffers, compilation buffers, and most Emacs
features that create special buffers with particular names.

   `M-x view-buffer' is much like `M-x view-file' (*note Misc File
Ops::.) except that it examines an already existing Emacs buffer.  View
mode provides commands for scrolling through the buffer conveniently
but not for changing it.  When you exit View mode, the value of point
that resulted from your perusal remains in effect.

   The commands `M-x append-to-buffer' and `M-x insert-buffer' can be
used to copy text from one buffer to another.  *Note Accumulating
Text::.


File: emacs,  Node: Kill Buffer,  Next: Several Buffers,  Prev: Misc Buffer,  Up: Buffers

Killing Buffers
===============

   If you continue an Emacs session for a while, you may accumulate a
large number of buffers.  You may then find it convenient to "kill" the
buffers you no longer need.  On most operating systems, killing a
buffer releases its space back to the operating system so that other
programs can use it.  Here are some commands for killing buffers:

`C-x k BUFNAME RET'
     Kill buffer BUFNAME (`kill-buffer').

`M-x kill-some-buffers'
     Offer to kill each buffer, one by one.

   `C-x k' (`kill-buffer') kills one buffer, whose name you specify in
the minibuffer.  The default, used if you type just RET in the
minibuffer, is to kill the current buffer.  If you kill the current
buffer, another buffer is selected; one that has been selected recently
but does not appear in any window now.  If you ask to kill a
file-visiting buffer that is modified (has unsaved editing), then you
must confirm with `yes' before the buffer is killed.

   The command `M-x kill-some-buffers' asks about each buffer, one by
one.  An answer of `y' means to kill the buffer.  Killing the current
buffer or a buffer containing unsaved changes selects a new buffer or
asks for confirmation just like `kill-buffer'.

   The buffer menu feature (*note Several Buffers::.) is also convenient
for killing various buffers.

   If you want to do something special every time a buffer is killed,
you can add hook functions to the hook `kill-buffer-hook' (*note
Hooks::.).


File: emacs,  Node: Several Buffers,  Next: Indirect Buffers,  Prev: Kill Buffer,  Up: Buffers

Operating on Several Buffers
============================

   The "buffer-menu" facility is like a "Dired for buffers"; it allows
you to request operations on various Emacs buffers by editing an Emacs
buffer containing a list of them.  You can save buffers, kill them
(here called "deleting" them, for consistency with Dired), or display
them.

`M-x buffer-menu'
     Begin editing a buffer listing all Emacs buffers.

   The command `buffer-menu' writes a list of all Emacs buffers into
the buffer `*Buffer List*', and selects that buffer in Buffer Menu
mode.  The buffer is read-only, and can be changed only through the
special commands described in this section.  The usual Emacs cursor
motion commands can be used in the `*Buffer List*' buffer.  The
following commands apply to the buffer described on the current line.

`d'
     Request to delete (kill) the buffer, then move down.  The request
     shows as a `D' on the line, before the buffer name.  Requested
     deletions take place when you type the `x' command.

`C-d'
     Like `d' but move up afterwards instead of down.

`s'
     Request to save the buffer.  The request shows as an `S' on the
     line.  Requested saves take place when you type the `x' command.
     You may request both saving and deletion for the same buffer.

`x'
     Perform previously requested deletions and saves.

`u'
     Remove any request made for the current line, and move down.

`DEL'
     Move to previous line and remove any request made for that line.

   The `d', `C-d', `s' and `u' commands to add or remove flags also
move down (or up) one line.  They accept a numeric argument as a repeat
count.

   These commands operate immediately on the buffer listed on the
current line:

`~'
     Mark the buffer "unmodified".  The command `~' does this
     immediately when you type it.

`%'
     Toggle the buffer's read-only flag.  The command `%' does this
     immediately when you type it.

`t'
     Visit the buffer as a tags table.  *Note Select Tags Table::.

   There are also commands to select another buffer or buffers:

`q'
     Quit the buffer menu--immediately display the most recent formerly
     visible buffer in its place.

`RET'
`f'
     Immediately select this line's buffer in place of the `*Buffer
     List*' buffer.

`o'
     Immediately select this line's buffer in another window as if by
     `C-x 4 b', leaving `*Buffer List*' visible.

`C-o'
     Immediately display this line's buffer in another window, but don't
     select the window.

`1'
     Immediately select this line's buffer in a full-screen window.

`2'
     Immediately set up two windows, with this line's buffer in one,
     and the previously selected buffer (aside from the buffer `*Buffer
     List*') in the other.

`m'
     Mark this line's buffer to be displayed in another window if you
     exit with the `v' command.  The request shows as a `>' at the
     beginning of the line.  (A single buffer may not have both a delete
     request and a display request.)

`v'
     Immediately select this line's buffer, and also display in other
     windows any buffers previously marked with the `m' command.  If
     you have not marked any buffers, this command is equivalent to `1'.

   All that `buffer-menu' does directly is create and switch to a
suitable buffer, and turn on Buffer Menu mode.  Everything else
described above is implemented by the special commands provided in
Buffer Menu mode.  One consequence of this is that you can switch from
the `*Buffer List*' buffer to another Emacs buffer, and edit there.
You can reselect the `*Buffer List*' buffer later, to perform the
operations already requested, or you can kill it, or pay no further
attention to it.

   The only difference between `buffer-menu' and `list-buffers' is that
`buffer-menu' switches to the `*Buffer List*' buffer in the selected
window; `list-buffers' displays it in another window.  If you run
`list-buffers' (that is, type `C-x C-b') and select the buffer list
manually, you can use all of the commands described here.

   The buffer `*Buffer List*' is not updated automatically when buffers
are created and killed; its contents are just text.  If you have
created, deleted or renamed buffers, the way to update `*Buffer List*'
to show what you have done is to type `g' (`revert-buffer') or repeat
the `buffer-menu' command.


File: emacs,  Node: Indirect Buffers,  Prev: Several Buffers,  Up: Buffers

Indirect Buffers
================

   An "indirect buffer" shares the text of some other buffer, which is
called the "base buffer" of the indirect buffer.  In some ways it is
the analogue, for buffers, of a symbolic link between files.

`M-x make-indirect-buffer BASE-BUFFER RET INDIRECT-NAME RET'
     Create an indirect buffer named INDIRECT-NAME whose base buffer is
     BASE-BUFFER.

   The text of the indirect buffer is always identical to the text of
its base buffer; changes made by editing either one are visible
immediately in the other.  But in all other respects, the indirect
buffer and its base buffer are completely separate.  They have
different names, different values of point, different narrowing,
different markers, different major modes, and different local variables.

   An indirect buffer cannot visit a file, but its base buffer can.  If
you try to save the indirect buffer, that actually works by saving the
base buffer.  Killing the base buffer effectively kills the indirect
buffer, but killing an indirect buffer has no effect on its base buffer.

   One way to use indirect buffers is to display multiple views of an
outline.  *Note Outline Views::.


File: emacs,  Node: Windows,  Next: Frames,  Prev: Buffers,  Up: Top

Multiple Windows
****************

   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.

* Menu:

* Basic Window::       Introduction to Emacs windows.
* Split Window::       New windows are made by splitting existing windows.
* Other Window::       Moving to another window or doing something to it.
* Pop Up Window::      Finding a file or buffer in another window.
* Force Same Window::  Forcing certain buffers to appear in the selected
                         window rather than in another window.
* Change Window::      Deleting windows and changing their sizes.


File: emacs,  Node: Basic Window,  Next: Split Window,  Up: Windows

Concepts of Emacs Windows
=========================

   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 multiple
frames are visible in X Windows, 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.  *Note Mode Line::, for full details on the
mode line.


File: emacs,  Node: Split Window,  Next: Other Window,  Prev: Basic Window,  Up: Windows

Splitting Windows
=================

`C-x 2'
     Split the selected window into two windows, one above the other
     (`split-window-vertically').

`C-x 3'
     Split the selected window into two windows positioned side by side
     (`split-window-horizontally').

`C-Mouse-2'
     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'.  *Note Continuation Lines::.

   Horizontal scrolling is often used in side-by-side windows.  *Note
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.


File: emacs,  Node: Other Window,  Next: Pop Up Window,  Prev: Split Window,  Up: Windows

Using Other Windows
===================

`C-x o'
     Select another window (`other-window').  That is `o', not zero.

`C-M-v'
     Scroll the next window (`scroll-other-window').

`M-x compare-windows'
     Find next place where the text in the selected window does not
     match the text in the next window.

`Mouse-1'
     `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.  *Note
Minibuffer Edit::.

   The usual scrolling commands (*note 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.  *Note Comparing Files::, for details.


File: emacs,  Node: Pop Up Window,  Next: Force Same Window,  Prev: Other Window,  Up: Windows

Displaying in Another Window
============================

   `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.

`C-x 4 b BUFNAME RET'
     Select buffer BUFNAME in another window.  This runs
     `switch-to-buffer-other-window'.

`C-x 4 C-o BUFNAME RET'
     Display buffer BUFNAME in another window, but don't select that
     buffer or that window.  This runs `display-buffer'.

`C-x 4 f FILENAME RET'
     Visit file FILENAME and select its buffer in another window.  This
     runs `find-file-other-window'.  *Note Visiting::.

`C-x 4 d DIRECTORY RET'
     Select a Dired buffer for directory DIRECTORY in another window.
     This runs `dired-other-window'.  *Note Dired::.

`C-x 4 m'
     Start composing a mail message in another window.  This runs
     `mail-other-window'; its same-window analogue is `C-x m' (*note
     Sending Mail::.).

`C-x 4 .'
     Find a tag in the current tags table, in another window.  This runs
     `find-tag-other-window', the multiple-window variant of `M-.'
     (*note Tags::.).

`C-x 4 r FILENAME RET'
     Visit file FILENAME read-only, and select its buffer in another
     window.  This runs `find-file-read-only-other-window'.  *Note
     Visiting::.


File: emacs,  Node: Force Same Window,  Next: Change Window,  Prev: Pop Up Window,  Up: Windows

Forcing Display in the Same Window
==================================

   Certain Emacs commands switch to a specific buffer with special
contents.  For example, `M-x shell' switches to a buffer named
`*Shell*'.  By convention, all these commands are written to pop up the
buffer in a separate window.  But you can specify that certain of these
buffers should appear in the selected window.

   If you add a buffer name to the list `same-window-buffer-names', the
effect is that such commands display that particular buffer by
switching to it in the selected window.  For example, if you add the
element `"*grep*"' to the list, the `grep' command will display its
output buffer in the selected window.

   The default value of `same-window-buffer-names' is not `nil'.  It
specifies the buffers `*info*', `*mail*' and `*shell*'.  This is why
`M-x shell' normally switches to the `*shell*' buffer in the selected
window.  If you delete this element from the value of
`same-window-buffer-names', the behavior of `M-x shell' will change--it
will pop up the buffer in another window instead.

   You can specify these buffers more generally with the variable
`same-window-regexps'.  Set it to a list of regular expressions; then
any buffer whose name matches one of those regular expressions is
displayed by switching to it in the selected window.  (Once again, this
applies only to buffers that normally get displayed for you in a
separate window.)  The default value of this variable specifies Telnet
and rlogin buffers.

   An analogous feature lets you specify buffers which should be
displayed in their own individual frames.  *Note Special Buffer
Frames::.


File: emacs,  Node: Change Window,  Prev: Force Same Window,  Up: Windows

Deleting and Rearranging Windows
================================

`C-x 0'
     Delete the selected window (`delete-window').  That is a zero.

`C-x 1'
     Delete all windows in the selected frame except the selected window
     (`delete-other-windows').

`C-x ^'
     Make selected window taller (`enlarge-window').

`C-x }'
     Make selected window wider (`enlarge-window-horizontally').

`Drag-Mouse-1'
     Dragging a window's mode line up or down with `Mouse-1' changes
     window heights.

`Mouse-2'
     `Mouse-2' in a window's mode line deletes all other windows in the
     frame (`mouse-delete-other-windows').

`Mouse-3'
     `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 fill its frame by clicking on its
mode line with `Mouse-3'.

   The easiest way to adjust window heights is with a mouse.  If you
press `Mouse-1' on a mode line, you can drag that mode line up or down,
changing the heights of the windows above and below it.

   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'.

   *Note 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.


File: emacs,  Node: Frames,  Next: Major Modes,  Prev: Windows,  Up: Top

Frames and X Windows
********************

   When using the X Window System, you can create multiple windows at
the X level in a single Emacs session.  Each X window that belongs to
Emacs displays a "frame" which can contain one or several Emacs windows.
A frame initially contains a single general-purpose Emacs window which
you can subdivide vertically or horizontally into smaller windows.  A
frame normally contains its own echo area and minibuffer, but you can
make frames that don't have these--they use the echo area and
minibuffer of another frame.

   Editing you do in one frame also affects the other frames.  For
instance, if you put text in the kill ring in one frame, you can yank it
in another frame.  If you exit Emacs through `C-x C-c' in one frame, it
terminates all the frames.  To delete just one frame, use `C-x 5 0'.

   To avoid confusion, we reserve the word "window" for the
subdivisions that Emacs implements, and never use it to refer to a
frame.

* Menu:

* Mouse Commands::     Moving, cutting, and pasting, with the mouse.
* Secondary Selection::Cutting without altering point and mark.
* Mouse References::   Using the mouse to select an item from a list.
* Menu Mouse Clicks::  Mouse clicks that bring up menus.
* Mode Line Mouse::    Mouse clicks on the mode line.
* Creating Frames::    Creating additional Emacs frames with various contents.
* Multiple Displays::  How one Emacs job can talk to several displays.
* Special Buffer Frames::  You can make certain buffers have their own frames.
* Frame Parameters::   Changing the colors and other modes of frames.
* Scroll Bars::	       How to enable and disable scroll bars; how to use them.
* Menu Bars::	       Enabling and disabling the menu bar.
* Faces::	       How to change the display style using faces.
* Modifying Faces::    How to change what a particular face looks like.
* Misc X::	       Iconifying and deleting frames.	Region highlighting.


File: emacs,  Node: Mouse Commands,  Next: Secondary Selection,  Up: Frames

Mouse Commands for Editing
==========================

   The mouse commands for selecting and copying a region are mostly
compatible with the `xterm' program.  You can use the same mouse
commands for copying between Emacs and other X client programs.

`Mouse-1'
     Move point to where you click (`mouse-set-point').  This is
     normally the left button.

`Drag-Mouse-1'
     Set the region to the text you select by dragging, and copy it to
     the kill ring (`mouse-set-region').  You can specify both ends of
     the region with this single command.

     If you move the mouse off the top or bottom of the window while
     dragging, the window scrolls at a steady rate until you move the
     mouse back into the window.  This way, you can select regions that
     don't fit entirely on the screen.  The number of lines scrolled
     per step depends on how far away from the window edge the mouse
     has gone; the variable `mouse-scroll-min-lines' specifies a
     minimum step size.

`Mouse-2'
     Yank the last killed text, where you click (`mouse-yank-at-click').
     This is normally the middle button.

`Mouse-3'
     This command, `mouse-save-then-kill', has several functions
     depending on where you click and the status of the region.

     The most basic case is when you click `Mouse-1' in one place and
     then `Mouse-3' in another.  This selects the text between those two
     positions as the region.  It also copies the new region to the kill
     ring, so that you can copy it to someplace else.

     If you click `Mouse-1', scroll with the scroll bar, and then click
     `Mouse-3', it remembers where point was before scrolling (where you
     put it with `Mouse-1'), and uses that position as the other end of
     the region.  This is so that you can select a region that doesn't
     fit entirely on the screen.

     More generally, if you do not have a highlighted region, `Mouse-3'
     selects the text between point and the click position as the
     region.  It does this by setting the mark where point was, and
     moving point to where you click.

     If you have a highlighted region, or if the region was set just
     before by dragging button 1, `Mouse-3' adjusts the nearer end of
     the region by moving it to where you click.  The adjusted region's
     text also replaces the old region's text in the kill ring.

     If you originally specified the region using a double or triple
     `Mouse-1', so that the region is defined to consist of entire words
     or lines, then adjusting the region with `Mouse-3' also proceeds by
     entire words or lines.

     If you use `Mouse-3' a second time consecutively, at the same
     place, that kills the region already selected.

`Double-Mouse-1'
     This key sets the region around the word which you click on.  If
     you click on a character with "symbol" syntax (such as underscore,
     in C mode), it sets the region around the symbol surrounding that
     character.

`Double-Drag-Mouse-1'
     This key selects a region made up of the words that you drag
     across.

`Triple-Mouse-1'
     This key sets the region around the line which you click on.

`Triple-Drag-Mouse-1'
     This key selects a region made up of the lines that you drag
     across.

   The simplest way to kill text with the mouse is to press `Mouse-1'
at one end, then press `Mouse-3' twice at the other end.  *Note
Killing::.  To copy the text into the kill ring without deleting it
from the buffer, press `Mouse-3' just once--or just drag across the
text with `Mouse-1'.  Then you can copy it elsewhere by yanking it.

   To yank the killed or copied text somewhere else, move the mouse
there and press `Mouse-2'.  *Note Yanking::.  However, if
`mouse-yank-at-point' is non-`nil', `Mouse-2' yanks at point.  Then it
does not matter precisely where you click; all that matters is which
window you click on.  The default value is `nil'.  This variable also
effects yanking the secondary selection.

   To copy text to another X window, kill it or save it in the kill
ring.  Under X, this also sets the "primary selection".  Then use the
"paste" or "yank" command of the program operating the other window to
insert the text from the selection.

   To copy text from another X window, use the "cut" or "copy" command
of the program operating the other window, to select the text you want.
Then yank it in Emacs with `C-y' or `Mouse-2'.

   When Emacs puts text into the kill ring, or rotates text to the front
of the kill ring, it sets the "primary selection" in the X server.
This is how other X clients can access the text.  Emacs also stores the
text in the cut buffer, but only if the text is short enough
(`x-cut-buffer-max' specifies the maximum number of characters);
putting long strings in the cut buffer can be slow.

   The commands to yank the first entry in the kill ring actually check
first for a primary selection in another program; after that, they check
for text in the cut buffer.  If neither of those sources provides text
to yank, the kill ring contents are used.


File: emacs,  Node: Secondary Selection,  Next: Mouse References,  Prev: Mouse Commands,  Up: Frames

Secondary Selection
===================

   The "secondary selection" is another way of selecting text using X.
It does not use point or the mark, so you can use it to kill text
without setting point or the mark.

`M-Drag-Mouse-1'
     Set the secondary selection, with one end at the place where you
     press down the button, and the other end at the place where you
     release it (`mouse-set-secondary').  The highlighting appears and
     changes as you drag.

     If you move the mouse off the top or bottom of the window while
     dragging, the window scrolls at a steady rate until you move the
     mouse back into the window.  This way, you can mark regions that
     don't fit entirely on the screen.

`M-Mouse-1'
     Set one endpoint for the "secondary selection"
     (`mouse-start-secondary').

`M-Mouse-3'
     Make a secondary selection, using the place specified with
     `M-Mouse-1' as the other end (`mouse-secondary-save-then-kill').
     A second click at the same place kills the secondary selection
     just made.

`M-Mouse-2'
     Insert the secondary selection where you click
     (`mouse-kill-secondary').  This places point at the end of the
     yanked text.

   Double or triple clicking of `M-Mouse-1' operates on words and
lines, much like `Mouse-1'.

   If `mouse-yank-at-point' is non-`nil', `M-Mouse-2' yanks at point.
Then it does not matter precisely where you click; all that matters is
which window you click on.  *Note Mouse Commands::.


File: emacs,  Node: Mouse References,  Next: Menu Mouse Clicks,  Prev: Secondary Selection,  Up: Frames

Following References with the Mouse
===================================

   Some Emacs buffers display lists of various sorts.  These include
lists of files, of buffers, of possible completions, of matches for a
pattern, and so on.

   Since yanking text into these buffers is not very useful, most of
them define `Mouse-2' specially, as a command to use or view the item
you click on.

   For example, if you click `Mouse-2' on a file name in a Dired
buffer, you visit the that file.  If you click `Mouse-2' on an error
message in the `*Compilation*' buffer, you go to the source code for
that error message.  If you click `Mouse-2' on a completion in the
`*Completions*' buffer, you choose that completion.

   You can usually tell when `Mouse-2' has this special sort of meaning
because the sensitive text highlights when you move the mouse over it.


File: emacs,  Node: Menu Mouse Clicks,  Next: Mode Line Mouse,  Prev: Mouse References,  Up: Frames

Mouse Clicks for Menus
======================

   Mouse clicks modified with the CONTROL and SHIFT keys bring up menus.

`C-Mouse-1'
     This menu is for selecting a buffer.

`C-Mouse-2'
     This menu is for specifying faces and other text properties for
     editing formatted text.  *Note Formatted Text::.

`C-Mouse-3'
     This menu is mode-specific.  For most modes, this menu has the same
     items as all the mode-specific menu bar menus put together.  Some
     modes may specify a different menu for this button.(1)

`S-mouse-1'
     This menu is for specifying the frame's default font.

   ---------- Footnotes ----------

   (1)  Some systems use `Mouse-3' for a mode-specific menu.  We took a
survey of users, and found they preferred to keep `Mouse-3' for
selecting and killing regions.  Hence the decision to use `C-Mouse-3'
for this menu.


File: emacs,  Node: Mode Line Mouse,  Next: Creating Frames,  Prev: Menu Mouse Clicks,  Up: Frames

Mode Line Mouse Commands
========================

   You can use mouse clicks on window mode lines to select and
manipulate windows.

`Mouse-1'
     `Mouse-1' on a mode line selects the window above.  By dragging
     `Mouse-1' on the mode line, you can move it, thus changing the
     height of the windows above and below.

`Mouse-2'
     `Mouse-2' on a mode line expands that window to fill its frame.

`Mouse-3'
     `Mouse-3' on a mode line deletes the window above.

`C-Mouse-2'
     `C-Mouse-2' on a mode line splits the window above horizontally,
     above the place in the mode line where you click.

   `C-Mouse-2' on a scroll bar splits the corresponding window
vertically.  *Note Split Window::.


File: emacs,  Node: Creating Frames,  Next: Multiple Displays,  Prev: Mode Line Mouse,  Up: Frames

Creating Frames
===============

   The prefix key `C-x 5' is analogous to `C-x 4', with parallel
subcommands.  The difference is that `C-x 5' commands create a new
frame rather than just a new window in the selected frame  (*Note Pop
Up Window::).  If an existing visible or iconified frame already
displays the requested material, these commands use the existing frame,
after raising or deiconifying as necessary.

   The various `C-x 5' commands differ in how they find or create the
buffer to select:

`C-x 5 2'
     Create a new frame (`make-frame').

`C-x 5 b BUFNAME RET'
     Select buffer BUFNAME in another window.  This runs
     `switch-to-buffer-other-frame'.

`C-x 5 f FILENAME RET'
     Visit file FILENAME and select its buffer in another frame.  This
     runs `find-file-other-frame'.  *Note Visiting::.

`C-x 5 d DIRECTORY RET'
     Select a Dired buffer for directory DIRECTORY in another frame.
     This runs `dired-other-frame'.  *Note Dired::.

`C-x 5 m'
     Start composing a mail message in another frame.  This runs
     `mail-other-frame'.  It is the other-frame variant of `C-x m'.
     *Note Sending Mail::.

`C-x 5 .'
     Find a tag in the current tag table in another frame.  This runs
     `find-tag-other-frame', the multiple-frame variant of `M-.'.
     *Note Tags::.

`C-x 5 r FILENAME RET'
     Visit file FILENAME read-only, and select its buffer in another
     frame.  This runs `find-file-read-only-other-frame'.  *Note
     Visiting::.

   You can control the appearance of new frames you create by setting
the frame parameters in `default-frame-alist'.  You can use the
variable `initial-frame-alist' to specify parameters that affect only
the initial frame.  *Note Initial Parameters: (elisp)Initial
Parameters, for more information.


File: emacs,  Node: Multiple Displays,  Next: Special Buffer Frames,  Prev: Creating Frames,  Up: Frames

Multiple Displays
=================

   A single Emacs can talk to more than one X Windows display.
Initially, Emacs uses just one display--the one specified with the
`DISPLAY' environment variable or with the `--display' option (*note
Initial Options::.).  To connect to another display, use the command
`make-frame-on-display':

`M-x make-frame-on-display RET DISPLAY RET'
     Create a new frame on display DISPLAY.

   A single X server can handle more than one screen.  When you open
frames on two screens belonging to one server, Emacs knows they share a
single keyboard, and it treats all the commands arriving from these
screens as a single stream of input.

   When you open frames on different X servers, Emacs makes a separate
input stream for each server.  This way, two users can type
simultaneously on the two displays, and Emacs will not garble their
input.  Each server also has its own selected frame.  The commands you
enter with a particular X server apply to that server's selected frame.

   Despite these features, people using the same Emacs job from
different displays can still interfere with each other if they are not
careful.  For example, if any one types `C-x C-c', that exits the Emacs
job for all of them!


File: emacs,  Node: Special Buffer Frames,  Next: Frame Parameters,  Prev: Multiple Displays,  Up: Frames

Special Buffer Frames
=====================

   You can make certain chosen buffers, for which Emacs normally creates
a second window when you have just one window, appear in special frames
of their own.  To do this, set the variable
`special-display-buffer-names' to a list of buffer names; any buffer
whose name is in that list automatically gets a special frame, when an
Emacs command wants to display it "in another window."

   For example, if you set the variable this way,

     (setq special-display-buffer-names
           '("*Completions*" "*grep*" "*tex-shell*"))

then completion lists, `grep' output and the TeX mode shell buffer get
individual frames of their own.  These frames, and the windows in them,
are never automatically split or reused for any other buffers.  They
continue to show the buffers they were created for, unless you alter
them by hand.  Killing the special buffer deletes its frame
automatically.

   More generally, you can set `special-display-regexps' to a list of
regular expressions; then a buffer gets its own frame if its name
matches any of those regular expressions.  (Once again, this applies
only to buffers that normally get displayed for you in a separate
window.)

   The variable `special-display-frame-alist' specifies the frame
parameters for these frames.  It has a default value, so you don't need
to set it.

   For those who know Lisp, an element of
`special-display-buffer-names' or `special-display-regexps' can also be
a list.  Then the first element is the buffer name or regular
expression; the rest of the list specifies how to create the frame.  It
can be an association list specifying frame parameter values; these
values take precedence over parameter values specified in
`special-display-frame-alist'.  Alternatively, it can have this form:

     (FUNCTION ARGS...)

where FUNCTION is a symbol.  Then the frame is constructed by calling
FUNCTION; its first argument is the buffer, and its remaining arguments
are ARGS.


File: emacs,  Node: Frame Parameters,  Next: Scroll Bars,  Prev: Special Buffer Frames,  Up: Frames

Setting Frame Parameters
========================

   This section describes commands for altering the display style and
window management behavior of the selected frame.

`M-x set-foreground-color RET COLOR RET'
     Specify color COLOR for the foreground of the selected frame.

`M-x set-background-color RET COLOR RET'
     Specify color COLOR for the background of the selected frame.
     This changes the foreground color of the `modeline' face also, so
     that it remains in inverse video compared with the default.

`M-x set-cursor-color RET COLOR RET'
     Specify color COLOR for the cursor of the selected frame.

`M-x set-mouse-color RET COLOR RET'
     Specify color COLOR for the mouse cursor when it is over the
     selected frame.

`M-x set-border-color RET COLOR RET'
     Specify color COLOR for the border of the selected frame.

`M-x list-colors-display'
     Display the defined color names and show what the colors look like.
     This command is somewhat slow.

`M-x auto-raise-mode'
     Toggle whether or not the selected frame should auto-raise.
     Auto-raise means that every time you move the mouse onto the
     frame, it raises the frame.

     Note that this auto-raise feature is implemented by Emacs itself.
     Some window managers also implement auto-raise.  If you enable
     auto-raise for Emacs frames in your X window manager, it should
     work, but it is beyond Emacs's control and therefore
     `auto-raise-mode' has no effect on it.

`M-x auto-lower-mode'
     Toggle whether or not the selected frame should auto-lower.
     Auto-lower means that every time you move the mouse off of the
     frame, the frame moves to the bottom of the stack of X windows.

     The command `auto-lower-mode' has no effect on auto-lower
     implemented by the X window manager.  To control that, you must use
     the appropriate window manager features.

`M-x set-default-font RET FONT RET'
     Specify font FONT as the default for the selected frame.  *Note
     Font X::, for ways to list the available fonts on your system.

     You can also set a frame's default font through a pop-up menu.
     Press `C-Mouse-1' to activate this menu.

   In Emacs versions that use an X toolkit, the color-setting and
font-setting functions don't affect menus and the menu bar, since they
are displayed by their own widget classes.  To change the appearance of
the menus and menu bar, you must use X resources (*note Resources X::.).
*Note Colors X::, regarding colors.  *Note Font X::, regarding choice of
font.

   For information on frame parameters and customization, see *Note
Frame Parameters: (elisp)Frame Parameters.


File: emacs,  Node: Scroll Bars,  Next: Menu Bars,  Prev: Frame Parameters,  Up: Frames

Scroll Bars
===========

   When using X, Emacs normally makes a "scroll bar" at the right of
each Emacs window.  The scroll bar runs the height of the window, and
shows a moving rectangular inner box which represents the portion of the
buffer currently displayed.  The entire height of the scroll bar
represents the entire length of the buffer.

   You can use `Mouse-2' (normally, the middle button) in the scroll
bar to move or drag the inner box up and down.  If you move it to the
top of the scroll bar, you see the top of the buffer.  If you move it to
the bottom of the scroll bar, you see the bottom of the buffer.

   The left and right buttons in the scroll bar scroll by controlled
increments.  `Mouse-1' (normally, the left button) moves the line at
the level where you click up to the top of the window.  `Mouse-3'
(normally, the right button) moves the line at the top of the window
down to the level where you click.  By clicking repeatedly in the same
place, you can scroll by the same distance over and over.

   Aside from scrolling, you can also click `C-Mouse-2' in the scroll
bar to split a window vertically.  The split occurs on the line where
you click.

   You can enable or disable Scroll Bar mode with the command `M-x
scroll-bar-mode'.  With no argument, it toggles the use of scroll bars.
With an argument, it turns use of scroll bars on if and only if the
argument is positive.  This command applies to all frames, including
frames yet to be created.  You can use the X resource
`verticalScrollBars' to control the initial setting of Scroll Bar mode.
*Note Resources X::.

   To enable or disable scroll bars for just the selected frame, use the
`M-x toggle-scroll-bar' command.


File: emacs,  Node: Menu Bars,  Next: Faces,  Prev: Scroll Bars,  Up: Frames

Menu Bars
=========

   By default, each Emacs frame has a menu bar at the top which you can
use to perform certain common operations.  There's no need to describe
them in detail here, as you can more easily see for yourself; also, we
may change them and add to them in subsequent Emacs versions.

   When you are using a window system, you can use the mouse to choose a
command from the menu bar.  On text-only terminals, you can use the menu
bar by typing `M-`' (`tmm-menubar').  This enters a mode in which you
can select a menu item from the keyboard.  Either type the initial of
the item you want, or use the left and right arrow keys to choose an
item and use RET to finalize the choice.

   Each of the operations in the menu bar is bound to an ordinary Emacs
command which you can invoke equally well with `M-x' or with its own
key bindings.  The menu lists one equivalent key binding (if the command
has any) at the right margin.  To see the command's name and
documentation, type `C-h k' and then select the menu bar item you are
interested in.

   You can turn display of menu bars on or off with `M-x
menu-bar-mode'.  With no argument, this command toggles Menu Bar mode, a
minor mode.  With an argument, the command turns Menu Bar mode on if the
argument is positive, off if the argument is not positive.  You can use
the X resource `menuBarLines' to control the initial setting of Menu
Bar mode.  *Note Resources X::.  Expert users often turn off the menu
bar, especially on text-only terminals where this makes one additional
line available for text.

