diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-25 13:56:15 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2019-03-25 13:56:15 +0100 |
commit | 7c2adefaee82dbf2843dc6bf5364c4b664b4b366 (patch) | |
tree | e831c289deafdd41758a51dc9092c2e3fb5d1f86 /module | |
parent | Fix events being dropped by sorting them. (diff) | |
download | calp-7c2adefaee82dbf2843dc6bf5364c4b664b4b366.tar.gz calp-7c2adefaee82dbf2843dc6bf5364c4b664b4b366.tar.xz |
Minor cleanups.
Diffstat (limited to '')
-rwxr-xr-x | module/main.scm | 9 | ||||
-rw-r--r-- | module/srfi/srfi-19/util.scm | 3 | ||||
-rw-r--r-- | module/vcalendar/datetime.scm | 3 | ||||
-rw-r--r-- | module/vcalendar/output.scm | 15 |
4 files changed, 19 insertions, 11 deletions
diff --git a/module/main.scm b/module/main.scm index e29ae2c0..e97b5f12 100755 --- a/module/main.scm +++ b/module/main.scm @@ -24,7 +24,7 @@ (time<? (attr a 'DTSTART) (attr b 'DTSTART))) -;;; ------------------------------------------------------------ + #; (define pizza-event (search cal "pizza")) @@ -94,7 +94,8 @@ (unless (null? events) (let ((ev (list-ref events cur-event))) - (format #t "~a~%~aStart: ~a Slut: ~a~%~%~a~%" + (format #t "~a~%~a~%~aStart: ~a Slut: ~a~%~%~a~%" + (attr ev 'X-HNH-FILENAME) (attr ev 'SUMMARY) (or (and=> (attr ev 'LOCATION) (cut string-append "Plats: " <> "\n")) "") (time->string (attr ev 'DTSTART) "~1 ~3") @@ -119,8 +120,10 @@ (memv char (list #\q (ctrl #\C)))) (loop (read-char (current-input-port))))))) -(load "config.scm") + + +(load "config.scm") (define (main args) diff --git a/module/srfi/srfi-19/util.scm b/module/srfi/srfi-19/util.scm index a4b704b0..f589b988 100644 --- a/module/srfi/srfi-19/util.scm +++ b/module/srfi/srfi-19/util.scm @@ -35,6 +35,9 @@ attribute set to 0. Can also be seen as \"Start of day\"" ((date-second) 0) ((date-nanosecond) 0))) +(define-public (start-of-day* time) + (date->time-utc (drop-time (time-utc->date time)))) + (define (make-duration s) (make-time time-duration 0 s)) diff --git a/module/vcalendar/datetime.scm b/module/vcalendar/datetime.scm index 360b8348..d28096c6 100644 --- a/module/vcalendar/datetime.scm +++ b/module/vcalendar/datetime.scm @@ -30,5 +30,6 @@ Event must have the DTSTART and DTEND attribute set." "Does event overlap the date that contains time." (let* ((date (time-utc->date time)) (start (date->time-utc (drop-time date))) - (end (add-duration start (make-duration (* 60 60 24))))) + (end (add-day start))) (event-overlaps? ev start end))) + diff --git a/module/vcalendar/output.scm b/module/vcalendar/output.scm index 5baa293a..48197cb4 100644 --- a/module/vcalendar/output.scm +++ b/module/vcalendar/output.scm @@ -74,15 +74,16 @@ Removes the X-HNH-FILENAME attribute, and sets PRODID to (lambda () (format port "~a:~a~%" key (string->ics-safe-string - (case key - ((DTSTART DTEND) - (if (string? value) - value - (time->string value "~Y~m~dT~H~M~S"))) + (or (case key + ((DTSTART DTEND) + (if (string? value) + value + (time->string value "~Y~m~dT~H~M~S"))) - ((RRULE DURATION) "Just forget it") + ((DURATION) "Just forget it") - (else value))))) + (else value)) + "")))) ;; Catch (lambda (type proc fmt . args) |