c-tentative-buffer-changes

c-tentative-buffer-changes is a Lisp macro in `cc-defs.el'.

(c-tentative-buffer-changes &rest BODY)

Eval BODY and optionally restore the buffer contents to the state it
was in before BODY. Any changes are kept if the last form in BODY
returns non-nil. Otherwise it's undone using the undo facility, and
various other buffer state that might be affected by the changes is
restored. That includes the current buffer, point, mark, mark
activation (similar to `save-excursion'), and the modified state.
The state is also restored if BODY exits nonlocally.

If BODY makes a change that unconditionally is undone then wrap this
macro inside `c-save-buffer-state'. That way the change can be done
even when the buffer is read-only, and without interference from
various buffer change hooks.