> From: dalanicolai <dalanicolai@gmail.com>
> Date: Sat, 25 Feb 2023 14:17:24 +0100
> Cc: emacs-devel@gnu.org
>
> This is great! Indeed, it works perfectly now.
> I think using the margins is just much more elegant.
>
> Although, I might have read about this behavior somewhere,
> obviously, it was not clear to me that `erase-buffer` does not
> remove the overlays. Maybe a warning/reminder about this could
> be added in the 'erase-buffer' docstring? What do you think?
> I would be happy to create a patch for that (if desired).
This is not related to erasing a buffer, it is related to deleting
text "covered" by the overlay. What happens in that case depends on
the 'evaporate' property of the overlay, which is already described in
the ELisp manual, see the node "Overlay Properties" there.