This is ../info/emacs, produced by makeinfo version 4.0 from emacs.texi.

   This is the thirteenth edition of the `GNU Emacs Manual', updated
for Emacs version 20.7.

INFO-DIR-SECTION Editors
START-INFO-DIR-ENTRY
* Emacs: (emacs).	The extensible self-documenting text editor.
END-INFO-DIR-ENTRY

   Published by the Free Software Foundation 59 Temple Place, Suite 330
Boston, MA  02111-1307 USA

   Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1996, 1997, 1998,
1999    Free Software Foundation, Inc.

   Permission is granted to make and distribute verbatim copies of this
manual provided the copyright notice and this permission notice are
preserved on all copies.

   Permission is granted to copy and distribute modified versions of
this manual under the conditions for verbatim copying, provided also
that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
General Public License" are included exactly as in the original, and
provided that the entire resulting derived work is distributed under the
terms of a permission notice identical to this one.

   Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that the sections entitled "The GNU Manifesto",
"Distribution" and "GNU General Public License" may be included in a
translation approved by the Free Software Foundation instead of in the
original English.


File: emacs,  Node: Remote Files,  Next: Quoted File Names,  Prev: Compressed Files,  Up: Files

Remote Files
============

   You can refer to files on other machines using a special file name
syntax:

     /HOST:FILENAME
     /USER@HOST:FILENAME

When you do this, Emacs uses the FTP program to read and write files on
the specified host.  It logs in through FTP using your user name or the
name USER.  It may ask you for a password from time to time; this is
used for logging in on HOST.

   Normally, if you do not specify a user name in a remote file name,
that means to use your own user name.  But if you set the variable
`ange-ftp-default-user' to a string, that string is used instead.  (The
Emacs package that implements FTP file access is called `ange-ftp'.)

   You can entirely turn off the FTP file name feature by setting the
variable `file-name-handler-alist' to `nil'.


File: emacs,  Node: Quoted File Names,  Prev: Remote Files,  Up: Files

Quoted File Names
=================

   You can "quote" an absolute file name to prevent special characters
and syntax in it from having their special effects.  The way to do this
is to add `/:' at the beginning.

   For example, you can quote a local file name which appears remote, to
prevent it from being treated as a remote file name.  Thus, if you have
a directory named `/foo:' and a file named `bar' in it, you can refer
to that file in Emacs as `/:/foo:/bar'.

   `/:' can also prevent `~' from being treated as a special character
for a user's home directory.  For example, `/:/tmp/~hack' refers to a
file whose name is `~hack' in directory `/tmp'.

   Likewise, quoting with `/:' is one way to enter in the minibuffer a
file name that contains `$'.  However, the `/:' must be at the
beginning of the buffer in order to quote `$'.

   You can also quote wildcard characters with `/:', for visiting.  For
example, `/:/tmp/foo*bar' visits the file `/tmp/foo*bar'.  However, in
most cases you can simply type the wildcard characters for themselves.
For example, if the only file name in `/tmp' that starts with `foo' and
ends with `bar' is `foo*bar', then specifying `/tmp/foo*bar' will visit
just `/tmp/foo*bar'.


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

Using Multiple Buffers
**********************

   The text you are editing in Emacs resides in an object called a
"buffer".  Each time you visit a file, a buffer is created to hold the
file's text.  Each time you invoke Dired, a buffer is created to hold
the directory listing.  If you send a message with `C-x m', a buffer
named `*mail*' is used to hold the text of the message.  When you ask
for a command's documentation, that appears in a buffer called `*Help*'.

   At any time, one and only one buffer is "selected".  It is also
called the "current buffer".  Often we say that a command operates on
"the buffer" as if there were only one; but really this means that the
command operates on the selected buffer (most commands do).

   When Emacs has multiple windows, each window has a chosen buffer
which is displayed there, but at any time only one of the windows is
selected and its chosen buffer is the selected buffer.  Each window's
mode line displays the name of the buffer that the window is displaying
(*note Windows::).

   Each buffer has a name, which can be of any length, and you can
