aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKen Manheimer2011-03-29 14:26:01 -0400
committerKen Manheimer2011-03-29 14:26:01 -0400
commitd806ab682a8e914345db3f2eede292f85745c98c (patch)
tree1c92f7e126958fe72a6aca21e966a0e5a1bc006a
parent94eab1c84d9862cb56db2f610362e33107d75774 (diff)
downloademacs-d806ab682a8e914345db3f2eede292f85745c98c.tar.gz
emacs-d806ab682a8e914345db3f2eede292f85745c98c.zip
* 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.
-rw-r--r--lisp/ChangeLog13
-rw-r--r--lisp/allout-widgets.el16
-rw-r--r--lisp/allout.el5
3 files changed, 31 insertions, 3 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dbd335b73dd..8e6e78c705e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,16 @@
12011-03-29 Ken Manheimer <ken.manheimer@gmail.com>
2
3 * allout.el (allout-hide-by-annotation, allout-flag-region):
4 Reduce possibility of overlay leakage by making them volatile.
5
6 * allout-widgets.el (allout-widgets-tally): Define as nil so the
7 hash is not shared between buffers. Mode initialization is
8 responsible for giving it a useful starting value.
9 (allout-item-span): Reduce possibility of overlay leakage by
10 making them volatile.
11 (allout-widgets-count-buttons-in-region): Add diagnostic function
12 for tracking down button overlay leaks.
13
12011-03-29 Leo Liu <sdl.web@gmail.com> 142011-03-29 Leo Liu <sdl.web@gmail.com>
2 15
3 * ido.el (ido-read-internal): Use the default history var 16 * ido.el (ido-read-internal): Use the default history var
diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el
index 47f181ab76b..ae4265bda1f 100644
--- a/lisp/allout-widgets.el
+++ b/lisp/allout-widgets.el
@@ -238,7 +238,7 @@ buffer, and tracking increases as new widgets are added and
238decreases as obsolete widgets are garbage collected." 238decreases as obsolete widgets are garbage collected."
239 :type 'boolean 239 :type 'boolean
240 :group 'allout-widgets-developer) 240 :group 'allout-widgets-developer)
241(defvar allout-widgets-tally (make-hash-table :test 'eq :weakness 'key) 241(defvar allout-widgets-tally nil
242 "Hash-table of existing allout widgets, for debugging. 242 "Hash-table of existing allout widgets, for debugging.
243 243
244Table is maintained iff `allout-widgets-maintain-tally' is non-nil. 244Table is maintained iff `allout-widgets-maintain-tally' is non-nil.
@@ -2100,6 +2100,7 @@ previously established or is not moved."
2100 (cond ((not overlay) (when start 2100 (cond ((not overlay) (when start
2101 (setq overlay (make-overlay start end nil t nil)) 2101 (setq overlay (make-overlay start end nil t nil))
2102 (overlay-put overlay 'button item-widget) 2102 (overlay-put overlay 'button item-widget)
2103 (overlay-put overlay 'evaporate t)
2103 (widget-put item-widget :span-overlay overlay) 2104 (widget-put item-widget :span-overlay overlay)
2104 t)) 2105 t))
2105 ;; report: 2106 ;; report:
@@ -2343,6 +2344,19 @@ The elements of LIST are not copied, just the list structure itself."
2343 (while (consp list) (push (pop list) res)) 2344 (while (consp list) (push (pop list) res))
2344 (prog1 (nreverse res) (setcdr res list))) 2345 (prog1 (nreverse res) (setcdr res list)))
2345 (car list))) 2346 (car list)))
2347;;;_ . allout-widgets-count-buttons-in-region (start end)
2348(defun allout-widgets-count-buttons-in-region (start end)
2349 "Debugging/diagnostic tool - count overlays with 'button' property in region."
2350 (interactive "r")
2351 (setq start (or start (point-min))
2352 end (or end (point-max)))
2353 (if (> start end) (let ((interim start)) (setq start end end interim)))
2354 (let ((button-overlays (delq nil
2355 (mapcar (function (lambda (o)
2356 (if (overlay-get o 'button)
2357 o)))
2358 (overlays-in start end)))))
2359 (length button-overlays)))
2346 2360
2347;;;_ : Run unit tests: 2361;;;_ : Run unit tests:
2348(defun allout-widgets-run-unit-tests () 2362(defun allout-widgets-run-unit-tests ()
diff --git a/lisp/allout.el b/lisp/allout.el
index 3fb8ed7ccd5..736ec42718b 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -4489,8 +4489,9 @@ Topic exposure is marked with text-properties, to be used by
4489 ;; advance to just after end of this annotation: 4489 ;; advance to just after end of this annotation:
4490 (setq next (allout-next-single-char-property-change 4490 (setq next (allout-next-single-char-property-change
4491 (point) 'allout-was-hidden nil end)) 4491 (point) 'allout-was-hidden nil end))
4492 (overlay-put (make-overlay prev next nil 'front-advance) 4492 (let ((o (make-overlay prev next nil 'front-advance)))
4493 'category 'allout-exposure-category) 4493 (overlay-put o 'category 'allout-exposure-category)
4494 (overlay-put o 'evaporate t))
4494 (allout-deannotate-hidden prev next) 4495 (allout-deannotate-hidden prev next)
4495 (setq prev next) 4496 (setq prev next)
4496 (if next (goto-char next))))) 4497 (if next (goto-char next)))))