diff options
author | Andreas Enge <andreas@enge.fr> | 2023-04-24 20:43:01 +0200 |
---|---|---|
committer | Andreas Enge <andreas@enge.fr> | 2023-04-24 20:43:01 +0200 |
commit | 92dd588b81e2b07eff8a083e998224963cfe2959 (patch) | |
tree | 1e437c7e0cbde691defe81c465ddf7d23d3313a1 /guix | |
parent | 09d2976c86f2cb1841ebe0685164912bfedfeeb5 (diff) | |
parent | c7cdd4a6c7e795575c1baf6a655cb317f56fcf81 (diff) | |
download | guix-patches-92dd588b81e2b07eff8a083e998224963cfe2959.tar guix-patches-92dd588b81e2b07eff8a083e998224963cfe2959.tar.gz |
Merge remote-tracking branch 'origin/master' into core-updates
Diffstat (limited to 'guix')
-rw-r--r-- | guix/read-print.scm | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/guix/read-print.scm b/guix/read-print.scm index 515eb7669c..d834105dce 100644 --- a/guix/read-print.scm +++ b/guix/read-print.scm @@ -420,11 +420,18 @@ particular newlines, is left as is." (define (printed-string str context) "Return the read syntax for STR depending on CONTEXT." + (define (preserve-newlines? str) + (and (> (string-length str) 40) + (string-index str #\newline))) + (match context (() - (object->string str)) + (if (preserve-newlines? str) + (escaped-string str) + (object->string str))) ((head . _) - (if (memq head %natural-whitespace-string-forms) + (if (or (memq head %natural-whitespace-string-forms) + (preserve-newlines? str)) (escaped-string str) (object->string str))))) |