more thorough job of deleting old overlays on startup
authorJohn Foerch <jjfoerch@earthlink.net>
Tue, 7 Dec 2010 22:13:51 +0000 (17:13 -0500)
committerJohn Foerch <jjfoerch@earthlink.net>
Tue, 7 Dec 2010 22:13:51 +0000 (17:13 -0500)
Before this patch, revert-buffer caused stale overlays to not get cleaned
up because it depended on visible-mark-overlays being valid.  However,
reverting the buffer wipes out local variables.

visible-mark.el

index 8bc719a..9318403 100644 (file)
   :type '(repeat regexp))
                   
 (defun visible-mark-initialize-overlays ()
-  (mapc 'delete-overlay visible-mark-overlays)
+  (mapc
+   (lambda (x)
+     (when (eq 'visible-mark (overlay-get x 'category))
+       (delete-overlay x)))
+   (overlays-in (point-min) (point-max)))  
   (let (overlays)
     (dotimes (i visible-mark-max)
       (let ((overlay (make-overlay (point-min) (point-min))))