From 2d78e18454545801fbf3ac02c1d32ea68ef65de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 25 Apr 2019 11:39:38 +0200 Subject: Clean up util and move exceptions. --- module/vcomponent/output.scm | 58 ++++++++++++++++------------------ module/vcomponent/recurrence/parse.scm | 2 +- 2 files changed, 29 insertions(+), 31 deletions(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/output.scm b/module/vcomponent/output.scm index 8db2d85b..6d346230 100644 --- a/module/vcomponent/output.scm +++ b/module/vcomponent/output.scm @@ -27,16 +27,15 @@ (format port "~a <~a> :: ~:a~%" (make-string depth #\:) (type comp) comp) - (for-each-in kvs - (lambda (kv) - (let* (((key . at) kv)) - (format port "~a ~15@a~{;~a=~{~a~^,~}~}: ~a~%" - (make-string depth #\:) - key - (concatenate (hash-map->list list (cdr at))) - (v at))))) - (for-each-in (children comp) - (lambda (e) (print-vcomponent e port #:depth (1+ depth)))))) + (for kv in kvs + (let* (((key . at) kv)) + (format port "~a ~15@a~{;~a=~{~a~^,~}~}: ~a~%" + (make-string depth #\:) + key + (concatenate (hash-map->list list (cdr at))) + (v at)))) + (for-each (lambda (e) (print-vcomponent e port #:depth (1+ depth))) + (children comp)))) @@ -69,29 +68,28 @@ Removes the X-HNH-FILENAME attribute, and sets PRODID to (let ((kvs (map (lambda (key) (list key (attr comp key))) (filter (negate (cut key=? <> 'X-HNH-FILENAME)) (attributes comp))))) - (for-each-in - kvs (lambda (kv) - (let* (((key value) kv)) - (catch 'wrong-type-arg - (lambda () - (format port "~a:~a~%" key - (string->ics-safe-string - (or (case key - ((DTSTART DTEND) - (if (string? value) - value - (time->string value "~Y~m~dT~H~M~S"))) + (for kv in kvs + (let* (((key value) kv)) + (catch 'wrong-type-arg + (lambda () + (format port "~a:~a~%" key + (string->ics-safe-string + (or (case key + ((DTSTART DTEND) + (if (string? value) + value + (time->string value "~Y~m~dT~H~M~S"))) - ((DURATION) "Just forget it") + ((DURATION) "Just forget it") - (else value)) - "")))) + (else value)) + "")))) - ;; Catch - (lambda (type proc fmt . args) - (apply format (current-error-port) "[ERR] ~a in ~a (~a) ~a:~%~?~%" - type key proc (attr comp 'X-HNH-FILENAME) - fmt args)))))) + ;; Catch + (lambda (type proc fmt . args) + (apply format (current-error-port) "[ERR] ~a in ~a (~a) ~a:~%~?~%" + type key proc (attr comp 'X-HNH-FILENAME) + fmt args))))) (for-each (cut serialize-vcomponent <> port) (children comp))) (format port "END:~a~%" (type comp)))) diff --git a/module/vcomponent/recurrence/parse.scm b/module/vcomponent/recurrence/parse.scm index 0b62d134..15e03f9c 100644 --- a/module/vcomponent/recurrence/parse.scm +++ b/module/vcomponent/recurrence/parse.scm @@ -7,7 +7,7 @@ #:duplicates (last) ; Replace @var{count} #:use-module (vcomponent recurrence internal) #:use-module (util) - #:use-module (exceptions) + #:use-module (util exceptions) #:use-module (ice-9 curried-definitions) #:export (parse-recurrence-rule)) -- cgit v1.2.3