1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-14 09:39:42 +00:00

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.
This commit is contained in:
Eli Zaretskii 2018-06-02 13:27:22 +03:00
parent 6e0ff4cc1f
commit 641c94ce68
2 changed files with 18 additions and 3 deletions

View File

@ -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

View File

@ -3037,9 +3037,10 @@ construct each part with @code{propertize} and then combine them with
buffer but does not copy its properties.
@findex with-silent-modifications
If you wish to add or remove text properties to a buffer without
marking the buffer as modified, you can wrap the calls above in the
@code{with-silent-modifications} macro.
If you wish to add text properties to a buffer or remove them
without marking the buffer as modified, you can wrap the calls above
in the @code{with-silent-modifications} macro. @xref{Buffer
Modification}.
@node Property Search
@subsection Text Property Search Functions