Merge from emacs-24; up to 2012-04-20T05:47:55Z!eliz@gnu.org
[bpt/emacs.git] / doc / emacs / buffers.texi
index 0b471ca..5dd95cc 100644 (file)
@@ -11,7 +11,7 @@
 the file's text.  Each time you invoke Dired, a buffer is used to hold
 the directory listing.  If you send a message with @kbd{C-x m}, a
 buffer is used to hold the text of the message.  When you ask for a
-command's documentation, that appears in a buffer named @samp{*Help*}.
+command's documentation, that appears in a buffer named @file{*Help*}.
 
   Each buffer has a unique name, which can be of any length.  When a
 buffer is displayed in a window, its name is shown in the mode line
@@ -19,7 +19,7 @@ buffer is displayed in a window, its name is shown in the mode line
 matters in buffer names.  Most buffers are made by visiting files, and
 their names are derived from the files' names; however, you can also
 create an empty buffer with any name you want.  A newly started Emacs
-has several buffers, including one named @samp{*scratch*}, which can
+has several buffers, including one named @file{*scratch*}, which can
 be used for evaluating Lisp expressions and is not associated with any
 file (@pxref{Lisp Interaction}).
 
@@ -46,7 +46,7 @@ This is because Emacs tracks buffer positions using that data type.
 For typical 64-bit machines, this maximum buffer size is @math{2^61 -
 2} bytes, or about 2 EiB.  For typical 32-bit machines, the maximum is
 usually @math{2^29 - 2} bytes, or about 512 MiB.  Buffer sizes are
-also limited by the amount of memory present in the system.
+also limited by the amount of memory in the system.
 
 @menu
 * Select Buffer::       Creating a new buffer or reselecting an old one.
@@ -106,7 +106,9 @@ editing.  The default value of the variable @code{major-mode}
 determines the new buffer's major mode; the default value is
 Fundamental mode.  @xref{Major Modes}.  One reason to create a new
 buffer is to use it for making temporary notes.  If you try to save
-it, Emacs asks for the file name to use.
+it, Emacs asks for the file name to use, and the buffer's major mode
+is re-established taking that file name into account (@pxref{Choosing
+Modes}).
 
 @kindex C-x @key{LEFT}
 @kindex C-x @key{RIGHT}
@@ -178,7 +180,7 @@ buffers that were current most recently come first.
 
   @samp{.} in the first field of a line indicates that the buffer is
 current.  @samp{%} indicates a read-only buffer.  @samp{*} indicates
-that the buffer is ``modified.''  If several buffers are modified, it
+that the buffer is ``modified''.  If several buffers are modified, it
 may be time to save some with @kbd{C-x s} (@pxref{Save Commands}).
 Here is an example of a buffer list:
 
@@ -196,7 +198,7 @@ CRM Buffer                Size  Mode              File
 @end smallexample
 
 @noindent
-The buffer @samp{*Help*} was made by a help request (@pxref{Help}); it
+The buffer @file{*Help*} was made by a help request (@pxref{Help}); it
 is not visiting any file.  The buffer @code{src} was made by Dired on
 the directory @file{~/cvs/emacs/src/}.  You can list only buffers that
 are visiting files by giving the command a prefix argument, as in
@@ -246,15 +248,15 @@ happens and no renaming is done.
   @kbd{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 @samp{*shell*} buffer, then
+multiple shell buffers: if you rename the @file{*shell*} buffer, then
 do @kbd{M-x shell} again, it makes a new shell buffer named
-@samp{*shell*}; meanwhile, the old shell buffer continues to exist
+@file{*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.  (With some of these features, such as
-@kbd{M-x compile}, @kbd{M-x grep} an @kbd{M-x info}, you need to
-switch to some other buffer before using the command, in order for it
-to make a different buffer.)
+@kbd{M-x compile}, @kbd{M-x grep}, you need to switch to some other
+buffer before using the command again, otherwise it will reuse the
+current buffer despite the name change.)
 
   The commands @kbd{M-x append-to-buffer} and @kbd{M-x insert-buffer}
 can also be used to copy text from one buffer to another.
@@ -324,8 +326,8 @@ for a mere hour.
 @cindex Midnight mode
 @vindex midnight-mode
 @vindex midnight-hook
-  You can also have this buffer purging done for you, every day at
-midnight, by enabling Midnight mode.  Midnight mode operates each day
+  You can also have this buffer purging done for you, once a day,
+by enabling Midnight mode.  Midnight mode operates each day
 at midnight; at that time, it runs @code{clean-buffer-list}, or
 whichever functions you have placed in the normal hook
 @code{midnight-hook} (@pxref{Hooks}).  To enable Midnight mode, use
@@ -352,14 +354,14 @@ operations on buffers, through an interface similar to Dired
 @findex buffer-menu
 @findex buffer-menu-other-window
   To use the buffer menu, type @kbd{C-x C-b} and switch to the window
-displaying the @samp{*Buffer List*} buffer.  You can also type
+displaying the @file{*Buffer List*} buffer.  You can also type
 @kbd{M-x buffer-menu} to open the buffer menu in the selected window.
 Alternatively, the command @kbd{M-x buffer-menu-other-window} opens
 the buffer menu in another window, and selects that window.
 
   The buffer menu is a read-only buffer, and can be changed only
 through the special commands described in this section.  The usual
-Emacs cursor motion commands can be used in this buffer.  The
+cursor motion commands can be used in this buffer.  The
 following commands apply to the buffer described on the current line:
 
 @table @kbd
@@ -390,7 +392,7 @@ line:
 
 @table @kbd
 @item ~
-Mark the buffer ``unmodified.''  The command @kbd{~} does this
+Mark the buffer ``unmodified''.  The command @kbd{~} does this
 immediately when you type it.
 @item %
 Toggle the buffer's read-only flag.  The command @kbd{%} does
@@ -407,11 +409,11 @@ Quit the buffer menu---immediately display the most recent formerly
 visible buffer in its place.
 @item @key{RET}
 @itemx f
-Immediately select this line's buffer in place of the @samp{*Buffer
+Immediately select this line's buffer in place of the @file{*Buffer
 List*} buffer.
 @item o
 Immediately select this line's buffer in another window as if by
