read-print: Define forms for which \n, \t, etc. are not escaped.
authorLudovic Courtès <ludo@gnu.org>
Thu, 1 Sep 2022 20:08:12 +0000 (22:08 +0200)
committerLudovic Courtès <ludo@gnu.org>
Fri, 2 Sep 2022 08:49:35 +0000 (10:49 +0200)
commit82968362ead0ed59c64ee8a21fec346c9265a149
treece9143abf4469b619b37b36792faa7b3820ef4c8
parentac9a7f6be9c2e0f2ab218f7a423527490bb6aa9c
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.
guix/read-print.scm
tests/read-print.scm