From 7a698da0d04d75f1c49f9ae9f358070acab0f781 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 17 Sep 2022 16:15:17 +0200 Subject: read-print: Correctly support multiple same-named newline forms. Previously (home-environment (services ...)) would not be considered a "newline form". This fixes it. * guix/read-print.scm (newline-form?): Use 'vhash-foldq*' instead of 'vhash-assq' and iterate over candidates. * tests/read-print.scm: Add test. --- guix/read-print.scm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'guix/read-print.scm') diff --git a/guix/read-print.scm b/guix/read-print.scm index a5a1b708bf..c8849e767b 100644 --- a/guix/read-print.scm +++ b/guix/read-print.scm @@ -367,10 +367,9 @@ surrounding SYMBOL." (define (newline-form? symbol context) "Return true if parenthesized expressions starting with SYMBOL must be followed by a newline." - (match (vhash-assq symbol %newline-forms) - (#f #f) - ((_ . prefix) - (prefix? prefix context)))) + (let ((matches (vhash-foldq* cons '() symbol %newline-forms))) + (find (cut prefix? <> context) + matches))) (define (escaped-string str) "Return STR with backslashes and double quotes escaped. Everything else, in -- cgit v1.2.3