changeset 67214:4fd503f32b2c

(cua--rectangle-overlays): Make permanent-local. (cua--rectangle-post-command): Cleanup overlays and deactivate mark after revert-buffer (or anything else which kills all local variables).
author Kim F. Storm <storm@cua.dk>
date Tue, 29 Nov 2005 23:58:20 +0000
parents 818361523ce8
children c84d59e9c018
files lisp/emulation/cua-rect.el
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emulation/cua-rect.el	Tue Nov 29 23:54:47 2005 +0000
+++ b/lisp/emulation/cua-rect.el	Tue Nov 29 23:58:20 2005 +0000
@@ -65,6 +65,7 @@
 ;; List of overlays used to display current rectangle.
 (defvar cua--rectangle-overlays nil)
 (make-variable-buffer-local 'cua--rectangle-overlays)
+(put 'cua--rectangle-overlays 'permanent-local t)
 
 (defvar cua--overlay-keymap
   (let ((map (make-sparse-keymap)))
@@ -1393,7 +1394,12 @@
       (if (and mark-active
                (not deactivate-mark))
           (cua--highlight-rectangle)
-        (cua--deactivate-rectangle)))
+        (cua--deactivate-rectangle))
+    (when cua--rectangle-overlays
+      ;; clean-up after revert-buffer
+      (mapcar (function delete-overlay) cua--rectangle-overlays)
+      (setq cua--rectangle-overlays nil)
+      (setq deactivate-mark t)))
   (when cua--rect-undo-set-point
     (goto-char cua--rect-undo-set-point)
     (setq cua--rect-undo-set-point nil)))