diff options
| author | Philipp Stephani | 2017-09-24 19:32:16 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-09-24 19:32:16 +0200 |
| commit | d93301242f38d3d9aaa55899c07496f0bdecf391 (patch) | |
| tree | 3b34bd2bc472f7a07e894fd96b9d09f7982905c9 | |
| parent | 00e4e3e9d273a193620c3a4bb4914e555cb8e343 (diff) | |
| download | emacs-d93301242f38d3d9aaa55899c07496f0bdecf391.tar.gz emacs-d93301242f38d3d9aaa55899c07496f0bdecf391.zip | |
Document 'replace-buffer-contents' in the manual.
* doc/lispref/text.texi (Replacing): New node.
| -rw-r--r-- | doc/lispref/text.texi | 24 | ||||
| -rw-r--r-- | etc/NEWS | 1 |
2 files changed, 24 insertions, 1 deletions
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi index a7d10797cd0..baa3c708e90 100644 --- a/doc/lispref/text.texi +++ b/doc/lispref/text.texi | |||
| @@ -54,6 +54,8 @@ the character after point. | |||
| 54 | * Registers:: How registers are implemented. Accessing the text or | 54 | * Registers:: How registers are implemented. Accessing the text or |
| 55 | position stored in a register. | 55 | position stored in a register. |
| 56 | * Transposition:: Swapping two portions of a buffer. | 56 | * Transposition:: Swapping two portions of a buffer. |
| 57 | * Replacing:: Replacing the text of one buffer with the text | ||
| 58 | of another buffer. | ||
| 57 | * Decompression:: Dealing with compressed data. | 59 | * Decompression:: Dealing with compressed data. |
| 58 | * Base 64:: Conversion to or from base 64 encoding. | 60 | * Base 64:: Conversion to or from base 64 encoding. |
| 59 | * Checksum/Hash:: Computing cryptographic hashes. | 61 | * Checksum/Hash:: Computing cryptographic hashes. |
| @@ -4328,6 +4330,28 @@ is non-@code{nil}, @code{transpose-regions} does not do this---it leaves | |||
| 4328 | all markers unrelocated. | 4330 | all markers unrelocated. |
| 4329 | @end defun | 4331 | @end defun |
| 4330 | 4332 | ||
| 4333 | @node Replacing | ||
| 4334 | @section Replacing Buffer Text | ||
| 4335 | |||
| 4336 | You can use the following function to replace the text of one buffer | ||
| 4337 | with the text of another buffer: | ||
| 4338 | |||
| 4339 | @deffn Command replace-buffer-contents source | ||
| 4340 | This function replaces the accessible portion of the current buffer | ||
| 4341 | with the accessible portion of the buffer @var{source}. @var{source} | ||
| 4342 | may either be a buffer object or the name of a buffer. When | ||
| 4343 | @code{replace-buffer-contents} succeeds, the text of the accessible | ||
| 4344 | portion of the current buffer will be equal to the text of the | ||
| 4345 | accessible portion of the @var{source} buffer. This function attempts | ||
| 4346 | to keep point, markers, text properties, and overlays in the current | ||
| 4347 | buffer intact. One potential case where this behavior is useful is | ||
| 4348 | external code formatting programs: they typically write the | ||
| 4349 | reformatted text into a temporary buffer or file, and using | ||
| 4350 | @code{delete-region} and @code{insert-buffer-substring} would destroy | ||
| 4351 | these properties. However, the latter combination is typically | ||
| 4352 | faster. @xref{Deletion}, and @ref{Insertion}. | ||
| 4353 | @end deffn | ||
| 4354 | |||
| 4331 | @node Decompression | 4355 | @node Decompression |
| 4332 | @section Dealing With Compressed Data | 4356 | @section Dealing With Compressed Data |
| 4333 | 4357 | ||
| @@ -578,7 +578,6 @@ Negative prefix arg flips the direction of selection. Also, | |||
| 578 | defun are selected unless they are separated from the defun by a blank | 578 | defun are selected unless they are separated from the defun by a blank |
| 579 | line. | 579 | line. |
| 580 | 580 | ||
| 581 | --- | ||
| 582 | ** New command 'replace-buffer-contents'. | 581 | ** New command 'replace-buffer-contents'. |
| 583 | This command replaces the contents of the accessible portion of the | 582 | This command replaces the contents of the accessible portion of the |
| 584 | current buffer with the contents of the accessible portion of a | 583 | current buffer with the contents of the accessible portion of a |