diff --git a/ice-9/boot-9.scm b/ice-9/boot-9.scm index fc2873f43..11668b05f 100644 --- a/ice-9/boot-9.scm +++ b/ice-9/boot-9.scm @@ -2438,18 +2438,11 @@ (define before-read-hook '()) (define after-read-hook '()) -;;; The default repl-reader function. We may override this if we've -;;; the readline library. -(define repl-reader - (lambda (prompt) - (display prompt) - (force-output) - (read (current-input-port)))) - (define (scm-style-repl) (letrec ( (start-gc-rt #f) (start-rt #f) + (repl-report-reset (lambda () #f)) (repl-report-start-timing (lambda () (set! start-gc-rt (gc-run-time)) (set! start-rt (get-internal-run-time)))) @@ -2475,19 +2468,17 @@ ((char=? ch #\newline) (read-char)))))) (-read (lambda () - ;; It would be nice if we could run this after the - ;; first prompt was printed, but with readline - ;; that's not possible, so we punt. + (if scm-repl-prompt + (begin + (display (cond ((string? scm-repl-prompt) + scm-repl-prompt) + ((thunk? scm-repl-prompt) + (scm-repl-prompt)) + (else "> "))) + (force-output) + (repl-report-reset))) (run-hooks before-read-hook) - (let ((val - (let ((prompt (cond ((string? scm-repl-prompt) - scm-repl-prompt) - ((thunk? scm-repl-prompt) - (scm-repl-prompt)) - (scm-repl-prompt "> ") - (else "")))) - (repl-reader prompt)))) - + (let ((val (read (current-input-port)))) ;; As described in R4RS, the READ procedure updates the ;; port to point to the first characetr past the end of ;; the external representation of the object. This @@ -2770,17 +2761,6 @@ ;; the protected thunk. (lambda () - - ;; If we've got readline, use it to prompt the user. This is a - ;; kludge, but we'll fix it soon. At least we only get - ;; readline involved when we're actually running the repl. - (if (memq 'readline *features*) - (begin - (set-current-input-port (readline-port)) - (set! repl-reader - (lambda (prompt) - (set-readline-prompt! prompt) - (read))))) (scm-style-repl)) ;; call at exit. @@ -2844,15 +2824,6 @@ (if (memq 'regex *features*) (define-module (guile) :use-module (ice-9 regex))) - -;;; Load readline code if rreadline primitives are available. -;;; -;;; Ideally, we wouldn't do this until we were sure we were actually -;;; going to enter the repl, but autoloading individual functions is -;;; clumsy at the moment. -(if (memq 'readline *features*) - (define-module (guile) :use-module (ice-9 readline))) - ;;; {Check that the interpreter and scheme code match up.}