select any buffer by giving its name.  Most buffers are made by
visiting files, and their names are derived from the files' names.  But
you can also create an empty buffer with any name you want.  A newly
started Emacs has a buffer named `*scratch*' which can be used for
evaluating Lisp expressions in Emacs.  The distinction between upper
and lower case matters in buffer names.

   Each buffer records individually what file it is visiting, whether
it is modified, and what major mode and minor modes are in effect in it
(*note Major Modes::).  Any Emacs variable can be made "local to" a
particular buffer, meaning its value in that buffer can be different
from the value in other buffers.  *Note Locals::.

* Menu:

* Select Buffer::       Creating a new buffer or reselecting an old one.
* List Buffers::        Getting a list of buffers that exist.
* Misc Buffer::	        Renaming; changing read-onlyness; copying text.
* Kill Buffer::	        Killing buffers you no longer need.
* Several Buffers::     How to go through the list of all buffers
			  and operate variously on several of them.
* Indirect Buffers::    An indirect buffer shares the text of another buffer.


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

Creating and Selecting Buffers
==============================

`C-x b BUFFER <RET>'
     Select or create a buffer named BUFFER (`switch-to-buffer').

`C-x 4 b BUFFER <RET>'
     Similar, but select BUFFER in another window
     (`switch-to-buffer-other-window').

`C-x 5 b BUFFER <RET>'
     Similar, but select BUFFER in a separate frame
     (`switch-to-buffer-other-frame').

   To select the buffer named BUFNAME, type `C-x b BUFNAME <RET>'.
This runs the command `switch-to-buffer' with argument BUFNAME.  You
can use completion on an abbreviation for the buffer name you want
(*note Completion::).  An empty argument to `C-x b' specifies the most
recently selected buffer that is not displayed in any window.

   Most buffers are created by visiting files, or by Emacs commands that
want to display some text, but you can also create a buffer explicitly
by typing `C-x b BUFNAME <RET>'.  This makes a new, empty buffer that
is not visiting any file, and selects it for editing.  Such buffers are
used for making notes to yourself.  If you try to save one, you are
asked for the file name to use.  The new buffer's major mode is
determined by the value of `default-major-mode' (*note Major Modes::).

   Note that `C-x C-f', and any other command for visiting a file, can
also be used to switch to an existing file-visiting buffer.  *Note
Visiting::.

   Emacs uses buffer names that start with a space for internal
purposes.  It treats these buffers specially in minor ways--for
example, by default they do not record undo information.  It is best to
avoid using such buffer names yourself.


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 that they were current; the
buffers that were current most recently come 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 with `q', that
switches back to the buffer (and the position) which was previously
displayed in the window.  Alternatively, if you exit View mode with
`e', the buffer and the value of point that resulted from your perusal
remain 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::).

   If you run one Emacs session for a period of days, as many people do,
it can fill up with buffers that you used several days ago.  The command
`M-x clean-buffer-list' is a convenient way to purge them; it kills all
the unmodified buffers that you have not used for a long time.  An
ordinary buffer is killed if it has not been displayed for three days;
however, you can specify certain buffers that should never be killed
automatically, and others that should be killed if they have been unused
for a mere hour.

   You can also have this buffer purging done for you, every day at
midnight, by enabling Midnight mode.  Midnight mode operates each day at
midnight; at that time, it runs `clean-buffer-list', or whichever
functions you have placed in the normal hook `midnight-hook' (*note
Hooks::).

   To enable Midnight mode, use the Customization buffer to set the
variable `midnight-mode' to `t'.  *Note Easy Customization::.


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.

`b'
     Bury the buffer listed on this line.

`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.  However,
they all have the same value for the mark, because each buffer has only
one mark position.

   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.  On terminals where Emacs does
not support highlighting, truncated mode lines sometimes do not appear
in inverse video.

   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', the default, both of the
windows resulting from `C-x 2' inherit the value of point from the
window that was split.  This means that scrolling is inevitable.  If
this variable is `nil', then `C-x 2' tries to avoid shifting any text
the screen, by putting point in each window at a position already
visible in the window.  It also selects whichever window contain the
screen line that the cursor was previously on.  Some users prefer the
latter mode 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-window').

   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 buffer names `*info*', `*mail*' and `*shell*' (as well as
others used by more obscure Emacs packages).  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').  The last character
     in this key sequence is a zero.

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

`C-x 4 0'
     Delete the selected window and kill the buffer that was showing in
     it (`kill-buffer-and-window').  The last character in this key
     sequence is a zero.

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

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

`C-x {'
     Make selected window narrower (`shrink-window-horizontally').

`C-x -'
     Shrink this window if its buffer doesn't need so many lines
     (`shrink-window-if-larger-than-buffer').

`C-x +'
     Make all windows the same height (`balance-windows').

`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 4 0' (`kill-buffer-and-window') is a stronger command than `C-x
0'; it kills the current buffer and then deletes the selected window.

   `C-x 1' (`delete-other-windows') is more powerful in a different
way; 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 delete all the windows in a frame except one window by
clicking on that window's 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.  `C-x {'
(`shrink-window-horizontally') makes the selected window narrower by
the specified number of columns.

   When you make a window bigger, the space comes from one of its
neighbors.  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'.

   The command `C-x -' (`shrink-window-if-larger-than-buffer') reduces
the height of the selected window, if it is taller than necessary to
show the whole text of the buffer it is displaying.  It gives the extra
lines to other windows in the frame.

   You can also use `C-x +' (`balance-windows') to even out the heights
of all the windows in the selected frame.

   *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: International,  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.

   Emacs compiled for MS-DOS emulates some aspects of the window system
so that you can use many of the features described in this chapter.
*Note MS-DOS Input::, for more information.

* 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.
* Speedbar::            How to make and use a speedbar frame.
* 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.
* Font Lock::           Minor mode for syntactic highlighting using faces.
* Support Modes::       Font Lock support modes make Font Lock faster.
* Highlight Changes::   Using colors to show where you changed the buffer.
* Misc X::	        Iconifying and deleting frames. Region highlighting.
* Non-Window Terminals::  Multiple frames on terminals that show only one.


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.

   If you select a region with any of these mouse commands, and then
immediately afterward type the <DELETE> function key, it deletes the
region that you selected.  The <BACKSPACE> function key and the ASCII
character <DEL> do not do this; if you type any other key in between
the mouse command and <DELETE>, it does not do this.

`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' in the text, 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.

     If you click on a character with open-parenthesis or
     close-parenthesis syntax, it sets the region around the
     parenthetical grouping (sexp) which that character starts or ends.
     If you click on a character with string-delimiter syntax (such as
     a singlequote or doublequote in C), it sets the region around the
     string constant (using heuristics to figure out whether that
     character is the beginning or the end of it).

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

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

`Triple-Drag-Mouse-1'
     This key selects a region made up of the lines 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 where you click, or even which of the frame's windows
you click on.  The default value is `nil'.  This variable also affects
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'.

   These cutting and pasting commands also work on MS-Windows.

   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-yank-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 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 <CTRL> 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 principal 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: Speedbar,  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: Speedbar,  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-command').

`C-x 5 b BUFNAME <RET>'
     Select buffer BUFNAME in another frame.  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.

   The easiest way to specify the principal font for all your Emacs
frames is with an X resource (*note Font X::), but you can also do it by
modifying `default-frame-alist' to specify the `font' parameter, as
shown here:

     (add-to-list 'default-frame-alist '(font . "10x20"))

