@c -*-texinfo-*-
@c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 1999
+@c Free Software Foundation, Inc.
@c See the file elisp.texi for copying conditions.
@setfilename ../info/buffers
@node Buffers, Windows, Backups and Auto-Saving, Top
@comment node-name, next, previous, up
@section Buffer Basics
-@ifinfo
+@ifnottex
A @dfn{buffer} is a Lisp object containing text to be edited. Buffers
are used to hold the contents of files that are being visited; there may
also be buffers that are not visiting files. Although several buffers
buffer} at any time. Most editing commands act on the contents of the
current buffer. Each buffer, including the current buffer, may or may
not be displayed in any windows.
-@end ifinfo
+@end ifnottex
Buffers in Emacs editing are objects that have distinct names and hold
text that can be edited. Buffers appear to Lisp programs as a special
@end defun
@defspec save-current-buffer body...
-@tindex save-current-buffer
The @code{save-current-buffer} macro 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 form in
@end defspec
@defmac with-current-buffer buffer body...
-@tindex with-current-buffer
The @code{with-current-buffer} macro saves the identity of the current
buffer, makes @var{buffer} current, evaluates the @var{body} forms, and
finally restores the buffer. The return value is the value of the last
@end defmac
@defmac with-temp-buffer body...
-@tindex 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,
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. A name starting with
+@code{buffer-menu} commands don't mention them (but if such a buffer
+visits a file, it @strong{is} mentioned). A name starting with
space also initially disables recording undo information; see
@ref{Undo}.
@end defun
@c Emacs 19 feature
-@defun generate-new-buffer-name starting-name
+@defun generate-new-buffer-name starting-name &rest ignore
This function returns a name that would be unique for a new buffer---but
does not create the buffer. It starts with @var{starting-name}, and
produces a name not currently in use for any buffer by appending a
number inside of @samp{<@dots{}>}.
+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,
+
+@example
+(generate-new-buffer-name "foo")
+ @result{} "foo<5>"
+(generate-new-buffer-name "foo" "foo<3>")
+ @result{} "foo<3>"
+(generate-new-buffer-name "foo" "foo<6>")
+ @result{} "foo<5>"
+@end example
+
See the related function @code{generate-new-buffer} in @ref{Creating
Buffers}.
@end defun
@deffn Command set-visited-file-name filename &optional no-query along-with-file
If @var{filename} is a non-empty string, this function changes the
-name of the file visited in current buffer to @var{filename}. (If the
+name of the file visited in the current buffer to @var{filename}. (If the
buffer had no visited file, this gives it one.) The @emph{next time}
the buffer is saved it will go in the newly-specified file. This
command marks the buffer as modified, since it does not (as far as Emacs
@defun other-buffer &optional buffer visible-ok frame
This function returns the first buffer in the buffer list other than
@var{buffer}. Usually this is the buffer selected most recently (in
-frame @var{frame} or else the currently selected frame), aside from
-@var{buffer}. Buffers whose names start with a space are not considered
-at all.
+frame @var{frame} or else the currently selected frame, @pxref{Input
+Focus}), aside from @var{buffer}. Buffers whose names start with a
+space are not considered at all.
If @var{buffer} is not supplied (or if it is not a buffer), then
@code{other-buffer} returns the first buffer in the selected frame's
Any processes that have this buffer as the @code{process-buffer} are
sent the @code{SIGHUP} signal, which normally causes them to terminate.
(The basic meaning of @code{SIGHUP} is that a dialup line has been
-disconnected.) @xref{Deleting Processes}.
+disconnected.) @xref{Signals to Processes}.
If the buffer is visiting a file and contains unsaved changes,
@code{kill-buffer} asks the user to confirm before the buffer is killed.