aboutsummaryrefslogtreecommitdiff
path: root/module/output/terminal.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-04-01 21:01:17 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-04-01 21:01:17 +0200
commit6c37a4c00cd420e50d0cd2ad088268bcbb3d9155 (patch)
treef5c0052c1cfa1c2a9019f83f7d93d04418379d7a /module/output/terminal.scm
parentAdd set-config! and get-config, along with print for debug. (diff)
downloadcalp-6c37a4c00cd420e50d0cd2ad088268bcbb3d9155.tar.gz
calp-6c37a4c00cd420e50d0cd2ad088268bcbb3d9155.tar.xz
Update remaining code to use new config scheme.
Diffstat (limited to 'module/output/terminal.scm')
-rw-r--r--module/output/terminal.scm57
1 files changed, 29 insertions, 28 deletions
diff --git a/module/output/terminal.scm b/module/output/terminal.scm
index c344776f..e94d971d 100644
--- a/module/output/terminal.scm
+++ b/module/output/terminal.scm
@@ -36,34 +36,35 @@
(cur-event -1)
(summary-width 30)
(location-width 20))
- (for-each
- (lambda (ev i)
- (display
- (string-append
- (if (datetime? (attr ev 'DTSTART))
- (datetime->string (attr ev 'DTSTART) "~Y-~m-~d ~H:~M:~S")
- ((@ (texinfo string-utils) center-string)
- (date->string (attr ev 'DTSTART))
- 19))
- ; TODO show truncated string
- " │ "
- (if (= i cur-event) "\x1b[7m" "")
- (color-escape (attr (parent ev) 'COLOR))
- ;; Summary filter is a hook for the user
- (let ((dirty (attr ev 'X-HNH-DIRTY)))
- (string-append
- (if dirty "* " "")
- (trim-to-width ((summary-filter) ev (attr ev 'SUMMARY)) (- summary-width
- (if dirty 2 0)))))
- STR-RESET
- " │ "
- (if (attr ev 'LOCATION) "" "\x1b[1;30m")
- (trim-to-width
- (or (attr ev 'LOCATION) "INGEN LOKAL") location-width)
- STR-RESET
- "\n")))
- events
- (iota (length events))))
+ (for-each
+ (lambda (ev i)
+ (display
+ (string-append
+ (if (datetime? (attr ev 'DTSTART))
+ (datetime->string (attr ev 'DTSTART) "~Y-~m-~d ~H:~M:~S")
+ ((@ (texinfo string-utils) center-string)
+ (date->string (attr ev 'DTSTART))
+ 19))
+ ; TODO show truncated string
+ " │ "
+ (if (= i cur-event) "\x1b[7m" "")
+ (color-escape (attr (parent ev) 'COLOR))
+ ;; Summary filter is a hook for the user
+ (let ((dirty (attr ev 'X-HNH-DIRTY)))
+ (string-append
+ (if dirty "* " "")
+ ;; TODO reintroduce summary-filter
+ (trim-to-width (attr ev 'SUMMARY) (- summary-width
+ (if dirty 2 0)))))
+ STR-RESET
+ " │ "
+ (if (attr ev 'LOCATION) "" "\x1b[1;30m")
+ (trim-to-width
+ (or (attr ev 'LOCATION) "INGEN LOKAL") location-width)
+ STR-RESET
+ "\n")))
+ events
+ (iota (length events))))
(define (displayln a)
(display a) (newline))