aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@hornquist.se>2019-06-01 21:34:00 +0200
committerHugo Hörnquist <hugo@hornquist.se>2019-06-01 21:34:00 +0200
commit6c625adc220ccbdbb3462c3bef08c7f7176a010e (patch)
tree8fa19cd7326716a184c6c5d634ce7e4fb627a0b6
parentAdd stream-insert. (diff)
downloadcalp-6c625adc220ccbdbb3462c3bef08c7f7176a010e.tar.gz
calp-6c625adc220ccbdbb3462c3bef08c7f7176a010e.tar.xz
Work on cloning events through editor.
-rw-r--r--module/output/terminal.scm26
1 files changed, 26 insertions, 0 deletions
diff --git a/module/output/terminal.scm b/module/output/terminal.scm
index 87edc43b..bf0b25e5 100644
--- a/module/output/terminal.scm
+++ b/module/output/terminal.scm
@@ -23,6 +23,11 @@
#:export (terminal-main))
+
+(define (open-in-editor fname)
+ (system (string-append (getenv "EDITOR") " " fname)))
+
+
(define (box-top intersection line . lengths)
(reduce (lambda (str done) (string-append done (string intersection) str))
"" (map (cut make-string <> line) lengths)))
@@ -112,6 +117,27 @@
(mod! cur-event 1-)))
((#\p) (print-vcomponent (list-ref events cur-event)
(current-error-port)))
+ ((#\E) (serialize-vcomponent (list-ref events cur-event) (open-output-file "/tmp/event.ics")))
+ ((#\e)
+ (let ((fname (tmpnam)))
+ (with-output-to-file fname
+ (lambda () (serialize-vcomponent (list-ref events cur-event))))
+ (open-in-editor fname)
+ (with-input-from-file fname
+ (lambda ()
+ ;; TODO readinig back this partal vcomponent somehow fails.
+ ;; TODO Create a "display-in-parent" procedure, which takes a vcomponent
+ ;; and displays it within the context of it's parents, N steps up.
+ ;; This is different that display on parent since that would also
+ ;; display all our siblings, which is not always wanted.
+ (let ((ev ((@ (vcomponent primitive) %vcomponent-make) fname)))
+ (serialize-vcomponent ev (current-error-port))
+
+ (push-child! (parent (list-ref events cur-event)) ev)
+ (format (current-error-port) "Children: ~a~%start: ~a~%" (children ev)
+ (attr ev 'DTSTART))
+ (set! event-stream (stream-insert ev-time<? ev event-stream)))))))
+
((#\g) (set! cur-event 0))
((#\G) (set! cur-event (1- (length events)))))