racket/gui: adapt text-editor-load-handler
to missing-module exception
Raise `exn:fail:{filesystem,syntax}:missing-module` instead of `exn:fail:filesystem` when a module file does not exist. original commit: b420967b02f767c50bbae688cad67f2f9cca91e4
This commit is contained in:
parent
e1aed6f3ea
commit
50b592404a
|
@ -263,7 +263,7 @@
|
||||||
(raise-argument-error 'text-editor-load-handler
|
(raise-argument-error 'text-editor-load-handler
|
||||||
"(or/c #f symbol? (cons/c (or/c #f symbol?) (non-empty-listof symbol?)))"
|
"(or/c #f symbol? (cons/c (or/c #f symbol?) (non-empty-listof symbol?)))"
|
||||||
expected-module))
|
expected-module))
|
||||||
(let-values ([(in-port src wxme?) (build-input-port filename)])
|
(let-values ([(in-port src wxme?) (build-input-port filename expected-module)])
|
||||||
(if wxme?
|
(if wxme?
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
(lambda () (void))
|
(lambda () (void))
|
||||||
|
@ -321,8 +321,8 @@
|
||||||
;; build-input-port : string -> (values input any)
|
;; build-input-port : string -> (values input any)
|
||||||
;; constructs an input port for the load handler. Also
|
;; constructs an input port for the load handler. Also
|
||||||
;; returns a value representing the source of code read from the file.
|
;; returns a value representing the source of code read from the file.
|
||||||
(define (build-input-port filename)
|
(define (build-input-port filename expected-module)
|
||||||
(let ([p (open-input-file filename)])
|
(let ([p (open-input-file filename #:for-module? expected-module)])
|
||||||
(port-count-lines! p)
|
(port-count-lines! p)
|
||||||
(define-values (new-p changed?)
|
(define-values (new-p changed?)
|
||||||
(cond
|
(cond
|
||||||
|
@ -337,7 +337,7 @@
|
||||||
(values new-p filename changed?)))
|
(values new-p filename changed?)))
|
||||||
|
|
||||||
(define (open-input-graphical-file filename)
|
(define (open-input-graphical-file filename)
|
||||||
(let-values ([(p name wxme?) (build-input-port filename)])
|
(let-values ([(p name wxme?) (build-input-port filename #f)])
|
||||||
p))
|
p))
|
||||||
|
|
||||||
(define open-output-text-editor
|
(define open-output-text-editor
|
||||||
|
|
Loading…
Reference in New Issue
Block a user