aboutsummaryrefslogtreecommitdiff
path: root/code.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2019-03-08 14:49:57 +0100
committerHugo Hörnquist <hugo@lysator.liu.se>2019-03-08 14:49:57 +0100
commit58b2524b89d4db614aadbd8497b6e791e0d999cf (patch)
treeeba5a635e302b998751810920184fa4c72b25be7 /code.scm
parentFix error when looking at cloned events. (diff)
downloadcalp-58b2524b89d4db614aadbd8497b6e791e0d999cf.tar.gz
calp-58b2524b89d4db614aadbd8497b6e791e0d999cf.tar.xz
Move stuff between modules.
Diffstat (limited to 'code.scm')
-rw-r--r--code.scm49
1 files changed, 0 insertions, 49 deletions
diff --git a/code.scm b/code.scm
deleted file mode 100644
index af6c7b8c..00000000
--- a/code.scm
+++ /dev/null
@@ -1,49 +0,0 @@
-(define-module (code)
- #:export (extract sort* color-if
- STR-YELLOW STR-RESET
- print-vcomponent))
-
-(use-modules (srfi srfi-19)
- (srfi srfi-19 util)
- (srfi srfi-26)
- (vcalendar)
- (util))
-
-(define (extract field)
- (cut get-attr <> field))
-
-;;; 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"
- (sort items (lambda (a b)
- (comperator (get a)
- (get b)))))
-
-(define STR-YELLOW "\x1b[0;33m")
-(define STR-RESET "\x1b[m")
-
-
-(define-syntax-rule (color-if pred color body ...)
- (let ((pred-value pred))
- (format #f "~a~a~a"
- (if pred-value color "")
- (begin body ...)
- (if pred-value STR-RESET ""))))
-
-
-(define* (print-vcomponent comp #:optional (depth 0))
- (let ((kvs (map (lambda (key) (cons key (get-attr comp key)))
- (attributes comp))))
- (format #t "~a <~a> :: ~:a~%"
- (make-string depth #\:)
- (type comp) comp)
- (for-each-in kvs
- (lambda (kv)
- (let ((key (car kv))
- (value (cdr kv)))
- (format #t "~a ~20@a: ~a~%"
- (make-string depth #\:)
- key value))))
- (for-each-in (children comp)
- (cut print-vcomponent <> (1+ depth)))))
-