Implement general mechanism for initializing editor state when editor
authorChris Hanson <org/chris-hanson/cph>
Thu, 26 Oct 2000 02:28:22 +0000 (02:28 +0000)
committerChris Hanson <org/chris-hanson/cph>
Thu, 26 Oct 2000 02:28:22 +0000 (02:28 +0000)
is created.

v7/src/edwin/comred.scm
v7/src/edwin/dosproc.scm
v7/src/edwin/editor.scm
v7/src/edwin/edwin.pkg
v7/src/edwin/input.scm
v7/src/edwin/intmod.scm
v7/src/edwin/process.scm
v7/src/edwin/prompt.scm

index e9bd3026437c3d1fb9df6b0c2a34330e840ce356..f3743ca35e91f28cfa64723fa075b19d3cefeea8 100644 (file)
@@ -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
 ;;;
 (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))
 \f
 (define (top-level-command-reader init)
   (with-keyboard-macro-disabled
index 096ce3cce4955c3786726ab7fa399abbdebcf339..022999816ee414dbd4c7866178234851184cdcdd 100644 (file)
@@ -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 @@
 \f
 (define subprocesses-available? false)
 
-(define (initialize-processes!)
-  unspecific)
-
 (define (process-list)
   '())
 
index 334da552b8889c8b9486adbbf3c9a77c0bfe2b3b..d2395aadabec736cd246b8e36af044d72bbaaef6 100644 (file)
@@ -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
 ;;;
            (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))
 (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))
               (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))))
                       (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)))))
index 00d7aeb5f8873d44bf935c7b8de1ac80ddbeb55f..7729ba809411988e17299b9766c587740aa40f4c 100644 (file)
@@ -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
index 4af2806fb36c2f4995358e73f4d3f87308cc79cb..163ed7573749a550708abb84d689c0ecbdaba3b8 100644 (file)
@@ -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
index e36bbb5d812527b77958cca3b79be18a935a46bc..8884941dcec2f025b267afc970997957a045666d 100644 (file)
@@ -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))
 \f
 (define (wait-for-input port mode ready? level)
   (signal-thread-event editor-thread
index a25333bfcf13ca204bd08bca64af97c9cca671b4..523d02c9e85ae37b29a9ade13c5f0bc844a662fa 100644 (file)
@@ -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
 \f
 (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)
 
index eba23c5bc39847dd5f9aa9b23249278939f60288..0dafca6b2d7a30599865a232c5c0d0ad6a7bf1c4 100644 (file)
@@ -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
 ;;;
 (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) "*"))