On creation of an overlay it's possible to specify the "insertion type" / advance behavior of the beginning and end markers:
(make-overlay BEG END &optional BUFFER FRONT-ADVANCE REAR-ADVANCE)
It's possible to change the insertion behavior for markers directly:
(set-marker-insertion-type MARKER TYPE)
Set the insertion-type of MARKER to TYPE. If TYPE is t, it means the marker advances when you insert text at it. If TYPE is nil, it means the marker stays behind when you insert text at it.
From Managing Overlays:
"Do not try modifying the markers in the overlay by hand, as that fails to update other vital data structures and can cause some overlays to be lost."
I get that markers are not easily accessible for the purposes of encapsulation, but I really want to temporarily change the insertion behavior temporarily! :-) I suppose that I can destructively re-create the overlay twice, but that involves copying properties and any costs associated with underlying overlay data structures.
Q: How can I efficiently modify overlay marker insertion types?
If I were to circumvent the intended information-hiding and obtained a reference to individual markers, would modifying the insertion type temporarily (and inserting text) violate an essential invariant for overlay data structures?