[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
This section describes the two primitives for creating buffers.
get-buffer-create
creates a buffer if it finds no existing buffer
with the specified name; generate-new-buffer
always creates a new
buffer and gives it a unique name.
Other functions you can use to create buffers include
with-output-to-temp-buffer
(voir la section Temporary Displays) and
create-file-buffer
(voir la section Visiting Files). Starting a subprocess
can also create a buffer (@pxref{Processes}).
This function returns a buffer named name. It returns a live buffer with that name, if one exists; otherwise, it creates a new buffer. The buffer does not become the current buffer—this function does not change which buffer is current.
If name is a buffer instead of a string, it is returned, even if it is dead. An error is signaled if name is neither a string nor a buffer.
(get-buffer-create "foo") ⇒ #<buffer foo> |
The major mode for a newly created buffer is set to Fundamental mode. (The
variable default-major-mode
is handled at a higher level; see
How Emacs Chooses a Major Mode.) If the name begins with a space, the buffer
initially disables undo information recording (voir la section Undo).
This function returns a newly created, empty buffer, but does not make it current. If there is no buffer named name, then that is the name of the new buffer. If that name is in use, this function adds suffixes of the form ‘<n>’ to name, where n is an integer. It tries successive integers starting with 2 until it finds an available name.
An error is signaled if name is not a string.
(generate-new-buffer "bar") ⇒ #<buffer bar> (generate-new-buffer "bar") ⇒ #<buffer bar<2>> (generate-new-buffer "bar") ⇒ #<buffer bar<3>> |
The major mode for the new buffer is set to Fundamental mode. The variable
default-major-mode
is handled at a higher level. Voir la section How Emacs Chooses a Major Mode.
See the related function generate-new-buffer-name
in Buffer Names.
[ < ] | [ > ] | [ << ] | [Plus haut] | [ >> ] | [Top] | [Table des matières] | [Index] | [ ? ] |
Ce document a été généré par Eric Reinbold le 13 Octobre 2007 en utilisant texi2html 1.78.