aboutsummaryrefslogtreecommitdiff
path: root/code.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-02-26 00:07:42 +0100
committerHugo Hörnquist <hugo@hornquist.se>2019-02-26 00:07:42 +0100
commitd1cde5a4c2b656f696ac42aa1ab338551c67e275 (patch)
treeb46e253c8484a78d0719be3c5be33931c4cf5930 /code.scm
parentSingle elemnt lists in components now return their CAR. (diff)
downloadcalp-d1cde5a4c2b656f696ac42aa1ab338551c67e275.tar.gz
calp-d1cde5a4c2b656f696ac42aa1ab338551c67e275.tar.xz
Rename some functions.
Diffstat (limited to 'code.scm')
-rwxr-xr-xcode.scm31
1 files changed, 19 insertions, 12 deletions
diff --git a/code.scm b/code.scm
index ec92c347..5ad6ad6c 100755
--- a/code.scm
+++ b/code.scm
@@ -5,26 +5,33 @@
(begin
;; Supurflous begin block here to make sourcing into geiser easier.
(setenv "LD_LIBRARY_PATH" (getcwd))
- (load-extension "libguile-calendar" "init_vcomponent"))
+ (load-extension "libguile-calendar" "init_lib"))
+
+(define make-vcomponent %vcomponent-make)
+(define children %vcomponent-children)
+(define set-attr! %vcomponent-set-attribute!)
+(define get-attr %vcomponent-get-attribute)
(define root (make-vcomponent "testcal/d1-b.ics"))
-(define cal (car (vcomponent-children root)))
+(define cal (car (children root)))
;; TODO flatten all calendars into root
(use-modules (srfi srfi-19)
(srfi srfi-26))
-(for-each (lambda (ev)
- (vcomponent-set-attribute!
- ev "DTSTART"
- ((cut string->date <> "~Y~m~dT~H~M~S")
- (vcomponent-get-attribute ev "DTSTART"))))
- (vcomponent-children cal))
+(define (mutate-attr! ev field transformer)
+ (set-attr! ev field
+ (transformer
+ (get-attr ev field))))
+
+(for-each (cut mutate-attr! <> "DTSTART"
+ (cut string->date <> "~Y~m~dT~H~M~S"))
+ (children cal))
-(display (vcomponent-get-attribute (car (vcomponent-children cal))
- "DTSTART"))
+(display (get-attr (car (children cal))
+ "DTSTART"))
(newline)
-(display (vcomponent-get-attribute (car (vcomponent-children cal))
- "DTSTART"))
+(display (get-attr (car (children cal))
+ "DTSTART"))
(newline)