aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorPhilipp Stephani2017-09-24 19:32:16 +0200
committerPhilipp Stephani2017-09-24 19:32:16 +0200
commitd93301242f38d3d9aaa55899c07496f0bdecf391 (patch)
tree3b34bd2bc472f7a07e894fd96b9d09f7982905c9 /doc
parent00e4e3e9d273a193620c3a4bb4914e555cb8e343 (diff)
downloademacs-d93301242f38d3d9aaa55899c07496f0bdecf391.tar.gz
emacs-d93301242f38d3d9aaa55899c07496f0bdecf391.zip
Document 'replace-buffer-contents' in the manual.
* doc/lispref/text.texi (Replacing): New node.
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/text.texi24
1 files changed, 24 insertions, 0 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
4328all markers unrelocated. 4330all 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
4337with the text of another buffer:
4338
4339@deffn Command replace-buffer-contents source
4340This function replaces the accessible portion of the current buffer
4341with the accessible portion of the buffer @var{source}. @var{source}
4342may either be a buffer object or the name of a buffer. When
4343@code{replace-buffer-contents} succeeds, the text of the accessible
4344portion of the current buffer will be equal to the text of the
4345accessible portion of the @var{source} buffer. This function attempts
4346to keep point, markers, text properties, and overlays in the current
4347buffer intact. One potential case where this behavior is useful is
4348external code formatting programs: they typically write the
4349reformatted text into a temporary buffer or file, and using
4350@code{delete-region} and @code{insert-buffer-substring} would destroy
4351these properties. However, the latter combination is typically
4352faster. @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