From 0d249a996d2c969feef525933de925af88e6c249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Fri, 24 Jul 2020 17:24:01 +0200 Subject: Change internal fields to stat with a dash. --- module/output/common.scm | 2 +- module/output/ical.scm | 2 +- module/output/sxml-types.scm | 2 +- module/output/terminal.scm | 4 ++-- module/output/types.scm | 2 +- module/output/vdir.scm | 4 ++-- module/vcomponent/parse.scm | 16 ++++++++-------- module/vcomponent/parse/types.scm | 2 +- module/vcomponent/recurrence/generate.scm | 2 +- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/module/output/common.scm b/module/output/common.scm index f572a282..155b88a8 100644 --- a/module/output/common.scm +++ b/module/output/common.scm @@ -10,7 +10,7 @@ ) -(define*-public (internal-field? symbol optional: (prefix "X-HNH-")) +(define*-public (internal-field? symbol optional: (prefix "-")) (string=? prefix (string-take-to (symbol->string symbol) (string-length prefix)))) diff --git a/module/output/ical.scm b/module/output/ical.scm index 6b8728a6..e9636fdc 100644 --- a/module/output/ical.scm +++ b/module/output/ical.scm @@ -153,7 +153,7 @@ (format #t "END:~a\r\n" (type component)) ;; If we have alternatives, splice them in here. - (cond [(prop component 'X-HNH-ALTERNATIVES) + (cond [(prop component '-X-HNH-ALTERNATIVES) => (lambda (alts) (hash-map->list (lambda (_ comp) (component->ical-string comp)) alts))])) diff --git a/module/output/sxml-types.scm b/module/output/sxml-types.scm index bbd70fe8..2d5b3742 100644 --- a/module/output/sxml-types.scm +++ b/module/output/sxml-types.scm @@ -14,7 +14,7 @@ (define (write-datetime p v) `(date-time ,(datetime->string - (hashq-ref p 'X-HNH-ORIGINAL v) + (hashq-ref p '-X-HNH-ORIGINAL v) ;; 'Z' should be included for UTC, ;; other timezones MUST be specified ;; in the TZID parameter. diff --git a/module/output/terminal.scm b/module/output/terminal.scm index c5c1323d..9092d01b 100644 --- a/module/output/terminal.scm +++ b/module/output/terminal.scm @@ -49,7 +49,7 @@ (if (= i cur-event) "\x1b[7m" "") (color-escape (prop (parent ev) 'COLOR)) ;; Summary filter is a hook for the user - (let ((dirty (prop ev 'X-HNH-DIRTY))) + (let ((dirty (prop ev '-X-HNH-DIRTY))) (string-append (if dirty "* " "") ;; TODO reintroduce summary-filter @@ -107,7 +107,7 @@ (unless (null? events) (let ((ev (list-ref events cur-event))) (format #t "~a~%~% ~a~%~%~a\x1b[1mStart:\x1b[m ~a \x1b[1mSlut:\x1b[m ~a~%~%~a~%" - (prop ev 'X-HNH-FILENAME) + (prop ev '-X-HNH-FILENAME) (prop ev 'SUMMARY) (or (and=> (prop ev 'LOCATION) (cut string-append "\x1b[1mPlats:\x1b[m " <> "\n")) "") diff --git a/module/output/types.scm b/module/output/types.scm index 3627a8b9..d4305b7a 100644 --- a/module/output/types.scm +++ b/module/output/types.scm @@ -19,7 +19,7 @@ ;; NOTE We really should output TZID from param here, but ;; we first need to change so these writers can output ;; parameters. - (datetime->string (hashq-ref param 'X-HNH-ORIGINAL value) + (datetime->string (hashq-ref param '-X-HNH-ORIGINAL value) "~Y~m~dT~H~M~S~Z")) (define (write-duration _ value) diff --git a/module/output/vdir.scm b/module/output/vdir.scm index 5e319248..cf4f6c8d 100644 --- a/module/output/vdir.scm +++ b/module/output/vdir.scm @@ -16,7 +16,7 @@ (define-public (save-event event) (define calendar (parent event)) - (case (prop calendar 'X-HNH-SOURCETYPE) + (case (prop calendar '-X-HNH-SOURCETYPE) [(file) (error "Importing into direct calendar files not supported")] @@ -24,7 +24,7 @@ (let* ((uid (or (prop event 'UID) (uuidgen)))) (set! (prop event 'UID) uid) (with-atomic-output-to-file - (string-append (prop calendar 'X-HNH-DIRECTORY) / uid ".ics") + (string-append (prop calendar '-X-HNH-DIRECTORY) / uid ".ics") (lambda () (print-components-with-fake-parent (list event)))) uid)] diff --git a/module/vcomponent/parse.scm b/module/vcomponent/parse.scm index 0caa65e7..56e62dad 100644 --- a/module/vcomponent/parse.scm +++ b/module/vcomponent/parse.scm @@ -47,8 +47,8 @@ (assert (eq? 'VCALENDAR (type item))) (for child in (children item) - (set! (prop child 'X-HNH-FILENAME) - (prop (parent child) 'X-HNH-FILENAME))) + (set! (prop child '-X-HNH-FILENAME) + (prop (parent child) '-X-HNH-FILENAME))) ;; NOTE The vdir standard says that each file should contain ;; EXACTLY one event. It can however contain multiple VEVENT @@ -60,7 +60,7 @@ ;; the standard. Section 3.8.4.4. (case (length events) [(0) (warning "No events in component~%~a" - (prop item 'X-HNH-FILENAME))] + (prop item '-X-HNH-FILENAME))] [(1) (let ((child (car events))) (assert (memv (type child) '(VTIMEZONE VEVENT))) @@ -77,7 +77,7 @@ events)) (rest (delete head events eq?))) - (set! (prop head 'X-HNH-ALTERNATIVES) + (set! (prop head '-X-HNH-ALTERNATIVES) (alist->hash-table (map cons (map (extract 'RECURRENCE-ID) rest) @@ -97,7 +97,7 @@ parse-calendar))) (set! (prop cal 'COLOR) color (prop cal 'NAME) name - (prop cal 'X-HNH-FILENAME) fullname) + (prop cal '-X-HNH-FILENAME) fullname) cal))) (scandir path (lambda (s) (and (not (string= "." (string-take s 1))) (string= "ics" (string-take-right s 3)))))))))) @@ -110,13 +110,13 @@ (case (stat:type st) [(regular) (let ((comp (call-with-input-file path parse-calendar))) - (set! (prop comp 'X-HNH-SOURCETYPE) 'file) + (set! (prop comp '-X-HNH-SOURCETYPE) 'file) comp) ] [(directory) (report-time! "Parsing ~a" path) (let ((comp (parse-vdir path))) - (set! (prop comp 'X-HNH-SOURCETYPE) 'vdir - (prop comp 'X-HNH-DIRECTORY) path) + (set! (prop comp '-X-HNH-SOURCETYPE) 'vdir + (prop comp '-X-HNH-DIRECTORY) path) comp)] [(block-special char-special fifo socket unknown symlink) => (lambda (t) (error "Can't parse file of type " t))])) diff --git a/module/vcomponent/parse/types.scm b/module/vcomponent/parse/types.scm index 2ba9a553..3ae3a74a 100644 --- a/module/vcomponent/parse/types.scm +++ b/module/vcomponent/parse/types.scm @@ -35,7 +35,7 @@ (define parsed (parse-ics-datetime value (hashq-ref props 'TZID #f))) - (hashq-set! props 'X-HNH-ORIGINAL parsed) + (hashq-set! props '-X-HNH-ORIGINAL parsed) (get-datetime parsed)) ;; DURATION diff --git a/module/vcomponent/recurrence/generate.scm b/module/vcomponent/recurrence/generate.scm index 711f51ec..2d9d3960 100644 --- a/module/vcomponent/recurrence/generate.scm +++ b/module/vcomponent/recurrence/generate.scm @@ -369,7 +369,7 @@ (define rrule-stream (rrule-instances base-event)) (stream-map - (aif (prop base-event 'X-HNH-ALTERNATIVES) + (aif (prop base-event '-X-HNH-ALTERNATIVES) (lambda (dt) (aif (hash-ref it dt) it ; RECURRENCE-ID objects come with their own DTEND -- cgit v1.2.3