@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
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
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
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
the current buffer, creates a temporary buffer and makes it current,
evaluates the @var{body} forms, and finally restores the previous
-current buffer while killing the temporary buffer.
+current buffer while killing the temporary buffer. By default, undo
+information (@pxref{Undo}) is not recorded in the buffer created by
+this macro (but @var{body} can enable that, if needed).
The return value is the value of the last form in @var{body}. You can
return the contents of the temporary buffer by using
Any argument called @var{buffer} must be an actual buffer
object, not a name.
+@cindex hidden buffers
+@cindex buffers without undo information
Buffers that are ephemeral and generally uninteresting to the user
have names starting with a space, so that the @code{list-buffers} and
@code{buffer-menu} commands don't mention them (but if such a buffer
use.
If @var{filename} is @code{nil} or the empty string, that stands for
-``no visited file''. In this case, @code{set-visited-file-name} marks
+``no visited file.'' In this case, @code{set-visited-file-name} marks
the buffer as having no visited file, without changing the buffer's
modified flag.
echo area; use @code{set-buffer-modified-p} (above) instead.
@end deffn
-@c Emacs 19 feature
@defun buffer-modified-tick &optional buffer
This function returns @var{buffer}'s modification-count. This is a
counter that increments every time the buffer is modified. If
The counter can wrap around occasionally.
@end defun
+@defun buffer-chars-modified-tick &optional buffer
+This function returns @var{buffer}'s character-change modification-count.
+Changes to text properties leave this counter unchanged; however, each
+time text is inserted or removed from the buffer, the counter is reset
+to the value that would be returned @code{buffer-modified-tick}.
+By comparing the values returned by two @code{buffer-chars-modified-tick}
+calls, you can tell whether a character change occurred in that buffer
+in between the calls. If @var{buffer} is @code{nil} (or omitted), the
+current buffer is used.
+@end defun
+
@node Modification Time
@comment node-name, next, previous, up
@section Comparison of Modification Time
@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
@end example
The major mode for a newly created buffer is set to Fundamental mode.
-The variable @code{default-major-mode} is handled at a higher level.
-@xref{Auto Major Mode}.
+(The variable @code{default-major-mode} is handled at a higher level;
+see @ref{Auto Major Mode}.) If the name begins with a space, the
+buffer initially disables undo information recording (@pxref{Undo}).
@end defun
@defun generate-new-buffer name