From 283b416393709e8fb0ec5a0e4eb903cbce77301b Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Fri, 15 Oct 1993 12:50:15 +0000 Subject: [PATCH] When evaluate-in-inferior-repl is true, distinguish between evaluations done in inferior REPL buffers and evaluations done in other buffers (and the minibuffer); change the latter so that the value of the evaluation is printed in the minibuffer, just as it would have been if evaluate-in-inferior-repl were false. Furthermore, if there is no inferior REPL, M-x eval-expression now works anyway. --- v7/src/edwin/edwin.pkg | 8 +++++-- v7/src/edwin/evlcom.scm | 13 +++++++----- v7/src/edwin/intmod.scm | 46 +++++++++++++++++++++++++++-------------- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/v7/src/edwin/edwin.pkg b/v7/src/edwin/edwin.pkg index dce420e0e..487a56577 100644 --- a/v7/src/edwin/edwin.pkg +++ b/v7/src/edwin/edwin.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: edwin.pkg,v 1.139 1993/10/11 11:39:37 cph Exp $ +$Id: edwin.pkg,v 1.140 1993/10/15 12:50:15 cph Exp $ Copyright (c) 1989-1993 Massachusetts Institute of Technology @@ -649,6 +649,7 @@ MIT in each case. |# (export (edwin) buffer/inferior-cmdl current-repl-buffer + current-repl-buffer* edwin-command$inferior-cmdl-abort-nearest edwin-command$inferior-cmdl-abort-previous edwin-command$inferior-cmdl-abort-top-level @@ -665,7 +666,10 @@ MIT in each case. |# inferior-repl-eval-expression inferior-repl-eval-region initialize-inferior-repls! - start-inferior-repl!)) + repl-buffer? + start-inferior-repl!) + (import (runtime user-interface) + default/write-result)) (define-package (edwin dired) (files "dired") diff --git a/v7/src/edwin/evlcom.scm b/v7/src/edwin/evlcom.scm index 0f703e87e..4cbb198d7 100644 --- a/v7/src/edwin/evlcom.scm +++ b/v7/src/edwin/evlcom.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: evlcom.scm,v 1.44 1993/10/15 05:35:13 cph Exp $ +;;; $Id: evlcom.scm,v 1.45 1993/10/15 12:49:57 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology ;;; @@ -79,7 +79,8 @@ If #F, use the default (REP loop) syntax-table." (syntax-table (ref-variable-object scheme-syntax-table)) (evaluate-inferior (ref-variable-object evaluate-in-inferior-repl)) (run-light (ref-variable-object run-light))) - (if (and (not (variable-local-value? buffer evaluate-inferior)) + (if (and (not (repl-buffer? buffer)) + (not (variable-local-value? buffer evaluate-inferior)) (or (and (variable-local-value? buffer environment) (not (eq? 'DEFAULT (variable-local-value buffer environment)))) @@ -196,7 +197,7 @@ With an argument, prompts for the evaluation environment." (cond ((ref-variable disable-evaluation-commands buffer) (editor-error "Evaluation commands disabled in this buffer.")) ((ref-variable evaluate-in-inferior-repl buffer) - (inferior-repl-eval-region (current-repl-buffer) region)) + (inferior-repl-eval-region (current-repl-buffer buffer) region)) (else (evaluate-region region (evaluation-environment buffer))))))) @@ -213,8 +214,10 @@ The values are printed in the typein window." (let ((buffer (current-buffer))) (cond ((ref-variable disable-evaluation-commands buffer) (editor-error "Evaluation commands disabled in this buffer.")) - ((ref-variable evaluate-in-inferior-repl buffer) - (inferior-repl-eval-expression (current-repl-buffer) expression)) + ((and (ref-variable evaluate-in-inferior-repl buffer) + (current-repl-buffer* buffer)) + => (lambda (buffer) + (inferior-repl-eval-expression buffer expression))) (else (if (ref-variable enable-transcript-buffer buffer) (call-with-transcript-buffer diff --git a/v7/src/edwin/intmod.scm b/v7/src/edwin/intmod.scm index 17b95558d..ee36a8e17 100644 --- a/v7/src/edwin/intmod.scm +++ b/v7/src/edwin/intmod.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: intmod.scm,v 1.64 1993/09/02 18:45:38 cph Exp $ +;;; $Id: intmod.scm,v 1.65 1993/10/15 12:50:04 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology ;;; @@ -140,19 +140,24 @@ REPL uses current evaluation environment." (define (inferior-repl/quit) unspecific) -(define (current-repl-buffer) - (let ((buffer (current-repl-buffer*))) +(define (current-repl-buffer buffer) + (let ((buffer (current-repl-buffer* buffer))) (if (not buffer) (error "No REPL to evaluate in.")) buffer)) -(define (current-repl-buffer*) - (let ((buffer (current-buffer))) - (if (buffer-interface-port buffer) - buffer - (let ((buffers repl-buffers)) - (and (not (null? buffers)) - (car buffers)))))) +(define (current-repl-buffer* buffer) + (if (and buffer (repl-buffer? buffer)) + buffer + (let ((buffer (current-buffer))) + (if (buffer-interface-port buffer) + buffer + (let ((buffers repl-buffers)) + (and (not (null? buffers)) + (car buffers))))))) + +(define (repl-buffer? buffer) + (buffer-interface-port buffer)) (define repl-buffers) @@ -224,7 +229,7 @@ REPL uses current evaluation environment." (let ((variable (ref-variable-object run-light)) (value (if run? "eval" "listen"))) (if (and (ref-variable evaluate-in-inferior-repl buffer) - (eq? buffer (current-repl-buffer*))) + (eq? buffer (current-repl-buffer* #f))) (begin (undefine-variable-local-value! buffer variable) (set-variable-default-value! variable value) @@ -251,14 +256,14 @@ REPL uses current evaluation environment." (evaluate-in-inferior-repl (ref-variable evaluate-in-inferior-repl buffer))) (if (and evaluate-in-inferior-repl - (eq? buffer (current-repl-buffer*))) + (eq? buffer (current-repl-buffer* #f))) (begin (set-variable-default-value! run-light false) (global-window-modeline-event!))) (set! repl-buffers (delq! buffer repl-buffers)) (let ((buffer (and evaluate-in-inferior-repl - (current-repl-buffer*)))) + (current-repl-buffer* #f)))) (if buffer (let ((value (variable-local-value buffer run-light))) (undefine-variable-local-value! buffer run-light) @@ -391,7 +396,7 @@ Additionally, these commands abort the command loop: (define (interrupt-command interrupt) (lambda () (signal-thread-event - (port/thread (buffer-interface-port (current-repl-buffer))) + (port/thread (buffer-interface-port (current-repl-buffer #f))) interrupt))) (define-command inferior-cmdl-breakpoint @@ -691,6 +696,16 @@ If this is an error, the debugger examines the error condition." (let ((windows (buffer-windows buffer))) (and (not (null? windows)) (apply min (map window-x-size windows))))))) + +(define (operation/write-result port expression value hash-number) + (let ((buffer (port/buffer port))) + (case (operation/current-expression-context port expression) + ((EXPRESSION OTHER-BUFFER) + (transcript-write value + (and (ref-variable enable-transcript-buffer buffer) + (transcript-buffer)))) + (else + (default/write-result port expression value hash-number))))) (define (enqueue-output-string! port string) (let ((interrupt-mask (set-interrupt-enables! interrupt-mask/gc-ok))) @@ -954,5 +969,6 @@ If this is an error, the debugger examines the error condition." (PEEK-CHAR ,operation/peek-char) (READ-CHAR ,operation/read-char) (READ ,operation/read) - (CURRENT-EXPRESSION-CONTEXT ,operation/current-expression-context)) + (CURRENT-EXPRESSION-CONTEXT ,operation/current-expression-context) + (WRITE-RESULT ,operation/write-result)) false)) \ No newline at end of file -- 2.25.1