Mercurial > emacs
comparison doc/lispref/buffers.texi @ 99126:b7fa14d891a6
(Current Buffer): Reword set-buffer and
with-current-buffer documentations.
(Creating Buffers): Reword documentation of get-buffer-create.
author | Martin Rudalics <rudalics@gmx.at> |
---|---|
date | Sat, 25 Oct 2008 09:57:49 +0000 |
parents | 82fc5c6c82f6 |
children | 007ec92e4924 |
comparison
equal
deleted
inserted
replaced
99125:47b36b351e0f | 99126:b7fa14d891a6 |
---|---|
192 @end group | 192 @end group |
193 @end example | 193 @end example |
194 @end defun | 194 @end defun |
195 | 195 |
196 @defun set-buffer buffer-or-name | 196 @defun set-buffer buffer-or-name |
197 This function makes @var{buffer-or-name} the current buffer. An error | 197 This function makes @var{buffer-or-name} the current buffer. |
198 is signaled if @var{buffer-or-name} is not an existing buffer or the | 198 @var{buffer-or-name} must be an existing buffer or the name of an |
199 name of an existing buffer. The return value is the buffer made | 199 existing buffer. The return value is the buffer made current. |
200 current. | |
201 | 200 |
202 This function does not display the buffer in any window, so the user | 201 This function does not display the buffer in any window, so the user |
203 cannot necessarily see the buffer. But Lisp programs will now operate | 202 cannot necessarily see the buffer. But Lisp programs will now operate |
204 on it. | 203 on it. |
205 @end defun | 204 @end defun |
218 @end defspec | 217 @end defspec |
219 | 218 |
220 @defmac with-current-buffer buffer-or-name body@dots{} | 219 @defmac with-current-buffer buffer-or-name body@dots{} |
221 The @code{with-current-buffer} macro saves the identity of the current | 220 The @code{with-current-buffer} macro saves the identity of the current |
222 buffer, makes @var{buffer-or-name} current, evaluates the @var{body} | 221 buffer, makes @var{buffer-or-name} current, evaluates the @var{body} |
223 forms, and finally restores the buffer. The return value is the value | 222 forms, and finally restores the current buffer. @var{buffer-or-name} |
224 of the last form in @var{body}. The current buffer is restored even | 223 must specify an existing buffer or the name of an existing buffer. |
225 in case of an abnormal exit via @code{throw} or error (@pxref{Nonlocal | 224 |
226 Exits}). | 225 The return value is the value of the last form in @var{body}. The |
227 | 226 current buffer is restored even in case of an abnormal exit via |
228 An error is signaled if @var{buffer-or-name} does not identify an | 227 @code{throw} or error (@pxref{Nonlocal Exits}). |
229 existing buffer. | |
230 @end defmac | 228 @end defmac |
231 | 229 |
232 @defmac with-temp-buffer body@dots{} | 230 @defmac with-temp-buffer body@dots{} |
233 @anchor{Definition of with-temp-buffer} | 231 @anchor{Definition of with-temp-buffer} |
234 The @code{with-temp-buffer} macro evaluates the @var{body} forms | 232 The @code{with-temp-buffer} macro evaluates the @var{body} forms |
909 @code{with-output-to-temp-buffer} (@pxref{Temporary Displays}) and | 907 @code{with-output-to-temp-buffer} (@pxref{Temporary Displays}) and |
910 @code{create-file-buffer} (@pxref{Visiting Files}). Starting a | 908 @code{create-file-buffer} (@pxref{Visiting Files}). Starting a |
911 subprocess can also create a buffer (@pxref{Processes}). | 909 subprocess can also create a buffer (@pxref{Processes}). |
912 | 910 |
913 @defun get-buffer-create buffer-or-name | 911 @defun get-buffer-create buffer-or-name |
914 This function returns a buffer named @var{buffer-or-name}. An error is | 912 This function returns a buffer named @var{buffer-or-name}. The buffer |
915 signaled if @var{buffer-or-name} is neither a string nor a buffer. The | 913 returned does not become the current buffer---this function does not |
916 buffer returned does not become the current buffer---this function does | 914 change which buffer is current. |
917 not change which buffer is current. | 915 |
918 | 916 @var{buffer-or-name} must be either a string or an existing buffer. If |
919 If @var{buffer-or-name} is a string and a live buffer with that name | 917 it is a string and a live buffer with that name already exists, |
920 exists, it returns that buffer. If no such buffer exists, it creates a | 918 @code{get-buffer-create} returns that buffer. If no such buffer exists, |
921 new buffer. If @var{buffer-or-name} is a buffer instead of a string, it | 919 it creates a new buffer. If @var{buffer-or-name} is a buffer instead of |
922 is returned as given, even if it is dead. | 920 a string, it is returned as given, even if it is dead. |
923 | 921 |
924 @example | 922 @example |
925 @group | 923 @group |
926 (get-buffer-create "foo") | 924 (get-buffer-create "foo") |
927 @result{} #<buffer foo> | 925 @result{} #<buffer foo> |