diff --git a/collects/drscheme/private/language.ss b/collects/drscheme/private/language.ss index 9e5228a149..47cdae2694 100644 --- a/collects/drscheme/private/language.ss +++ b/collects/drscheme/private/language.ss @@ -1086,12 +1086,31 @@ (λ () (with-handlers ([(λ (x) #t) (λ (x) - (display (exn-message x)) - (newline))]) + (parameterize ([current-error-port original-output-port]) + ((error-display-handler) + (if (exn? x) + (exn-message x) + (format "~s" x)) + x)) + (printf "~a\n" (if (exn? x) + (exn-message x) + (format "~s" x))))]) (when module-spec (if use-copy? (namespace-require/copy module-spec) - (namespace-require/constant module-spec))) + (let ([t (current-thread)]) + (thread + (λ () + (let loop ([i 5]) + (unless (zero? i) + (printf "sleeping ... ~a\n" i) + (sleep 1) + (loop (- i 1)))) + (printf "breaking...\n") + (break-thread t) + (printf "broke\n"))) + (break-enabled #t) + (namespace-require/constant module-spec)))) (when transformer-module-spec (namespace-require `(for-syntax ,transformer-module-spec))))))) diff --git a/collects/drscheme/private/rep.ss b/collects/drscheme/private/rep.ss index cabd4c33a1..c49bb2fda4 100644 --- a/collects/drscheme/private/rep.ss +++ b/collects/drscheme/private/rep.ss @@ -323,6 +323,26 @@ TODO (define setup-scheme-interaction-mode-keymap (λ (keymap) + (define (beginning-of-line text select?) + (let* ([para (send text position-line (send text get-start-position))] + [para-start (send text line-start-position para)] + [prompt (send text get-prompt)] + [para-start-text (send text get-text para-start (+ para-start (string-length prompt)))] + [new-start + (cond + [(equal? prompt para-start-text) + (+ para-start (string-length prompt))] + [else + para-start])]) + (if select? + (send text set-position new-start (send text get-end-position)) + (send text set-position new-start new-start)))) + + (send keymap add-function "beginning-of-line/prompt" + (λ (text event) (beginning-of-line text #f))) + (send keymap add-function "select-to-beginning-of-line/prompt" + (λ (text event) (beginning-of-line text #t))) + (send keymap add-function "put-previous-sexp" (λ (text event) (send text copy-prev-previous-expr))) @@ -330,6 +350,11 @@ TODO (λ (text event) (send text copy-next-previous-expr))) + (send keymap map-function "c:a" "beginning-of-line/prompt") + (send keymap map-function "s:c:a" "select-to-beginning-of-line/prompt") + (send keymap map-function "home" "beginning-of-line/prompt") + (send keymap map-function "s:home" "select-to-beginning-of-line/prompt") + (keymap:send-map-function-meta keymap "p" "put-previous-sexp") (keymap:send-map-function-meta keymap "n" "put-next-sexp") (send keymap map-function "c:up" "put-previous-sexp")