aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-02-21 20:10:02 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2023-09-11 19:58:54 +0200
commitcef4f5e55406246698c6cf8b3391c458e2b4668e (patch)
treeabdcc48d75662ceea3627c8e6540d8c55583388e
parentExtend `for'-macro to allow improper list elements. (diff)
downloadcalp-cef4f5e55406246698c6cf8b3391c458e2b4668e.tar.gz
calp-cef4f5e55406246698c6cf8b3391c458e2b4668e.tar.xz
Allow shorter byday when constructing recurrence rules.
-rw-r--r--module/vcomponent/recurrence/internal.scm15
1 files changed, 12 insertions, 3 deletions
diff --git a/module/vcomponent/recurrence/internal.scm b/module/vcomponent/recurrence/internal.scm
index 94c4cccf..9bf425ac 100644
--- a/module/vcomponent/recurrence/internal.scm
+++ b/module/vcomponent/recurrence/internal.scm
@@ -79,9 +79,18 @@
;; to prevent creation of invalid rules.
;; This was made apparent when wkst was (incorrectly) set to MO,
;; which later crashed generate-recurrence-set.
- (make-recur-rule% freq until count interval bysecond byminute byhour
- byday bymonthday byyearday byweekno bymonth bysetpos
- wkst))
+
+ ;; Allow `(cons #f day)' to be written as just `day'.
+ (let ((byday* (if byday
+ (map (lambda (day)
+ (if (number? day)
+ (cons #f day)
+ day))
+ byday)
+ #f)))
+ (make-recur-rule% freq until count interval bysecond byminute byhour
+ byday* bymonthday byyearday byweekno bymonth bysetpos
+ wkst)))
;; only print fields with actual values.
(set-record-type-printer!