some improvements to the repl in the module language when there is no module there

svn: r10261
This commit is contained in:
Robby Findler 2008-06-14 02:58:30 +00:00
parent 1d34ff568a
commit c4ac2429bb
2 changed files with 20 additions and 3 deletions

View File

@ -387,7 +387,6 @@ profile todo:
(write-special snp (current-error-port)))
(display msg (current-error-port))))])
(send error-text-style-delta set-delta-foreground (make-object color% 200 0 0))
(send-out " in:" void)
(let ([show-one
(λ (expr)
(display " " (current-error-port))
@ -400,8 +399,11 @@ profile todo:
[exprs (exn:fail:syntax-exprs exn)])
(cond
[(null? exprs) (void)]
[(null? (cdr exprs)) (show-one (car exprs))]
[(null? (cdr exprs))
(send-out " in:" void)
(show-one (car exprs))]
[else
(send-out " in:" void)
(for-each (λ (expr)
(display "\n " (current-error-port))
(show-one expr))

View File

@ -120,6 +120,21 @@
(string-constant module-language-one-line-summary))
(inherit get-reader)
(define/override (front-end/interaction port settings)
(if (null? (namespace-mapped-symbols))
(begin
(display
(string-append
"There are no bindings for use in the REPL.\n"
"Consider starting your program with:\n"
"\n"
" #lang scheme\n"
"\n"
"and clicking Run again.\n")
(current-error-port))
(λ x eof))
(super front-end/interaction port settings)))
(define/override (front-end/complete-program port settings)
(let* ([super-thunk (λ () ((get-reader) (object-name port) port))]
[path (get-filename port)]
@ -144,7 +159,7 @@
(let ([super-result (super-thunk)])
(if (eof-object? super-result)
(raise-syntax-error
'module-language
'Module\ language
"the definitions window must contain a module")
(let-values ([(name new-module)
(transform-module path super-result)])