From 82968362ead0ed59c64ee8a21fec346c9265a149 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 1 Sep 2022 22:08:12 +0200 Subject: read-print: Define forms for which \n, \t, etc. are not escaped. Previously, the pretty-printer would unconditionally leave everything but double-quotes and backslashes unescaped when rendering a string. With this change, the previous behavior only applies to forms listed in %NATURAL-WHITESPACE-STRING-FORMS. * guix/read-print.scm (%natural-whitespace-string-forms): New variable. (printed-string): New procedure. (pretty-print-with-comments): Use it instead of 'escaped-string'. * tests/read-print.scm: Add test. --- tests/read-print.scm | 3 +++ 1 file changed, 3 insertions(+) (limited to 'tests/read-print.scm') diff --git a/tests/read-print.scm b/tests/read-print.scm index 1b0d865972..ca3f3193f7 100644 --- a/tests/read-print.scm +++ b/tests/read-print.scm @@ -186,6 +186,9 @@ (define-syntax-rule (test-pretty-print/sequence str args ...) (lambda _ xyz))))") +(test-pretty-print "\ +(string-append \"a\\tb\" \"\\n\")") + (test-pretty-print "\ (description \"abcdefghijkl mnopqrstuvwxyz.\")" -- cgit v1.2.3