diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-12 16:57:54 +0200 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2020-08-12 16:57:54 +0200 |
commit | 4377415e35c0914bfa79c406fd5759c09c1af411 (patch) | |
tree | 6f4b8b70b513a30cb4b2d255c577edffbfc636c8 | |
parent | Remove stack overflow handler for /remove/. (diff) | |
download | calp-4377415e35c0914bfa79c406fd5759c09c1af411.tar.gz calp-4377415e35c0914bfa79c406fd5759c09c1af411.tar.xz |
Improve filtering when loading vcomponents.
Diffstat (limited to '')
-rw-r--r-- | module/vcomponent/instance/methods.scm | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/module/vcomponent/instance/methods.scm b/module/vcomponent/instance/methods.scm index 4baf9409..ea3522f9 100644 --- a/module/vcomponent/instance/methods.scm +++ b/module/vcomponent/instance/methods.scm @@ -54,13 +54,18 @@ (slot-set! this 'calendars (load-calendars (slot-ref this 'calendar-files))) - (slot-set! this 'events - (concatenate - (map (lambda (cal) (remove - (extract 'X-HNH-REMOVED) - (filter (lambda (o) (eq? 'VEVENT (type o))) - (children cal)))) - (slot-ref this 'calendars)))) + + (let* ((groups + (group-by + type (concatenate + (map children (slot-ref this 'calendars))))) + (events (awhen (assoc-ref groups 'VEVENT) + (car it))) + (removed remaining (partition (extract 'X-HNH-REMOVED) events))) + + ;; TODO figure out what to do with removed events + + (slot-set! this 'events (append #|removed|# remaining))) (let* ((repeating regular (partition repeating? (slot-ref this 'events)))) (slot-set! this 'fixed-events (sort*! regular date/-time<? (extract 'DTSTART))) |