diff options
author | Andy Wingo <wingo@pobox.com> | 2010-11-18 14:32:53 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-11-18 14:32:53 +0100 |
commit | c372cd74fdc5de5b3ee3299b77a7881e271c649c (patch) | |
tree | 1892c7c079a02554be31ef10c5075f3a4026bbc0 /module/system/repl/command.scm | |
parent | 9b5fcde6f9488e9836b090f8da292bf3f2642ca6 (diff) | |
download | guile-c372cd74fdc5de5b3ee3299b77a7881e271c649c.tar.gz |
repl read/write using current ports, not captured ports
Fixes bug in repl meta-commands after activating readline, which changes
the current input port.
* module/system/repl/common.scm (<repl>): Remove inport and outport
fields.
(make-repl): Adapt.
(repl-read, repl-print): Just read and write to the current ports.
* module/system/repl/repl.scm (meta-reader): Meta-read from the current
input port.
* module/system/repl/command.scm (read-command, define-meta-command):
Read from the current input port.
Diffstat (limited to 'module/system/repl/command.scm')
-rw-r--r-- | module/system/repl/command.scm | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/module/system/repl/command.scm b/module/system/repl/command.scm index 4fc203806..94bb863bc 100644 --- a/module/system/repl/command.scm +++ b/module/system/repl/command.scm @@ -136,7 +136,7 @@ (define (read-command repl) (catch #t - (lambda () (read (repl-inport repl))) + (lambda () (read)) (lambda (key . args) (pmatch args ((,subr ,msg ,args . ,rest) @@ -148,11 +148,6 @@ (force-output) *unspecified*))) -(define read-line - (let ((orig-read-line read-line)) - (lambda (repl) - (orig-read-line (repl-inport repl))))) - (define (meta-command repl) (let ((command (read-command repl))) (cond @@ -183,19 +178,19 @@ (% (let* ((expression0 (catch #t (lambda () - (repl-reader "" - (lambda* (#:optional (port (repl-inport repl))) - ((language-reader (repl-language repl)) - port (current-module))))) + (repl-reader + "" + (lambda* (#:optional (port (current-input-port))) + ((language-reader (repl-language repl)) + port (current-module))))) (lambda (k . args) (handle-read-error 'expression0 k args)))) ...) (apply (lambda* datums - (with-output-to-port (repl-outport repl) - (lambda () b0 b1 ...))) + b0 b1 ...) (catch #t (lambda () - (let ((port (open-input-string (read-line repl)))) + (let ((port (open-input-string (read-line)))) (let lp ((out '())) (let ((x (read port))) (if (eof-object? x) |