Don't permit inferior REPL evaluation unless the buffer is in
authorChris Hanson <org/chris-hanson/cph>
Fri, 21 Aug 1992 22:47:00 +0000 (22:47 +0000)
committerChris Hanson <org/chris-hanson/cph>
Fri, 21 Aug 1992 22:47:00 +0000 (22:47 +0000)
inferior-repl mode.

v7/src/edwin/intmod.scm

index cce8bebe7d6c66e34149f35a5402cfaa174e4ed2..0a7191f497da09e122416f6f0e9b986ac461fda1 100644 (file)
@@ -1,6 +1,6 @@
 ;;; -*-Scheme-*-
 ;;;
-;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/intmod.scm,v 1.49 1992/08/18 23:32:10 cph Exp $
+;;;    $Header: /Users/cph/tmp/foo/mit-scheme/mit-scheme/v7/src/edwin/intmod.scm,v 1.50 1992/08/21 22:47:00 cph Exp $
 ;;;
 ;;;    Copyright (c) 1986, 1989-92 Massachusetts Institute of Technology
 ;;;
@@ -443,6 +443,7 @@ If this is an error, the debugger examines the error condition."
       (end-input-wait port))))
 \f
 (define (inferior-repl-eval-region buffer region)
+  (inferior-repl-eval-ok? buffer)
   (call-with-transcript-output-mark buffer
     (lambda (mark)
       (if mark
@@ -468,6 +469,7 @@ If this is an error, the debugger examines the error condition."
          (end-input-wait port)))))
 
 (define (inferior-repl-eval-expression buffer expression)
+  (inferior-repl-eval-ok? buffer)
   (call-with-transcript-output-mark buffer
     (lambda (mark)
       (if mark
@@ -481,6 +483,14 @@ If this is an error, the debugger examines the error condition."
       (move-mark-to! (port/mark port) end))
     (enqueue! (port/expression-queue port) expression)
     (end-input-wait port)))
+
+(define (inferior-repl-eval-ok? buffer)
+  (let ((mode (buffer-major-mode buffer)))
+    (if (not (eq? mode (ref-mode-object inferior-repl)))
+       (editor-error
+        (if (eq? mode (ref-mode-object inferior-cmdl))
+            "REPL needs response before evaluation will be enabled."
+            "Can't evaluate -- REPL buffer in anomalous mode.")))))
 \f
 ;;;; Queue