diff options
author | Ludovic Courtès <ludo@gnu.org> | 2022-11-19 17:23:04 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2022-12-02 00:02:12 +0100 |
commit | 7c1161dba4c8930d3a500a72ccaaaf50df73f466 (patch) | |
tree | c524b49ebde713b660443cf588a0858a9c58e166 /gnu/services/getmail.scm | |
parent | 594f5ef35107d5641c44dac5cd7e9fb3737b674b (diff) | |
download | guix-7c1161dba4c8930d3a500a72ccaaaf50df73f466.tar.gz |
records: 'match-record' checks fields at macro-expansion time.
This allows 'match-record' to be more efficient (field offsets are computed at compilation time) and to report unknown fields at macro-expansion time. * guix/records.scm (map-fields): New macro. (define-record-type*)[rtd-identifier]: New procedure. Define TYPE as a macro and use a separate identifier for the RTD. (lookup-field, match-record-inner): New macros. (match-record): Rewrite in terms of 'match-error-inner'. * tests/records.scm ("match-record, simple") ("match-record, unknown field"): New tests. * gnu/services/cuirass.scm (cuirass-shepherd-service): Rename 'log-file' local variable to 'main-log-file'. * gnu/services/getmail.scm (serialize-getmail-configuration-file): Move after <getmail-configuration-file> definition.
Diffstat (limited to 'gnu/services/getmail.scm')
-rw-r--r-- | gnu/services/getmail.scm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/gnu/services/getmail.scm b/gnu/services/getmail.scm index fb82d054ca..19faea782f 100644 --- a/gnu/services/getmail.scm +++ b/gnu/services/getmail.scm @@ -215,17 +215,6 @@ lines.") (parameter-alist '()) "Extra options to include.")) -(define (serialize-getmail-configuration-file field-name val) - (match-record val <getmail-configuration-file> - (retriever destination options) - #~(string-append - "[retriever]\n" - #$(serialize-getmail-retriever-configuration #f retriever) - "\n[destination]\n" - #$(serialize-getmail-destination-configuration #f destination) - "\n[options]\n" - #$(serialize-getmail-options-configuration #f options)))) - (define-configuration getmail-configuration-file (retriever (getmail-retriever-configuration (getmail-retriever-configuration)) @@ -237,6 +226,17 @@ lines.") (getmail-options-configuration (getmail-options-configuration)) "Configure getmail.")) +(define (serialize-getmail-configuration-file field-name val) + (match-record val <getmail-configuration-file> + (retriever destination options) + #~(string-append + "[retriever]\n" + #$(serialize-getmail-retriever-configuration #f retriever) + "\n[destination]\n" + #$(serialize-getmail-destination-configuration #f destination) + "\n[options]\n" + #$(serialize-getmail-options-configuration #f options)))) + (define (serialize-symbol field-name val) "") (define (serialize-getmail-configuration field-name val) "") |