repl-reader accepts optional "read" argument
[bpt/guile.git] / guile-readline / ice-9 / readline.scm
index 96af69e..4766e61 100644 (file)
@@ -1,6 +1,6 @@
 ;;;; readline.scm --- support functions for command-line editing
 ;;;;
-;;;;   Copyright (C) 1997, 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
+;;;;   Copyright (C) 1997, 1999, 2000, 2001, 2002, 2006, 2009 Free Software Foundation, Inc.
 ;;;; 
 ;;;; This program is free software; you can redistribute it and/or modify
 ;;;; it under the terms of the GNU General Public License as published by
 \f
 
 (define-module (ice-9 readline)
-  :use-module (ice-9 session)
-  :use-module (ice-9 regex)
-  :use-module (ice-9 buffered-input)
-  :no-backtrace
-  :export (filename-completion-function))
+  #:use-module (ice-9 session)
+  #:use-module (ice-9 regex)
+  #:use-module (ice-9 buffered-input)
+  #:no-backtrace
+  #:export (filename-completion-function
+           add-history
+           read-history
+           write-history
+           clear-history))
 
 \f
 
       (let ((repl-read-hook (lambda () (run-hook before-read-hook))))
        (set-current-input-port (readline-port))
        (set! repl-reader
-             (lambda (repl-prompt)
+             (lambda (repl-prompt . reader)
                (let ((outer-new-input-prompt new-input-prompt)
                      (outer-continuation-prompt continuation-prompt)
                      (outer-read-hook read-hook))
                        (set-buffered-input-continuation?! (readline-port) #f)
                        (set-readline-prompt! repl-prompt "... ")
                        (set-readline-read-hook! repl-read-hook))
-                     (lambda () ((or (fluid-ref current-reader) read)))
+                     (lambda () ((or (and (pair? reader) (car reader))
+                                      (fluid-ref current-reader)
+                                      read)))
                      (lambda ()
                        (set-readline-prompt! outer-new-input-prompt outer-continuation-prompt)
                        (set-readline-read-hook! outer-read-hook))))))