Function: tempel--sync-replace
tempel--sync-replace is a natively compiled function defined in
tempel.el.
Signature
(tempel--sync-replace BEG END OV STR)
Documentation
Replace region between BEG and END with STR.
If OV is alive, move it.
Source Code
;; Defined in /nix/store/b3ibjbs2i12kyhwapibfx6i39f025i85-emacs-packages-deps/share/emacs/site-lisp/elpa/tempel-20260705.1258/tempel.el
(defun tempel--sync-replace (beg end ov str)
"Replace region between BEG and END with STR.
If OV is alive, move it."
(let ((old (buffer-substring-no-properties beg end)))
(setq ov (and ov (overlay-buffer ov) ov))
(unless (equal str old)
(unless (eq buffer-undo-list t)
(push (list 'apply #'tempel--sync-replace
beg (+ beg (length str)) ov old)
buffer-undo-list))
(let ((buffer-undo-list t))
(save-excursion
(goto-char beg)
(delete-char (- end beg))
(insert str)
(when ov
(move-overlay ov beg (point))
(tempel--update-mark ov)))))))