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.
This commit is contained in:
parent
818220f1cc
commit
7a698da0d0
@ -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
|
||||
|
@ -294,6 +294,11 @@ mnopqrstuvwxyz.\")"
|
||||
;; page break above
|
||||
end)")
|
||||
|
||||
(test-pretty-print "\
|
||||
(home-environment
|
||||
(services
|
||||
(list (service-type home-bash-service-type))))")
|
||||
|
||||
(test-pretty-print/sequence "\
|
||||
;;; This is a top-level comment.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user