Index: parley.scm =================================================================== --- parley.scm (revision 26523) +++ parley.scm (working copy) @@ -157,11 +157,12 @@ identity) (else (error "Unknown ESC sequence " name)))) -(define (history-init!) - (when (not history) (set! history (make-history-cursor '())))) +(define (history-init! #!optional (items '())) + (when (not history) (set! history (make-history-cursor items)))) (define (history-add! line) - (unless (equal? line "") (history 'add line)) + (unless (or (equal? line "") (eof-object? line)) + (history 'add line)) line) (define (history-to-file filename) @@ -170,8 +171,7 @@ (for-each print (history '->list))))) (define (history-from-file filename) - (for-each history-add! - (with-input-from-file filename read-lines))) + (history-init! (with-input-from-file filename read-lines))) (define (make-history-cursor h) (let ((h h)