aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Hendrik Tews <hendrik@askra.de>2011-01-24 15:37:30 +0000
committerGravatar Hendrik Tews <hendrik@askra.de>2011-01-24 15:37:30 +0000
commit56f51a5e66c5b4f35837b7592b832f23b05c97e8 (patch)
tree55f80389b1e4b658ca24b89579dc733251f9fb29
parentfd226c8f0c56a2be6a751b421674e594d0a4b04a (diff)
- change 'span-delete-action in 'span-delete-actions, which is
now a list of functions to be run when the span is deleted. Use span-add-delete-action to add a delete action.
-rw-r--r--generic/proof-script.el2
-rw-r--r--lib/span.el11
2 files changed, 9 insertions, 4 deletions
diff --git a/generic/proof-script.el b/generic/proof-script.el
index 55a80d4a..bf4541bf 100644
--- a/generic/proof-script.el
+++ b/generic/proof-script.el
@@ -547,7 +547,7 @@ It is recorded in the span with the 'rawname property."
(span-set-property span 'id idsym)
(span-set-property span 'name name)
(span-set-property span 'rawname rawname)
- (span-set-property span 'span-delete-action delfn)
+ (span-add-delete-action span delfn)
;; Ideally: would keep invisible property to be the idiom type
;; (span-set-property span 'invisible idiom)
diff --git a/lib/span.el b/lib/span.el
index cbdf8406..371292ec 100644
--- a/lib/span.el
+++ b/lib/span.el
@@ -85,11 +85,16 @@
(car-safe (spans-at-point-prop pt prop)))
(defsubst span-delete (span)
- "Delete SPAN."
- (let ((predelfn (span-property span 'span-delete-action)))
- (and predelfn (funcall predelfn)))
+ "Run the 'span-delete-actions and delete SPAN."
+ (mapc (lambda (predelfn) (funcall predelfn))
+ (span-property span 'span-delete-actions))
(delete-overlay span))
+(defsubst span-add-delete-action (span action)
+ "Add ACTION to the list of functions called when SPAN is deleted."
+ (span-set-property span 'span-delete-actions
+ (cons action (span-property span 'span-delete-actions))))
+
;; The next two change ordering of list of spans:
(defsubst span-mapcar-spans (fn start end prop)
"Map function FN over spans between START and END with property PROP."