From 23bb093fadf597411f81303371ca9f1ef9f15619 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 4 May 2020 19:37:29 +0200 Subject: Replace direct output to current-error-port with warnings. --- module/entry-points/terminal.scm | 1 - module/output/ical.scm | 7 +++---- module/vcomponent/parse.scm | 3 +-- module/vcomponent/recurrence/generate.scm | 7 +++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/module/entry-points/terminal.scm b/module/entry-points/terminal.scm index a2c41f44..7f816e94 100644 --- a/module/entry-points/terminal.scm +++ b/module/entry-points/terminal.scm @@ -24,7 +24,6 @@ (let ((date (or (and=> (option-ref opts 'date #f) parse-freeform-date) (current-date)))) - ;; (format (current-error-port) "len(events) = ~a~%" (stream-length events)) (with-vulgar (lambda () (main-loop date)))) ) diff --git a/module/output/ical.scm b/module/output/ical.scm index 098d4e90..aa1d030b 100644 --- a/module/output/ical.scm +++ b/module/output/ical.scm @@ -67,10 +67,9 @@ (lambda (err caller fmt args call-args) (define fallback-string (with-output-to-string (lambda () (display value)))) - (format (current-error-port) - "WARNING: key = ~a, caller = ~s, call-args = ~s~%~k~%Falling back to ~s~%" - key caller call-args fmt args - fallback-string) + (warning "key = ~a, caller = ~s, call-args = ~s~%~k~%Falling back to ~s" + key caller call-args fmt args + fallback-string) fallback-string ))) diff --git a/module/vcomponent/parse.scm b/module/vcomponent/parse.scm index a3e88816..b5bb17e9 100644 --- a/module/vcomponent/parse.scm +++ b/module/vcomponent/parse.scm @@ -355,8 +355,7 @@ row ~a column ~a ctx = ~a ;; TODO Also make this grouping when reading in a whole ;; icalendar-file (one with multiple events) (case (length events) - [(0) (format (current-error-port) - "WARNING: No events in component~%~a~%" + [(0) (warning "No events in component~%~a" (attr item 'X-HNH-FILENAME))] [(1) (let ((child (car events))) diff --git a/module/vcomponent/recurrence/generate.scm b/module/vcomponent/recurrence/generate.scm index 1ff3cc49..70d21be1 100644 --- a/module/vcomponent/recurrence/generate.scm +++ b/module/vcomponent/recurrence/generate.scm @@ -7,6 +7,7 @@ #:use-module (ice-9 match) #:use-module (util) + #:use-module (util exceptions) #:use-module (vcomponent base) #:use-module (vcomponent recurrence internal) #:use-module (vcomponent recurrence parse) @@ -163,10 +164,8 @@ ;; just mention the current part. Handle this stream-null)))) (lambda (err . args) - (format (current-error-port) - "\x1b[0;31mError\x1b[m while parsing recurrence rule (ignoring and continuing)~%~a ~s~%~a~%~%" - err args - (attr event 'X-HNH-FILENAME)) + (warning "while parsing recurrence rule ~%~a ~s~%~a" + err args (attr event 'X-HNH-FILENAME)) (stream ; event ) ))) -- cgit v1.2.3