Somehow, annoyingly, I missed this last message earlier. But I'd still prefer to thank you for your instructive answers. Indeed, I have read about the evaporate property before, but I have not used it before, so that I forgot about it. I'm more or less sure that it will stick this time... On Sat, 25 Feb 2023 at 14:42, Eli Zaretskii wrote: > > From: dalanicolai > > 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. >