Function: text-clone--maintain

text-clone--maintain is a byte-compiled function defined in subr.el.gz.

Signature

(text-clone--maintain OL1 AFTER BEG END &optional LEN)

Documentation

Propagate the changes made under the overlay OL1 to the other clones.

This is used on the modification-hooks property of text clones.

Source Code

;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun text-clone--maintain (ol1 after beg end &optional _len)
  "Propagate the changes made under the overlay OL1 to the other clones.
This is used on the `modification-hooks' property of text clones."
  (when (and after (not undo-in-progress)
             (not text-clone--maintaining))
    ;; An after-change hook (like this one) should never modify a buffer,
    ;; so record the change and arrange to process it soon.
    (let ((pending (overlay-get ol1 'text-clone--pending)))
      (if pending
          (progn
            (setcar pending (min beg (car pending)))
            (setcdr pending (max end (cdr pending))))
        (overlay-put ol1 'text-clone--pending (cons beg end))
        (push ol1 text-clone--pending-overlays)
        (unless (memq #'text-clone--maintain-overlays
                 (default-value 'post-command-hook))
          ;; Perform the update as soon as possible.
          (add-hook 'post-command-hook #'text-clone--maintain-overlays)
          (run-with-timer 0 nil #'text-clone--maintain-overlays))))))