diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2019-05-29 22:04:52 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2019-05-29 22:04:52 +0200 |
commit | 9e37ecede37cbde048e28162cda5869077bebe11 (patch) | |
tree | cab06bd2b0ff433a8eda2ad6e410765e5b9f5726 | |
parent | 05eecd83a8dd0764ede93b2e500ccf2714ed6d8f (diff) |
pict: Use pict->file for the record type printer.
* pict.scm (<pict>): Implement the record type printer in terms of
pict->file.
-rw-r--r-- | pict.scm | 15 |
1 files changed, 5 insertions, 10 deletions
@@ -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! <pict> (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 "#<Image: ~a>" name)))) |