From ab11602b9eaaf670dab6220b8fbdadf269bd7747 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 26 Oct 2000 02:28:22 +0000 Subject: [PATCH] Implement general mechanism for initializing editor state when editor is created. --- v7/src/edwin/comred.scm | 15 +++++++------- v7/src/edwin/dosproc.scm | 7 ++----- v7/src/edwin/editor.scm | 43 ++++++++++++++++++++-------------------- v7/src/edwin/edwin.pkg | 7 +------ v7/src/edwin/input.scm | 17 ++++++++-------- v7/src/edwin/intmod.scm | 11 +++++----- v7/src/edwin/process.scm | 15 +++++++------- v7/src/edwin/prompt.scm | 21 ++++++++++---------- 8 files changed, 66 insertions(+), 70 deletions(-) diff --git a/v7/src/edwin/comred.scm b/v7/src/edwin/comred.scm index e9bd30264..f3743ca35 100644 --- a/v7/src/edwin/comred.scm +++ b/v7/src/edwin/comred.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: comred.scm,v 1.120 2000/05/08 20:07:27 cph Exp $ +;;; $Id: comred.scm,v 1.121 2000/10/26 02:28:01 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology ;;; @@ -36,12 +36,13 @@ (define command-reader-override-queue) (define *command-suffixes*) -(define (initialize-command-reader!) - (set! keyboard-keys-read 0) - (set! command-history (make-circular-list command-history-limit false)) - (set! command-reader-override-queue (make-queue)) - (set! *command-suffixes* #f) - unspecific) +(add-event-receiver! editor-initializations + (lambda () + (set! keyboard-keys-read 0) + (set! command-history (make-circular-list command-history-limit false)) + (set! command-reader-override-queue (make-queue)) + (set! *command-suffixes* #f) + unspecific)) (define (top-level-command-reader init) (with-keyboard-macro-disabled diff --git a/v7/src/edwin/dosproc.scm b/v7/src/edwin/dosproc.scm index 096ce3cce..022999816 100644 --- a/v7/src/edwin/dosproc.scm +++ b/v7/src/edwin/dosproc.scm @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: dosproc.scm,v 1.4 1999/01/02 06:11:34 cph Exp $ +;;; $Id: dosproc.scm,v 1.5 2000/10/26 02:28:04 cph Exp $ ;;; -;;; Copyright (c) 1992-1999 Massachusetts Institute of Technology +;;; Copyright (c) 1992-2000 Massachusetts Institute of Technology ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -25,9 +25,6 @@ (define subprocesses-available? false) -(define (initialize-processes!) - unspecific) - (define (process-list) '()) diff --git a/v7/src/edwin/editor.scm b/v7/src/edwin/editor.scm index 334da552b..d2395aada 100644 --- a/v7/src/edwin/editor.scm +++ b/v7/src/edwin/editor.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: editor.scm,v 1.248 2000/05/25 03:33:47 cph Exp $ +;;; $Id: editor.scm,v 1.249 2000/10/26 02:28:07 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology ;;; @@ -33,20 +33,20 @@ (error "edwin: Arguments ignored when re-entering editor" args)) (edwin-continuation => (lambda (restart) - (set! edwin-continuation false) + (set! edwin-continuation #f) (within-continuation restart (lambda () (set! editor-abort continuation) unspecific))))) (fluid-let ((editor-abort continuation) (current-editor edwin-editor) - (within-editor? true) + (within-editor? #t) (editor-thread (current-thread)) (editor-thread-root-continuation) (editor-initial-threads '()) - (inferior-thread-changes? false) + (inferior-thread-changes? #f) (inferior-threads '()) - (recursive-edit-continuation false) + (recursive-edit-continuation #f) (recursive-edit-level 0)) (editor-grab-display edwin-editor (lambda (with-editor-ungrabbed operations) @@ -75,7 +75,7 @@ (top-level-command-reader edwin-initialization))))))) message) - false + #f `((START-CHILD ,(editor-start-child-cmdl with-editor-ungrabbed)) (CHILD-PORT ,(editor-child-cmdl-port (nearest-cmdl/port))) ,@operations)) @@ -84,10 +84,10 @@ (define (edwin . args) (apply edit args)) (simple-command-line-parser "-edit" edit) -(define edwin-editor false) +(define edwin-editor #f) (define editor-abort) (define current-editor) -(define within-editor? false) +(define within-editor? #f) (define editor-thread) (define editor-thread-root-continuation) (define editor-initial-threads) @@ -96,7 +96,7 @@ ;; Set this before entering the editor to get something done after the ;; editor's dynamic environment is initialized, but before the command ;; loop is started. -(define edwin-initialization false) +(define edwin-initialization #f) (define (queue-initial-thread thunk) (set! editor-initial-threads (cons thunk editor-initial-threads)) @@ -113,11 +113,7 @@ (set! create-editor-args args) args)))) (reset-editor) - (initialize-typein!) - (initialize-typeout!) - (initialize-command-reader!) - (initialize-processes!) - (initialize-inferior-repls!) + (event-distributor/invoke! editor-initializations) (set! edwin-editor (make-editor "Edwin" (let ((name (and (not (null? args)) (car args)))) @@ -133,11 +129,14 @@ (if (null? args) '() (cdr args)))) (set! edwin-initialization (lambda () - (set! edwin-initialization false) + (set! edwin-initialization #f) (standard-editor-initialization))) - (set! edwin-continuation false) + (set! edwin-continuation #f) unspecific)) +(define editor-initializations + (make-event-distributor)) + (define (default-display-type preferences) (define (fail) (error "Can't find any usable display type")) @@ -206,9 +205,9 @@ with the contents of the startup message." (for-each (lambda (screen) (screen-discard! screen)) (editor-screens edwin-editor)) - (set! edwin-editor false) + (set! edwin-editor #f) (set! edwin-continuation) - (set! init-file-loaded? false) + (set! init-file-loaded? #f) (weak-set-car! *previous-popped-up-window* #f) (weak-set-car! *previous-popped-up-buffer* #f) (weak-set-car! *minibuffer-scroll-window* #f) @@ -409,9 +408,9 @@ TRANSCRIPT messages appear in transcript buffer, if it is enabled; (define-structure (input-event (constructor make-input-event (type operator . operands)) (conc-name input-event/)) - (type false read-only true) - (operator false read-only true) - (operands false read-only true)) + (type #f read-only #t) + (operator #f read-only #t) + (operands #f read-only #t)) (define (apply-input-event input-event) (if (not (input-event? input-event)) @@ -472,7 +471,7 @@ TRANSCRIPT messages appear in transcript buffer, if it is enabled; (lambda () (let ((screen (selected-screen))) (screen-enter! screen) - (update-screen! screen true)))) + (update-screen! screen #t)))) (exit (lambda () (screen-exit! (selected-screen))))) diff --git a/v7/src/edwin/edwin.pkg b/v7/src/edwin/edwin.pkg index 00d7aeb5f..7729ba809 100644 --- a/v7/src/edwin/edwin.pkg +++ b/v7/src/edwin/edwin.pkg @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: edwin.pkg,v 1.263 2000/07/05 22:38:02 cph Exp $ +$Id: edwin.pkg,v 1.264 2000/10/26 02:28:10 cph Exp $ Copyright (c) 1989-2000 Massachusetts Institute of Technology @@ -412,7 +412,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. execute-key execute-command execute-command-history-entry - initialize-command-reader! keyboard-keys-read last-command last-command-key @@ -437,7 +436,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. char-metafy clear-message command-prompt - initialize-typeout! keyboard-read keyboard-peek keyboard-peek-no-hang @@ -470,7 +468,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. edwin-mode$minibuffer-local-yes-or-no edwin-variable$enable-recursive-minibuffers edwin-variable$completion-auto-help - initialize-typein! pop-up-completions-list pop-up-generated-completions prompt-for-alist-value @@ -646,7 +643,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. global-repl-buffer inferior-repl-eval-expression inferior-repl-eval-region - initialize-inferior-repls! local-repl-buffer repl-buffer-list repl-buffer? @@ -909,7 +905,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. get-process-by-name handle-process-status-changes hangup-process - initialize-processes! ; always present interrupt-process kill-process process-arguments diff --git a/v7/src/edwin/input.scm b/v7/src/edwin/input.scm index 4af2806fb..163ed7573 100644 --- a/v7/src/edwin/input.scm +++ b/v7/src/edwin/input.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: input.scm,v 1.101 2000/04/30 22:17:05 cph Exp $ +;;; $Id: input.scm,v 1.102 2000/10/26 02:28:13 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology ;;; @@ -82,13 +82,14 @@ B 3BAB8C (define message-should-be-erased?) (define auto-save-keystroke-count) -(define (initialize-typeout!) - (set! command-prompt-string #f) - (set! command-prompt-displayed? #f) - (set! message-string #f) - (set! message-should-be-erased? #f) - (set! auto-save-keystroke-count 0) - unspecific) +(add-event-receiver! editor-initializations + (lambda () + (set! command-prompt-string #f) + (set! command-prompt-displayed? #f) + (set! message-string #f) + (set! message-should-be-erased? #f) + (set! auto-save-keystroke-count 0) + unspecific)) (define (reset-command-prompt!) ;; Should only be called by the command reader. This prevents diff --git a/v7/src/edwin/intmod.scm b/v7/src/edwin/intmod.scm index e36bbb5d8..8884941dc 100644 --- a/v7/src/edwin/intmod.scm +++ b/v7/src/edwin/intmod.scm @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: intmod.scm,v 1.109 1999/12/28 20:28:58 cph Exp $ +;;; $Id: intmod.scm,v 1.110 2000/10/26 02:28:16 cph Exp $ ;;; -;;; Copyright (c) 1986, 1989-1999 Massachusetts Institute of Technology +;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -207,9 +207,10 @@ evaluated in the specified inferior REPL buffer." (define repl-buffers) -(define (initialize-inferior-repls!) - (set! repl-buffers '()) - unspecific) +(add-event-receiver! editor-initializations + (lambda () + (set! repl-buffers '()) + unspecific)) (define (wait-for-input port mode ready? level) (signal-thread-event editor-thread diff --git a/v7/src/edwin/process.scm b/v7/src/edwin/process.scm index a25333bfc..523d02c9e 100644 --- a/v7/src/edwin/process.scm +++ b/v7/src/edwin/process.scm @@ -1,8 +1,8 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: process.scm,v 1.57 1999/09/14 20:18:52 cph Exp $ +;;; $Id: process.scm,v 1.58 2000/10/26 02:28:19 cph Exp $ ;;; -;;; Copyright (c) 1991-1999 Massachusetts Institute of Technology +;;; Copyright (c) 1991-2000 Massachusetts Institute of Technology ;;; ;;; This program is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU General Public License as @@ -25,11 +25,12 @@ (define subprocesses-available? #t) -(define (initialize-processes!) - (set! edwin-processes '()) - (set! process-input-queue (cons '() '())) - (set-variable! exec-path (os/exec-path)) - (set-variable! shell-file-name (os/shell-file-name))) +(add-event-receiver! editor-initializations + (lambda () + (set! edwin-processes '()) + (set! process-input-queue (cons '() '())) + (set-variable! exec-path (os/exec-path)) + (set-variable! shell-file-name (os/shell-file-name)))) (define edwin-processes) diff --git a/v7/src/edwin/prompt.scm b/v7/src/edwin/prompt.scm index eba23c5bc..0dafca6b2 100644 --- a/v7/src/edwin/prompt.scm +++ b/v7/src/edwin/prompt.scm @@ -1,6 +1,6 @@ ;;; -*-Scheme-*- ;;; -;;; $Id: prompt.scm,v 1.188 2000/06/18 20:36:15 cph Exp $ +;;; $Id: prompt.scm,v 1.189 2000/10/26 02:28:22 cph Exp $ ;;; ;;; Copyright (c) 1986, 1989-2000 Massachusetts Institute of Technology ;;; @@ -31,15 +31,16 @@ (define map-name/internal->external) (define map-name/external->internal) -(define (initialize-typein!) - (set! typein-edit-continuation #f) - (set! typein-edit-depth -1) - (set! typein-saved-buffers '()) - (set! typein-saved-windows '()) - (set! map-name/internal->external identity-procedure) - (set! map-name/external->internal identity-procedure) - (set! prompt-histories (make-eq-hash-table)) - unspecific) +(add-event-receiver! editor-initializations + (lambda () + (set! typein-edit-continuation #f) + (set! typein-edit-depth -1) + (set! typein-saved-buffers '()) + (set! typein-saved-windows '()) + (set! map-name/internal->external identity-procedure) + (set! map-name/external->internal identity-procedure) + (set! prompt-histories (make-eq-hash-table)) + unspecific)) (define (make-typein-buffer-name depth) (string-append " *Typein-" (number->string depth) "*")) -- 2.25.1