aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/span.el
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 /lib/span.el
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.
Diffstat (limited to 'lib/span.el')
-rw-r--r--lib/span.el11
1 files changed, 8 insertions, 3 deletions
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."