]> code.delx.au - gnu-emacs/blobdiff - lispref/buffers.texi
*** empty log message ***
[gnu-emacs] / lispref / buffers.texi
index d39a0746fe115ec6c28dc2a8dea66e7bc59e7c01..c0eb2ee666491e00b46072d5ba96ecbf755624f5 100644 (file)
@@ -1,7 +1,7 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2004
-@c   Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999, 2002, 2003,
+@c   2004, 2005, 2006 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/buffers
 @node Buffers, Windows, Backups and Auto-Saving, Top
@@ -202,7 +202,7 @@ An error is signaled if @var{buffer-or-name} does not identify an
 existing buffer.
 @end defun
 
-@defspec save-current-buffer body...
+@defspec save-current-buffer body@dots{}
 The @code{save-current-buffer} special form saves the identity of the
 current buffer, evaluates the @var{body} forms, and finally restores
 that buffer as current.  The return value is the value of the last
@@ -215,7 +215,7 @@ of course.  Instead, whichever buffer was current just before exit
 remains current.
 @end defspec
 
-@defmac with-current-buffer buffer-or-name body...
+@defmac with-current-buffer buffer-or-name body@dots{}
 The @code{with-current-buffer} macro saves the identity of the current
 buffer, makes @var{buffer-or-name} current, evaluates the @var{body}
 forms, and finally restores the buffer.  The return value is the value
@@ -227,7 +227,7 @@ An error is signaled if @var{buffer-or-name} does not identify an
 existing buffer.
 @end defmac
 
-@defmac with-temp-buffer body...
+@defmac with-temp-buffer body@dots{}
 @anchor{Definition of with-temp-buffer}
 The @code{with-temp-buffer} macro evaluates the @var{body} forms
 with a temporary buffer as the current buffer.  It saves the identity of
@@ -344,11 +344,11 @@ number inside of @samp{<@dots{}>}.  It starts at 2 and keeps
 incrementing the number until it is not the name of an existing buffer.
 
 If the optional second argument @var{ignore} is non-@code{nil}, it
-should be a string; it makes a difference if it is a name in the
-sequence of names to be tried.  That name will be considered acceptable,
-if it is tried, even if a buffer with that name exists.  Thus, if
-buffers named @samp{foo}, @samp{foo<2>}, @samp{foo<3>} and @samp{foo<4>}
-exist,
+should be a string, a potential buffer name.  It means to consider
+that potential buffer acceptable, if it is tried, even it is the name
+of an existing buffer (which would normally be rejected).  Thus, if
+buffers named @samp{foo}, @samp{foo<2>}, @samp{foo<3>} and
+@samp{foo<4>} exist,
 
 @example
 (generate-new-buffer-name "foo")
@@ -629,16 +629,13 @@ modification time, as a list of the form @code{(@var{high} @var{low})}.
 (This is the same format that @code{file-attributes} uses to return
 time values; see @ref{File Attributes}.)
 
-The function returns zero if the buffer has no recorded last
-modification time, which can happen, for instance, if the record has
-been explicitly cleared by @code{clear-visited-file-modtime} or if the
-buffer is not visiting a file.  Note, however, that
-@code{visited-file-modtime} can return a non-zero value for some
-buffers that are not visiting files, but are nevertheless closely
-associated with a file.  This happens, for instance, with dired
-buffers listing a directory.  For such buffers,
-@code{visited-file-modtime} returns the last modification time of that
-directory, as recorded by dired.
+If the buffer has no recorded last modification time, this function
+returns zero.  This case occurs, for instance, if the buffer is not
+visiting a file or if the time has been explicitly cleared by
+@code{clear-visited-file-modtime}.  Note, however, that
+@code{visited-file-modtime} returns a list for some non-file buffers
+too.  For instance, in a Dired buffer listing a directory, it returns
+the last modification time of that directory, as recorded by Dired.
 
 For a new buffer visiting a not yet existing file, @var{high} is
 @minus{}1 and @var{low} is 65535, that is,
@@ -760,21 +757,24 @@ signal an error if the current buffer is read-only.
 @section The Buffer List
 @cindex buffer list
 
-  The @dfn{buffer list} is a list of all live buffers.  Creating a
-buffer adds it to this list, and killing a buffer removes it.  The
-order of the buffers in the list is based primarily on how recently
-each buffer has been displayed in the selected window.  Buffers move
-to the front of the list when they are selected (selecting a window
-that already displays the buffer counts as selecting the buffer), and
-to the end when they are buried (see @code{bury-buffer}, below).
-Several functions, notably @code{other-buffer}, use this ordering.  A
-buffer list displayed for the user also follows this order.
+  The @dfn{buffer list} is a list of all live buffers.  The order of
+the buffers in the list is based primarily on how recently each buffer
+has been displayed in a window.  Several functions, notably
+@code{other-buffer}, use this ordering.  A buffer list displayed for
+the user also follows this order.
 
