Welcome to the CHICKEN Scheme pasting service

parley history fixes added by DerGuteMoritz on Wed Apr 18 10:29:29 2012

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)

Your annotation:

Enter a new annotation:

Your nick:
The title of your paste:
Your paste (mandatory) :
What's the equality predicate for strings in R5RS?
Visually impaired? Let me spell it for you (wav file) download WAV