emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103775: * allout.el (allout-hide-by-


From: Ken Manheimer
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103775: * allout.el (allout-hide-by-annotation, allout-flag-region): Reduce
Date: Tue, 29 Mar 2011 14:26:01 -0400
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103775
committer: Ken Manheimer <address@hidden>
branch nick: trunk
timestamp: Tue 2011-03-29 14:26:01 -0400
message:
  * allout.el (allout-hide-by-annotation, allout-flag-region): Reduce
  possibility of overlay leakage by making them volatile.
  
  * allout-widgets.el (allout-widgets-tally): Define as nil so the hash is
  not shared between buffers.  Mode initialization is responsible for giving
  it a useful starting value.
  (allout-item-span): Reduce possibility of overlay leakage by making them
  volatile.
  (allout-widgets-count-buttons-in-region): Add diagnostic function for
  tracking down overlay leaks.
modified:
  lisp/ChangeLog
  lisp/allout-widgets.el
  lisp/allout.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-03-29 13:23:38 +0000
+++ b/lisp/ChangeLog    2011-03-29 18:26:01 +0000
@@ -1,3 +1,16 @@
+2011-03-29  Ken Manheimer  <address@hidden>
+
+       * allout.el (allout-hide-by-annotation, allout-flag-region):
+       Reduce possibility of overlay leakage by making them volatile.
+
+       * allout-widgets.el (allout-widgets-tally): Define as nil so the
+       hash is not shared between buffers.  Mode initialization is
+       responsible for giving it a useful starting value.
+       (allout-item-span): Reduce possibility of overlay leakage by
+       making them volatile.
+       (allout-widgets-count-buttons-in-region): Add diagnostic function
+       for tracking down button overlay leaks.
+
 2011-03-29  Leo Liu  <address@hidden>
 
        * ido.el (ido-read-internal): Use the default history var

=== modified file 'lisp/allout-widgets.el'
--- a/lisp/allout-widgets.el    2011-03-11 18:46:12 +0000
+++ b/lisp/allout-widgets.el    2011-03-29 18:26:01 +0000
@@ -238,7 +238,7 @@
 decreases as obsolete widgets are garbage collected."
   :type 'boolean
   :group 'allout-widgets-developer)
-(defvar allout-widgets-tally (make-hash-table :test 'eq :weakness 'key)
+(defvar allout-widgets-tally nil
   "Hash-table of existing allout widgets, for debugging.
 
 Table is maintained iff `allout-widgets-maintain-tally' is non-nil.
@@ -2100,6 +2100,7 @@
     (cond ((not overlay) (when start
                            (setq overlay (make-overlay start end nil t nil))
                            (overlay-put overlay 'button item-widget)
+                           (overlay-put overlay 'evaporate t)
                            (widget-put item-widget :span-overlay overlay)
                            t))
           ;; report:
@@ -2343,6 +2344,19 @@
        (while (consp list) (push (pop list) res))
        (prog1 (nreverse res) (setcdr res list)))
     (car list)))
+;;;_  . allout-widgets-count-buttons-in-region (start end)
+(defun allout-widgets-count-buttons-in-region (start end)
+  "Debugging/diagnostic tool - count overlays with 'button' property in 
region."
+  (interactive "r")
+  (setq start (or start (point-min))
+        end (or end (point-max)))
+  (if (> start end) (let ((interim start)) (setq start end end interim)))
+  (let ((button-overlays (delq nil
+                               (mapcar (function (lambda (o)
+                                                   (if (overlay-get o 'button)
+                                                       o)))
+                                       (overlays-in start end)))))
+    (length button-overlays)))
 
 ;;;_ : Run unit tests:
 (defun allout-widgets-run-unit-tests ()

=== modified file 'lisp/allout.el'
--- a/lisp/allout.el    2011-03-16 19:03:06 +0000
+++ b/lisp/allout.el    2011-03-29 18:26:01 +0000
@@ -4489,8 +4489,9 @@
             ;; advance to just after end of this annotation:
             (setq next (allout-next-single-char-property-change
                         (point) 'allout-was-hidden nil end))
-            (overlay-put (make-overlay prev next nil 'front-advance)
-                         'category 'allout-exposure-category)
+            (let ((o (make-overlay prev next nil 'front-advance)))
+              (overlay-put o 'category 'allout-exposure-category)
+              (overlay-put o 'evaporate t))
             (allout-deannotate-hidden prev next)
             (setq prev next)
             (if next (goto-char next)))))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]