c-save-buffer-state

c-save-buffer-state is a Lisp macro in `cc-defs.el'.

(c-save-buffer-state VARLIST &rest BODY)

Bind variables according to VARLIST (in `let*' style) and eval BODY,
then restore the buffer state under the assumption that no significant
modification has been made in BODY. A change is considered
significant if it affects the buffer text in any way that isn't
completely restored again. Changes in text properties like `face' or
`syntax-table' are considered insignificant. This macro allows text
properties to be changed, even in a read-only buffer.

This macro should be placed around all calculations which set
"insignificant" text properties in a buffer, even when the buffer is
known to be writable. That way, these text properties remain set
even if the user undoes the command which set them.

This macro should ALWAYS be placed around "temporary" internal buffer
changes (like adding a newline to calculate a text-property then
deleting it again), so that the user never sees them on his
`buffer-undo-list'. See also `c-tentative-buffer-changes'.

However, any user-visible changes to the buffer (like auto-newlines)
must not be within a `c-save-buffer-state', since the user then
wouldn't be able to undo them.

The return value is the value of the last form in BODY.