+;;; Remove all pending blocks to be deleted. Return the nearest live
+;;; block after or equal to BLOCK.
+(defun clean-component (component &optional block)
+ (loop while (component-delete-blocks component)
+ ;; actual deletion of a block may queue new blocks
+ do (let ((current (pop (component-delete-blocks component))))
+ (when (eq block current)
+ (setq block (block-next block)))
+ (delete-block current)))
+ block)
+