-@kbd{C-x 4 b}, leaving @samp{*Buffer List*} visible.
+@kbd{C-x 4 b}, leaving @file{*Buffer List*} visible.
 @item C-o
 Immediately display this line's buffer in another window, but don't
 select the window.
@@ -420,7 +422,7 @@ Immediately select this line's buffer in a full-screen window.
 @item 2
 Immediately set up two windows, with this line's buffer selected in
 one, and the previously current buffer (aside from the buffer
-@samp{*Buffer List*}) displayed in the other.
+@file{*Buffer List*}) displayed in the other.
 @item b
 Bury the buffer listed on this line.
 @item m
@@ -446,19 +448,19 @@ the inclusion of such buffers in the buffer list.
 suitable buffer, and turn on Buffer Menu mode in it.  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 @samp{*Buffer List*} buffer to another Emacs buffer, and edit
-there.  You can reselect the @samp{*Buffer List*} buffer later, to
+the @file{*Buffer List*} buffer to another Emacs buffer, and edit
+there.  You can reselect the @file{*Buffer List*} buffer later, to
 perform the operations already requested, or you can kill it, or pay
 no further attention to it.
 
-  Normally, the buffer @samp{*Buffer List*} is not updated
+  Normally, the buffer @file{*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 @samp{*Buffer List*} to show what you have done is to type
+to update @file{*Buffer List*} to show what you have done is to type
 @kbd{g} (@code{revert-buffer}).  You can make this happen regularly
 every @code{auto-revert-interval} seconds if you enable Auto Revert
 mode in this buffer, as long as it is not marked modified.  Global
-Auto Revert mode applies to the @samp{*Buffer List*} buffer only if
+Auto Revert mode applies to the @file{*Buffer List*} buffer only if
 @code{global-auto-revert-non-file-buffers} is non-@code{nil}.
 @iftex
 @inforef{Autorevert,, emacs-xtra}, for details.
@@ -474,13 +476,13 @@ Auto Revert mode applies to the @samp{*Buffer List*} buffer only if
 
   An @dfn{indirect buffer} shares the text of some other buffer, which
 is called the @dfn{base buffer} of the indirect buffer.  In some ways it
-is the analogue, for buffers, of a symbolic link between files.
+is a buffer analogue of a symbolic link between files.
 
 @table @kbd
 @findex make-indirect-buffer
 @item M-x make-indirect-buffer @key{RET} @var{base-buffer} @key{RET} @var{indirect-name} @key{RET}
-Create an indirect buffer named @var{indirect-name} whose base buffer
-is @var{base-buffer}.
+Create an indirect buffer named @var{indirect-name} with base buffer
+@var{base-buffer}.
 @findex clone-indirect-buffer
 @item M-x clone-indirect-buffer @key{RET}
 Create an indirect buffer that is a twin copy of the current buffer.
@@ -518,10 +520,9 @@ buffer in another window.  These functions run the hook
 @code{clone-indirect-buffer-hook} after creating the indirect buffer.
 
   The more general way to make an indirect buffer is with the command
-@kbd{M-x make-indirect-buffer}.  It creates an indirect buffer from
-buffer @var{base-buffer}, under the name @var{indirect-name}.  It
-prompts for both @var{base-buffer} and @var{indirect-name} using the
-minibuffer.
+@kbd{M-x make-indirect-buffer}.  It creates an indirect buffer
+named @var{indirect-name} from a buffer @var{base-buffer}, prompting for
+both using the minibuffer.
 
 @node Buffer Convenience
 @section Convenience Features and Customization of Buffer Handling
@@ -588,7 +589,7 @@ rule or another is easier for you to remember and apply quickly.
   Iswitchb global minor mode provides convenient switching between
 buffers using substrings of their names.  It replaces the normal
 definitions of @kbd{C-x b}, @kbd{C-x 4 b}, @kbd{C-x 5 b}, and @kbd{C-x
-4 C-o} with alternative commands that are somewhat ``smarter.''
+4 C-o} with alternative commands that are somewhat ``smarter''.
 
   When one of these commands prompts you for a buffer name, you can
 type in just a substring of the name you want to choose.  As you enter