aboutsummaryrefslogtreecommitdiff
path: root/module/vcomponent
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-05-11 21:21:29 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-05-11 21:21:29 +0200
commit524675c3f165d7cfc5f191e056f3c755d9ed4d2e (patch)
treed4dff2057afa1163c19b3d0c5df7f5fa88d518cc /module/vcomponent
parentResolve failing tests from last commit. (diff)
downloadcalp-524675c3f165d7cfc5f191e056f3c755d9ed4d2e.tar.gz
calp-524675c3f165d7cfc5f191e056f3c755d9ed4d2e.tar.xz
Add procedure remove-child!
Diffstat (limited to 'module/vcomponent')
-rw-r--r--module/vcomponent/base.scm8
1 files changed, 8 insertions, 0 deletions
diff --git a/module/vcomponent/base.scm b/module/vcomponent/base.scm
index 18f31aaf..3d40ef9c 100644
--- a/module/vcomponent/base.scm
+++ b/module/vcomponent/base.scm
@@ -77,6 +77,14 @@
(set-component-children! parent (cons child (children parent)))
(set-component-parent! child parent))
+(define-public (remove-child! parent-component child)
+ (unless (eq? parent-component (parent child))
+ (scm-error
+ 'wrong-type-arg "remove-child!" "Child doesn't belong to parent"
+ (list parent-component child) #f))
+ (set-component-children! parent-component (delq1! child (children parent-component)))
+ (set-component-parent! child #f))
+
;;; TODO key=DTSTART, (date? value) => #t
;;; KRÄVER att (props vline 'VALUE) <- "DATE"
(define (set-property! component key value)