Function: undo--wrap-and-run-primitive-undo
undo--wrap-and-run-primitive-undo is a byte-compiled function defined
in subr.el.gz.
Signature
(undo--wrap-and-run-primitive-undo BEG END ORIG-BEG ORIG-END LIST)
Documentation
Call primitive-undo on the undo elements in LIST.
This function is intended to be called purely by undo as the
function in an (apply DELTA (BEG . END) FUNNAME . ARGS) undo
element. It invokes before-change-functions and
after-change-functions once each for the entire region (BEG
END) rather than once for each individual change.
Additionally the fresh "redo" elements which are generated on
buffer-undo-list will themselves be "enclosed" in
undo--wrap-and-run-primitive-undo.
Undo elements of this form are generated by the macro
combine-change-calls.
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun undo--wrap-and-run-primitive-undo (beg end orig-beg orig-end list)
"Call `primitive-undo' on the undo elements in LIST.
This function is intended to be called purely by `undo' as the
function in an \(apply DELTA (BEG . END) FUNNAME . ARGS) undo
element. It invokes `before-change-functions' and
`after-change-functions' once each for the entire region \(BEG
END) rather than once for each individual change.
Additionally the fresh \"redo\" elements which are generated on
`buffer-undo-list' will themselves be \"enclosed\" in
`undo--wrap-and-run-primitive-undo'.
Undo elements of this form are generated by the macro
`combine-change-calls'."
(let* ((beg-delta (- orig-beg beg))
(end-delta (- orig-end end))
(list (cond ((/= beg-delta end-delta)
(error "Unexpected change of region length"))
((= beg-delta 0)
list)
(t
(let ((deltas (list (cons orig-beg beg-delta))))
(mapcar (lambda (elt)
(undo-adjust-elt elt deltas))
list))))))
(combine-change-calls beg end
(while list
(setq list (primitive-undo 1 list))))))