aboutsummaryrefslogtreecommitdiff
path: root/vcalendar.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-26 10:33:02 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-26 10:33:02 +0100
commit8c5b4d4f4a0e07525efb9eb04ec99068946cdef4 (patch)
tree53830b1ea10e4dd99e9b54c16c539aa680052b60 /vcalendar.scm
parentAdd simple sorted agenda to code.scm. (diff)
downloadcalp-8c5b4d4f4a0e07525efb9eb04ec99068946cdef4.tar.gz
calp-8c5b4d4f4a0e07525efb9eb04ec99068946cdef4.tar.xz
Move load-extension to (vcalendar primitive).
Diffstat (limited to 'vcalendar.scm')
-rw-r--r--vcalendar.scm16
1 files changed, 12 insertions, 4 deletions
diff --git a/vcalendar.scm b/vcalendar.scm
index c6aee02c..c2228650 100644
--- a/vcalendar.scm
+++ b/vcalendar.scm
@@ -1,12 +1,11 @@
(define-module (vcalendar)
+ #:use-module (vcalendar primitive)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
#:export (make-vcomponent children set-attr! get-attr type
+ type-filter
transform-attr! push-child!))
-(setenv "LD_LIBRARY_PATH" (dirname (current-filename)))
-(load-extension "libguile-calendar" "init_lib")
-
(define (make-vcomponent path)
(if (string-ci=? ".ics" (string-take-right path 4))
;; == Single ICS file ==
@@ -27,7 +26,16 @@
accum)
'() (%vcomponent-children (%vcomponent-make path)))))
-(define children %vcomponent-children)
+(define (type-filter t lst)
+ (filter (lambda (e) (eqv? t (type e)))
+ lst))
+
+(define* (children component #:optional only-type)
+ (let ((childs (%vcomponent-children component)))
+ (if only-type
+ (type-filter only-type childs)
+ childs)))
+
(define set-attr! %vcomponent-set-attribute!)
(define get-attr %vcomponent-get-attribute)
(define type %vcomponent-type)