summaryrefslogtreecommitdiff
path: root/doc/lispref/buffers.texi
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2018-06-02 13:27:22 +0300
committerEli Zaretskii <eliz@gnu.org>2018-06-02 13:27:22 +0300
commit641c94ce68399e89a35769cb8727c59412767faa (patch)
treef1dd14db6bc1783a522b99cfe7dcdc6487c0f662 /doc/lispref/buffers.texi
parent6e0ff4cc1f261def00f9f9dd581ba6ef72703f0c (diff)
downloademacs-641c94ce68399e89a35769cb8727c59412767faa.tar.gz
Imp[rove documentation of 'with-silent-modifications'
* doc/lispref/buffers.texi (Buffer Modification): Document 'with-silent-modifications'. (Bug#31613) * doc/lispref/text.texi (Changing Properties): Add a cross-reference to "Buffer Modification". Improve wording.
Diffstat (limited to 'doc/lispref/buffers.texi')
-rw-r--r--doc/lispref/buffers.texi14
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 45e90669b7e..686b6162a55 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -587,6 +587,20 @@ in between the calls. If @var{buffer} is @code{nil} (or omitted), the
current buffer is used.
@end defun
+Sometimes there's a need for modifying buffer in a way that doesn't
+really change its text, like if only its text properties are changed.
+If your program needs to modify a buffer without triggering any hooks
+and features that react to buffer modifications, use the
+@code{with-silent-modifications} macro.
+
+@defmac with-silent-modifications body@dots{}
+Execute @var{body} pretending it does not modify the buffer. This
+includes checking whether the buffer's file is locked (@pxref{File
+Locks}), running buffer modification hooks (@pxref{Change Hooks}),
+etc. Note that if @var{body} actually modifies the buffer text, its
+undo data may become corrupted.
+@end defmac
+
@node Modification Time
@section Buffer Modification Time
@cindex comparing file modification time