aboutsummaryrefslogtreecommitdiff
path: root/code.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-02-26 21:19:59 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-02-26 21:19:59 +0100
commit8628e2bf59aa1eb0f27c04bdeaeae7adf84250cb (patch)
treecbdd20b1ac5e107f0c87f56571f11095ced0c8af /code.scm
parentMade filename attribute of all objects. (diff)
downloadcalp-8628e2bf59aa1eb0f27c04bdeaeae7adf84250cb.tar.gz
calp-8628e2bf59aa1eb0f27c04bdeaeae7adf84250cb.tar.xz
Move stuff between code.scm and main.scm.
Diffstat (limited to 'code.scm')
-rwxr-xr-xcode.scm28
1 files changed, 0 insertions, 28 deletions
diff --git a/code.scm b/code.scm
index d6752f1f..6586a9af 100755
--- a/code.scm
+++ b/code.scm
@@ -1,20 +1,9 @@
-#!/usr/bin/guile \
--s
-!#
-
(add-to-load-path (dirname (current-filename)))
(use-modules (srfi srfi-19)
(srfi srfi-26)
(vcalendar))
-(define path
- (if (null? (cdr (command-line)))
- "testcal/d1-b.ics"
- (cadr (command-line))))
-
-(define cal (make-vcomponent path))
-
(define (extract field)
(cut get-attr <> field))
@@ -22,12 +11,6 @@
(time-utc->date (date->time-utc date)
(date-zone-offset (current-date))))
-;;; Parse all start times into scheme date objects.
-(for-each (cut transform-attr! <> "DTSTART"
- (lambda (start)
- (localize-date (string->date start "~Y~m~dT~H~M~S~z"))))
- (children cal 'VEVENT))
-
;;; This function borrowed from web-ics (calendar util)
(define* (sort* items comperator #:optional (get identity))
"A sort function more in line with how python's sorted works"
@@ -55,14 +38,3 @@
(time<=? (date->time-utc input-date)
(date->time-utc then)))))
-;;; Sort the events, and print a simple agenda.
-(let ((sorted-events
- (sort* (children cal 'VEVENT)
- time<? (compose date->time-utc (extract "DTSTART")))))
- (for-each (lambda (ev) (format #t "~a~a~a | ~a~%"
- (if (date-today? (get-attr ev "DTSTART")) STR-YELLOW "")
- (date->string (get-attr ev "DTSTART") "~1 ~H:~M")
- STR-RESET
- (get-attr ev "SUMMARY")))
- sorted-events))
-