diff --git a/collects/drscheme/private/module-language.ss b/collects/drscheme/private/module-language.ss index 05ca935e4e..8d426b9a68 100644 --- a/collects/drscheme/private/module-language.ss +++ b/collects/drscheme/private/module-language.ss @@ -161,8 +161,16 @@ (let ([expr ;; just reading the definitions might be a syntax error, ;; possibly due to bad language (eg, no foo/lang/reader) - (with-handlers ([exn? (λ (e) (raise-hopeless-exception - e "invalid module text"))]) + (with-handlers ([exn? (λ (e) + ;; [Eli] FIXME: use `read-language' on `port' after calling + ;; `file-position' to reset it to the beginning (need to + ;; make sure that it's always a seekable port), then see + ;; the position that we're left at, re-read that part of + ;; the port (a second reset), construct a string holding + ;; the #lang, and read from it an empty module, and extract + ;; the base module from it (ask Matthew about this). + (raise-hopeless-exception + e "invalid module text"))]) (super-thunk))]) (when (eof-object? expr) (raise-hopeless-syntax-error)) (let ([more (super-thunk)])