From 9470b30951bc567fbe8d14fa0792bd01a86bfd64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Thu, 7 Sep 2023 15:34:28 +0200 Subject: Remove accidental extra 'vcomponent control' module. --- module/vcomponent/control.scm | 37 ------------------------------------- module/vcomponent/util/control.scm | 2 +- 2 files changed, 1 insertion(+), 38 deletions(-) delete mode 100644 module/vcomponent/control.scm (limited to 'module/vcomponent') diff --git a/module/vcomponent/control.scm b/module/vcomponent/control.scm deleted file mode 100644 index 19a6fa18..00000000 --- a/module/vcomponent/control.scm +++ /dev/null @@ -1,37 +0,0 @@ -(define-module (vcomponent util control) - :use-module (hnh util) - :use-module (vcomponent) - :export (with-replaced-properties)) - - -(eval-when (expand load) ; No idea why I must have load here. - (define href (make-procedure-with-setter hash-ref hash-set!)) - - (define (set-temp-values! table component kvs) - (for-each (lambda (kv) - (let ((key (car kv)) - (val (cadr kv))) - (when (prop component key) - (set! (href table key) (prop component key)) - (set! (prop component key) val)))) - kvs)) - - (define (restore-values! table component keys) - (for-each (lambda (key) - (and=> (href table key) - (lambda (val) - (set! (prop component key) val)))) - keys))) - -;; TODO what is this even used for? -(define-syntax with-replaced-properties - (syntax-rules () - [(G_ (component (key val) ...) - body ...) - - (let ((htable (make-hash-table 10))) - (dynamic-wind - (lambda () (set-temp-values! htable component (quote ((key val) ...)))) ; In guard - (lambda () body ...) - (lambda () (restore-values! htable component (quote (key ...))))))])) ; Out guard - diff --git a/module/vcomponent/util/control.scm b/module/vcomponent/util/control.scm index 0869543d..19a6fa18 100644 --- a/module/vcomponent/util/control.scm +++ b/module/vcomponent/util/control.scm @@ -26,7 +26,7 @@ ;; TODO what is this even used for? (define-syntax with-replaced-properties (syntax-rules () - [(_ (component (key val) ...) + [(G_ (component (key val) ...) body ...) (let ((htable (make-hash-table 10))) -- cgit v1.2.3 From 5d6dd99486979f5e1c95b6290a9dfaf71befcb14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 28 Mar 2022 13:44:39 +0200 Subject: Add comment about bad stream error. --- module/vcomponent/util/search.scm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'module/vcomponent') diff --git a/module/vcomponent/util/search.scm b/module/vcomponent/util/search.scm index e2057e9e..3c2d7663 100644 --- a/module/vcomponent/util/search.scm +++ b/module/vcomponent/util/search.scm @@ -175,6 +175,9 @@ (lambda (err proc fmt args data) ;; NOTE This is mostly a hack to see that we ;; actually check for the correct error. + ;; + ;; stream-ref quite unhelpfully throws this error as + ;; $3 = (wrong-type-arg stream-ref "beyond end of stream" () (#)) (unless (string=? fmt "beyond end of stream") (scm-error err proc fmt args data)) -- cgit v1.2.3 From c26324e29043423387c3041e86d8cbe5cd4102b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 21 Feb 2023 03:21:43 +0100 Subject: Change `kvlist->assq` and `group-by` to return pairs. Each value in the return of group-by must have exactly two values, so cons pairs (instead of lists) is much better. --- module/vcomponent/recurrence/display/en.scm | 4 ++-- module/vcomponent/recurrence/display/sv.scm | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'module/vcomponent') diff --git a/module/vcomponent/recurrence/display/en.scm b/module/vcomponent/recurrence/display/en.scm index c711a75c..18d11dba 100644 --- a/module/vcomponent/recurrence/display/en.scm +++ b/module/vcomponent/recurrence/display/en.scm @@ -26,13 +26,13 @@ (list "every " (add-enumeration-punctuation (map (lambda (d) (list (week-day-name (cdr d)))) - (cadr group) + (cdr group) )))] [else (list (number->string-ordinal (car group)) " " (add-enumeration-punctuation (map (lambda (d) (list (week-day-name (cdr d)) "en")) - (cadr group))))]) + (cdr group))))]) ) groups)))) diff --git a/module/vcomponent/recurrence/display/sv.scm b/module/vcomponent/recurrence/display/sv.scm index 2bd70657..ee8fc3fd 100644 --- a/module/vcomponent/recurrence/display/sv.scm +++ b/module/vcomponent/recurrence/display/sv.scm @@ -31,7 +31,7 @@ (list "varje " (add-enumeration-punctuation (map (lambda (d) (list (week-day-name (cdr d)))) - (cadr group) + (cdr group) )))] [else (list (number->string-ordinal @@ -40,7 +40,7 @@ " " (add-enumeration-punctuation (map (lambda (d) (list (week-day-name (cdr d)) "en")) - (cadr group))))]) + (cdr group))))]) ) groups)))) -- cgit v1.2.3 From cef4f5e55406246698c6cf8b3391c458e2b4668e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Tue, 21 Feb 2023 20:10:02 +0100 Subject: Allow shorter byday when constructing recurrence rules. --- module/vcomponent/recurrence/internal.scm | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'module/vcomponent') 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! -- cgit v1.2.3