From f15505b8f02de07dbe1feaa8cf51ea26c029d3e1 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Sun, 1 Aug 1993 05:30:29 +0000 Subject: [PATCH] If an inferior REPL generates an unsolicited prompt, perform the prompt only when the REPL buffer is selected. If the buffer is not selected, delay the prompt until selection occurs. What is still missing is a notification mechanism to alert the user that the inferior REPL needs attention. --- v7/src/edwin/intmod.scm | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-) diff --git a/v7/src/edwin/intmod.scm b/v7/src/edwin/intmod.scm index 22d0f2d3a..ab33477e3 100644 --- a/v7/src/edwin/intmod.scm +++ b/v7/src/edwin/intmod.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: intmod.scm,v 1.57 1993/07/30 21:11:15 cph Exp $ +;;; $Id: intmod.scm,v 1.58 1993/08/01 05:30:29 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-93 Massachusetts Institute of Technology ;;; @@ -755,22 +755,28 @@ If this is an error, the debugger examines the error condition." (let ((value unique)) (signal-thread-event editor-thread (lambda () - ;; This is unlikely to work. We've got to get a better - ;; mechanism to handle this kind of stuff. - (override-next-command! - (lambda () - (set! value - (cleanup-pop-up-buffers - (lambda () - (let ((buffer (port/buffer port))) - (if (not (buffer-visible? buffer)) - (pop-up-buffer buffer false))) - (procedure prompt)))) - (signal-thread-event (port/thread port) false))))) + ;; This would be even better if it could notify the use + ;; that the inferior REPL wanted some attention. + (when-buffer-selected (port/buffer port) + (lambda () + (override-next-command! + (lambda () + (set! value (procedure prompt)) + (signal-thread-event (port/thread port) false))))))) (do () ((not (eq? value unique))) (suspend-current-thread)) value)))) +(define (when-buffer-selected buffer thunk) + (if (current-buffer? buffer) + (thunk) + (letrec + ((hook + (lambda (buffer) + (thunk) + (remove-select-buffer-hook buffer hook)))) + (add-select-buffer-hook buffer hook)))) + (define (operation/prompt-for-command-expression port prompt) (read-expression port (parse-command-prompt prompt))) -- 2.25.1