Function: combobulate-with-change-group
combobulate-with-change-group is a macro defined in
combobulate-interface.el.
Signature
(combobulate-with-change-group &rest BODY)
Source Code
;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-interface.el
(defmacro combobulate-with-change-group (&rest body)
(declare (indent 0) (debug t))
(let ((handle (gensym "--change-group-handle--"))
(success (gensym "--change-group-success--"))
(explicitly-cancelled (gensym "--change-group-explicitly-cancelled--")))
`(let ((,handle (prepare-change-group))
(,explicitly-cancelled nil)
;; Don't truncate any undo data in the middle of this.
(undo-outer-limit nil)
(undo-limit most-positive-fixnum)
(undo-strong-limit most-positive-fixnum)
(,success nil))
(cl-flet
((accept-changes () (accept-change-group ,handle))
(cancel-changes ()
(cancel-change-group ,handle)
(setq ,explicitly-cancelled t)))
(unwind-protect
(progn
;; This is inside the unwind-protect because
;; it enables undo if that was disabled; we need
;; to make sure that it gets disabled again.
(activate-change-group ,handle)
(prog1 ,(macroexp-progn body)
(setq ,success t)))
;; Either of these functions will disable undo
;; if it was disabled before.
(cond
;; If we explicitly cancelled, do not cancel or accept the
;; changes.
(,explicitly-cancelled nil)
(,success (accept-changes))
(t (cancel-changes))))))))