From 9e37ecede37cbde048e28162cda5869077bebe11 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Wed, 29 May 2019 22:04:52 +0200 Subject: pict: Use pict->file for the record type printer. * pict.scm (): Implement the record type printer in terms of pict->file. --- pict.scm | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/pict.scm b/pict.scm index 58d3394..25cc21b 100644 --- a/pict.scm +++ b/pict.scm @@ -139,16 +139,11 @@ the file to determine the file name. Return the file name." ;; Hey, where are you going? You haven't seen the rest...! (set-record-type-printer! (lambda (record port) - (let* ((xml (with-output-to-string - (lambda _ (sxml->xml `(svg (@ (width ,(pict-width record)) - (height ,(pict-height record)) - (xmlns "http://www.w3.org/2000/svg")) - ,(pict-sxml record)))))) - (name (string-append "/tmp/geiser-" - (number->string (string-hash xml)) - ".svg"))) - (with-output-to-file name - (lambda _ (display xml))) + (let ((name (pict->file record + (lambda (xml) + (string-append "/tmp/geiser-" + (number->string (string-hash xml)) + ".svg"))))) (format port "#" name)))) -- cgit v1.2.3