+  Creating a buffer adds it to the end of the buffer list, and killing
+a buffer removes it.  Buffers move to the front of the list when they
+are selected for display in a window (@pxref{Displaying Buffers}), and
+to the end when they are buried (see @code{bury-buffer}, below).
+There are no functions available to the Lisp programmer which directly
+manipulate the buffer list.
+  
   In addition to the fundamental Emacs buffer list, each frame has its
 own version of the buffer list, in which the buffers that have been
 selected in that frame come first, starting with the buffers most
 recently selected @emph{in that frame}.  (This order is recorded in
-@var{frame}'s @code{buffer-list} frame parameter; see @ref{Window Frame
+@var{frame}'s @code{buffer-list} frame parameter; see @ref{Buffer
 Parameters}.)  The buffers that were never selected in @var{frame} come
 afterward, ordered according to the fundamental Emacs buffer list.
 
@@ -841,7 +841,7 @@ buffer list that is not now visible in any window in a visible frame.
 If @var{frame} has a non-@code{nil} @code{buffer-predicate} parameter,
 then @code{other-buffer} uses that predicate to decide which buffers to
 consider.  It calls the predicate once for each buffer, and if the value
-is @code{nil}, that buffer is ignored.  @xref{Window Frame Parameters}.
+is @code{nil}, that buffer is ignored.  @xref{Buffer Parameters}.
 
 @c Emacs 19 feature
 If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning
@@ -857,7 +857,8 @@ If no suitable buffer exists, the buffer @samp{*scratch*} is returned
 This function puts @var{buffer-or-name} at the end of the buffer list,
 without changing the order of any of the other buffers on the list.
 This buffer therefore becomes the least desirable candidate for
-@code{other-buffer} to return.
+@code{other-buffer} to return.  The argument can be either a buffer
+itself or the name of one.
 
 @code{bury-buffer} operates on each frame's @code{buffer-list} parameter
 as well as the frame-independent Emacs buffer list; therefore, the
@@ -949,8 +950,8 @@ Names}.
 @cindex killing buffers
 @cindex buffers, killing
 
-  @dfn{Killing a buffer} makes its name unknown to Emacs and makes its
-text space available for other use.
+  @dfn{Killing a buffer} makes its name unknown to Emacs and makes the
+memory space it occupied available for other use.
 
   The buffer object for the buffer that has been killed remains in
 existence as long as anything refers to it, but it is specially marked
@@ -1041,6 +1042,13 @@ save that buffer, just as they offer to save file-visiting buffers.
 for any reason.  @xref{Buffer-Local Variables}.
 @end defvar
 
+@defvar buffer-save-without-query
+This variable, if non-@code{nil} in a particular buffer, tells
+@code{save-buffers-kill-emacs} and @code{save-some-buffers} to save
+this buffer (if it's modified) without asking the user.  The variable
+automatically becomes buffer-local when set for any reason.
+@end defvar
+
 @defun buffer-live-p object
 This function returns @code{t} if @var{object} is a buffer which has
 not been killed, @code{nil} otherwise.
@@ -1062,11 +1070,11 @@ in the other.  This includes the text properties as well as the characters
 themselves.
 
   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 and overlays (though
+completely separate.  They have different names, independent values of
+point, independent narrowing, independent markers and overlays (though
 inserting or deleting text in either buffer relocates the markers and
-overlays for both), different major modes, and different buffer-local
-variables.
+overlays for both), independent major modes, and independent
+buffer-local variable bindings.
 
   An indirect buffer cannot visit a file, but its base buffer can.  If
 you try to save the indirect buffer, that actually saves the base
@@ -1094,6 +1102,18 @@ non-@code{nil}, the initial state is copied from the actual base
 buffer, not from @var{base-buffer}.
 @end deffn
 
+@defun clone-indirect-buffer newname display-flag &optional norecord
+This function creates and returns a new indirect buffer that shares
+the current buffer's base buffer and copies the rest of the current
+buffer's attributes.  (If the current buffer is not indirect, it is
+used as the base buffer.)
+
+If @var{display-flag} is non-@code{nil}, that means to display the new
+buffer by calling @code{pop-to-buffer}.  If @var{norecord} is
+non-@code{nil}, that means not to put the new buffer to the front of
+the buffer list.
+@end defun
+
 @defun buffer-base-buffer &optional buffer
 This function returns the base buffer of @var{buffer}, which defaults
 to the current buffer.  If @var{buffer} is not indirect, the value is