Lars Ingebrigtsen writes: > miha@kamnitnik.top writes: > >>> Do we have some machinery to handle overlays like this, or conventions >>> about what to do with overlays when doing a `revert-buffer' actions? >> >> IMO, the responsibility of code that creates overlays is to clean them >> up in change-major-mode-hook. > > I don't think `revert-buffer' calls that hook? I believe that revert-buffer--default does end up calling this hook (through `normal-mode'), but I see that the original post was about a vc-dir buffer, which has its own revert-buffer-function and it indeed seems like it doesn't call that hook. I guess my idea was the following: we want at most one bookmark overlay per buffer, so it's natural to put this overlay in a buffer local variable. We then call move-overlay instead of make-overlay if it already exists. However, kill-all-local-variables would kill this variable but not delete the overlay. We have to either make this variable permanent or delete this overlay in change-major-mode-hook. I tend to prefer the later solution. > > -- > (domestic pets only, the antidote for overdose, milk.) > bloggy blog: http://lars.ingebrigtsen.no