From ea2add1985cd517f10814e5324a96bc9482612bd Mon Sep 17 00:00:00 2001 From: Darcy Shen Date: Fri, 27 Sep 2024 21:53:44 +0800 Subject: [PATCH] [2_19] Re-impl save-object and load-object by string-load and string-save --- TeXmacs/progs/kernel/boot/abbrevs.scm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/TeXmacs/progs/kernel/boot/abbrevs.scm b/TeXmacs/progs/kernel/boot/abbrevs.scm index 0f42683ef4..119398dc58 100644 --- a/TeXmacs/progs/kernel/boot/abbrevs.scm +++ b/TeXmacs/progs/kernel/boot/abbrevs.scm @@ -70,12 +70,14 @@ (symbol->keyword (string->symbol (string-append "%" (number->string x))))) (define-public (save-object file value) - (call-with-output-file (url-materialize file "") (lambda (port) - (let-temporarily (((*s7* 'print-length) 9223372036854775807)) (write value port))))) + (string-save + (let-temporarily (((*s7* 'print-length) 9223372036854775807)) + (object->string value)) + file)) (define-public (load-object file) - (let ((r (call-with-input-file (url-materialize file "r") (lambda (port) (read port))))) - (if (eof-object? r) '() r))) + (with-input-from-string (string-load file) + (lambda () (read)))) (define-public (persistent-ref dir key) (and (persistent-has? dir key)