diff --git a/library/TEXEC b/library/TEXEC
index dd671ff3..c50411f6 100644
--- a/library/TEXEC
+++ b/library/TEXEC
@@ -1,16 +1,14 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "XCL" BASE 10)
 
-(FILECREATED "18-Jun-2023 09:48:54" |{WMEDLEY}<library>TEXEC.;5| 185935 
+(FILECREATED "28-Mar-2024 00:09:16" |{WMEDLEY}<library>TEXEC.;6| 185248 
 
       :EDIT-BY |rmk|
 
-      :CHANGES-TO (VARS TEXECCOMS)
+      :CHANGES-TO (FNS TEXEC.DEFAULT.MENUFN TEXEC.SHRINK.ICONCREATE)
 
-      :PREVIOUS-DATE "16-Jul-2022 23:42:20" |{WMEDLEY}<library>TEXEC.;3|)
+      :PREVIOUS-DATE "18-Jun-2023 09:48:54" |{WMEDLEY}<library>TEXEC.;5|)
 
 
-; Copyright (c) 1985, 1900, 1986-1991 by Venue & Xerox Corporation.
-
 (PRETTYCOMPRINT TEXECCOMS)
 
 (RPAQQ TEXECCOMS
@@ -186,28 +184,24 @@
           TEXSTREAM)))
 
 (TEXEC.DEFAULT.MENUFN
-  (LAMBDA (W)                                          (* \; "Edited 13-Jun-90 00:16 by mitani")
+  (LAMBDA (W)                                               (* \; "Edited 28-Mar-2024 00:06 by rmk")
+                                                           (* \; "Edited 13-Jun-90 00:16 by mitani")
 
-         (* |Default| |User| F\n |for| TEXEC |windows--displays| \a |menu| |of| |items| 
-       & |acts| |on| |the| |commands| |received.|)
+    (* |;;| 
+    "Default User Fn for TEXEC windows--displays a menu of items & acts on the commands received.")
 
-    (PROG ((TEXTOBJ (WINDOWPROP W 'TEXTOBJ))
+    (PROG ((TEXTOBJ (TEXTOBJ W))
            (WMENU (WINDOWPROP W 'TEDIT.MENU))
            THISMENU CH OFILE OCURSOR PCTB LINES SEL ITEM)
           (COND
              ((EQ (|fetch| (TEXTOBJ EDITOPACTIVE) |of| TEXTOBJ)
-                  T)                                         (* |We're| |busy| |doing| 
-                                                           |something,| |but| |not| |sure| 
-                                                           |what.| |Give| \a |general| 
-                                                           "please wait" |msg|)
+                  T)                                         (* \; 
+                   "We're busy doing something, but not sure what.  Give a general 'please wait' msg")
               (TEDIT.PROMPTPRINT TEXTOBJ "Edit operation in progress; please wait." T)
               (RETURN))
-             ((|fetch| (TEXTOBJ EDITOPACTIVE) |of| TEXTOBJ)
-                                                             (* W\e |know| |specifically| 
-                                                           |what's| |happening.|
-                                                           |Tell| |him|)
-              (TEDIT.PROMPTPRINT TEXTOBJ (CONCAT (|fetch| (TEXTOBJ EDITOPACTIVE) |of| TEXTOBJ
-                                                        )
+             ((|fetch| (TEXTOBJ EDITOPACTIVE) |of| TEXTOBJ)  (* \; 
+                                                   "We know specifically what's happening.  Tell him")
+              (TEDIT.PROMPTPRINT TEXTOBJ (CONCAT (|fetch| (TEXTOBJ EDITOPACTIVE) |of| TEXTOBJ)
                                                 " in progress; please wait.")
                      T)
               (RETURN)))
@@ -222,37 +216,31 @@
           (ERSETQ (RESETLST
                       (RESETSAVE (\\TEDIT.MARKACTIVE TEXTOBJ)
                              '(AND (\\TEDIT.MARKINACTIVE OLDVALUE)))
-                      (|replace| (TEXTOBJ EDITOPACTIVE) |of| TEXTOBJ
-                         |with| (OR (CAR ITEM)
-                                        T))                  (* S\o |we| |ca| |ntell| |the| |guy| 
-                                                           WHAT |op| |is| |active.|)
+                      (|replace| (TEXTOBJ EDITOPACTIVE) |of| TEXTOBJ |with| (OR (CAR ITEM)
+                                                                                T))
+                                                             (* \; 
+                                                          "So we ca ntell the guy WHAT op is active.")
                       (SELECTQ (CAR ITEM)
                           (|Put| (TEDIT.PUT TEXTOBJ NIL NIL (TEXTPROP TEXTOBJ 'CLEARPUT)))
                           (|Plain-Text| (TEDIT.PUT TEXTOBJ NIL NIL T))
-                          (|Old-Format|                      (* |Write| |out| |the| |file| |in| 
-                                                           |the| OLD |TEdit| |format.|)
+                          (|Old-Format|                      (* \; 
+                                                        "Write out the file in the OLD TEdit format.")
                                         (TEDIT.PUT TEXTOBJ NIL NIL NIL T))
-                          (|Get|                             (* |Get| \a |new| |file|
-                                                           (|overwriting| |the| |one| |being| 
-                                                           |edited.|))
+                          (|Get|                             (* \; 
+                                                 "Get a new file (overwriting the one being edited.)")
                                  (TEXEC.GET TEXTOBJ NIL (TEXTPROP TEXTOBJ 'CLEARGET)))
                           (|Unformatted Get| 
                                (TEXEC.GET TEXTOBJ NIL T))
-                          (|Include|                         (* |Insert| \a |file| |where| |the| 
-                                                           |caret| |is|)
+                          (|Include|                         (* \; "Insert a file where the caret is")
                                      (TEXEC.INCLUDE TEXTOBJ))
-                          (|ForwardFind|                     (* |Normal| |forward| |search| 
-                                                           |Find|)
+                          (|ForwardFind|                     (* \; "Normal forward search Find")
                                          (TEXEC.FIND.FORWARD TEXTOBJ))
-                          (|BackwardFind|                    (* |Backward| |search| |Find|)
+                          (|BackwardFind|                    (* \; "Backward search Find")
                                (TEXEC.FIND.BACKWARD TEXTOBJ))
                           (|Limit| (SETQ TEXEC.BUFFERLIMIT (RNUMBER)))
                           (COND
-                             ((CAR ITEM)
-
-         (* |This| |is| \a |user-supplied| |entry.|
-       |Get| |the| |function,| |and| |apply| |it| |to| |the| TEXTSTREAM |for| |him|)
-
+                             ((CAR ITEM)                     (* \; 
+           "This is a user-supplied entry.  Get the function, and apply it to the TEXTSTREAM for him")
                               (APPLY* (CAR ITEM)
                                      (|fetch| (TEXTOBJ STREAMHINT) |of| TEXTOBJ))))))))))
 
@@ -1009,58 +997,44 @@
                      ""))))
 
 (TEXEC.SHRINK.ICONCREATE
-  (LAMBDA (W ICON ICONW)                                     (* AJB " 7-Jan-86 16:37")
-                                                             (* |Create| |the| |icon| |that| 
-                                                             |represents| |this| |window.|)
-    (PROG ((ICON (WINDOWPROP W 'ICON))
-           (ICONTITLE (WINDOWPROP W 'TEDIT.ICON.TITLE))
-           (SHRINKFN (WINDOWPROP W 'SHRINKFN)))
-          (COND
-             ((NOT (WINDOWPROP W 'TEXTOBJ))
-          
-          (* |This| |isn't| |really| \a |TEdit| |window| |any| |more.|
-          |Don't| |do| |anything|)
-
-              NIL)
-             ((WINDOWPROP W 'TEDITMENU)                      (* |This| |is| \a |text| |menu,| |and| 
-                                                             |shrinks| |without| |trace.|)
-              NIL)
-             ((OR (IGREATERP (FLENGTH SHRINKFN)
-                         3)
-                  (AND (NOT (FMEMB 'SHRINKATTACHEDWINDOWS SHRINKFN))
-                       (IGREATERP (FLENGTH SHRINKFN)
-                              2)))
-          
-          (* |There| |are| |other| |functions| |that| |expect| |to| |handle| |this.|
-          |Don't| |bother.|)
-
-              NIL)
-             ((OR (AND ICONTITLE (EQUAL ICONTITLE (PROCESSPROP (WINDOWPROP W 'PROCESS)
-                                                         'NAME)))
-                  (AND (NOT ICONTITLE)
-                       ICON))
-          
-          (* |we| |built| |this| |and| |the| |title| |is| |the| |same,| |or| |he| |has| 
-          |already| |put| |an| |icon| |on| |this.|
-          D\o |nothing|)
-
-              NIL)
-             (ICON 
-          
-          (* |There's| |an| |existing| |icon| |window;|
-          |change| |the| |title| |in| |it|)
-
+  (LAMBDA (W ICON ICONW)                                    (* \; "Edited 28-Mar-2024 00:08 by rmk")
+                                                             (* AJB " 7-Jan-86 16:37")
+                                                             (* \; 
+                                                       "Create the icon that represents this window.")
+    (CL:WHEN (TEXTSTREAM W T)
+        (LET ((ICON (WINDOWPROP W 'ICON))
+              (ICONTITLE (WINDOWPROP W 'TEDIT.ICON.TITLE))
+              (SHRINKFN (WINDOWPROP W 'SHRINKFN)))
+             (COND
+                ((WINDOWPROP W 'TEDITMENU)                   (* \; 
+                                                    "This is a text menu, and shrinks without trace.")
+                 )
+                ((OR (IGREATERP (FLENGTH SHRINKFN)
+                            3)
+                     (AND (NOT (FMEMB 'SHRINKATTACHEDWINDOWS SHRINKFN))
+                          (IGREATERP (FLENGTH SHRINKFN)
+                                 2)))                        (* \; 
+                               "There are other functions that expect to handle this.  Don't bother.")
+                 )
+                ((OR (AND ICONTITLE (EQUAL ICONTITLE (PROCESSPROP (WINDOWPROP W 'PROCESS)
+                                                            'NAME)))
+                     (AND (NOT ICONTITLE)
+                          ICON))                             (* \; 
+        "we built this and the title is the same, or he has already put an icon on this.  Do nothing")
+                 )
+                (ICON                                        (* \; 
+                                           "There's an existing icon window;  change the title in it")
+                      (WINDOWPROP W 'TEDIT.ICON.TITLE (SETQ ICONTITLE (PROCESSPROP
+                                                                       (WINDOWPROP W 'PROCESS)
+                                                                       'NAME)))
+                      (ICONTITLE ICONTITLE NIL NIL ICON))
+                (T                                           (* \; "install a new icon")
                    (WINDOWPROP W 'TEDIT.ICON.TITLE (SETQ ICONTITLE (PROCESSPROP (WINDOWPROP
                                                                                  W
                                                                                  'PROCESS)
                                                                           'NAME)))
-                   (ICONTITLE ICONTITLE NIL NIL ICON))
-             (T                                              (* |install| \a |new| |icon|)
-                (WINDOWPROP W 'TEDIT.ICON.TITLE (SETQ ICONTITLE (PROCESSPROP (WINDOWPROP W
-                                                                                    'PROCESS)
-                                                                       'NAME)))
-                (WINDOWPROP W 'ICON (TITLEDICONW TEXEC.TITLED.ICON.TEMPLATE ICONTITLE TEXEC.ICON.FONT 
-                                           NIL T '(BOTTOM LEFT))))))
+                   (WINDOWPROP W 'ICON (TITLEDICONW TEXEC.TITLED.ICON.TEMPLATE ICONTITLE 
+                                              TEXEC.ICON.FONT NIL T '(BOTTOM LEFT)))))))
     (WINDOWPROP W 'ICON)))
 
 (TEXEC.FILLBUFFER
@@ -3009,23 +2983,22 @@
 (RPAQQ |BackgroundMenu| NIL)
 
 (RPAQ? TEXEC.BUFFERLIMIT 10000)
-(PUTPROPS TEXEC COPYRIGHT ("Venue & Xerox Corporation" 1985 1900 1986 1987 1988 1989 1990 1991))
 (DECLARE\: DONTCOPY
-  (FILEMAP (NIL (3083 171708 (TEXEC.BACKSKREAD 3093 . 7717) (TEXEC.OPENTEXTSTREAM 7719 . 9777) (
-TEXEC.DEFAULT.MENUFN 9779 . 14333) (TEXEC.DO?CMD 14335 . 19653) (TEXEC.CREATEMENU 19655 . 20113) (
-TEXEC.GET 20115 . 28950) (TEXEC.INCLUDE 28952 . 42337) (TEXEC.FIND.FORWARD 42339 . 55227) (
-TEXEC.FIND.BACKWARD 55229 . 68731) (TEXEC.MENU.WHENHELDFN 68733 . 69392) (TEXEC.SHRINK.ICONCREATE 
-69394 . 72197) (TEXEC.FILLBUFFER 72199 . 88633) (TEXEC.FILLBUFFER.TCLASS 88635 . 94975) (
-TEXEC.CHSELPENDING 94977 . 103467) (TEXEC.FILLBUFFER.CHARDELETE 103469 . 105524) (
-TEXEC.FILLBUFFER.WORDDELETE 105526 . 110654) (TEXEC.FILLBUFFER.LINEDELETE 110656 . 113538) (
-TEXEC.PARENCOUNT 113540 . 114929) (TEXEC.PARENMATCH 114931 . 116471) (TEXEC.FLASHCARET 116473 . 119132
-) (TEXEC.TEXTSTREAM.TO.LINEBUF 119134 . 121821) (TEXEC.FIX 121823 . 124992) (TEXEC.NTHBUFCHARBACK 
-124994 . 126057) (TEXEC.NTHBACKCHNUM 126059 . 127344) (TEXEC.EOTP 127346 . 128079) (TEXEC.GETKEY 
-128081 . 130997) (TEXEC.INSERTCHAR 130999 . 133300) (TEXEC.DELETE 133302 . 134077) (TEXEC.\\CHDEL1 
-134079 . 137204) (TEXEC.?EQUAL 137206 . 138255) (TEDIT.SCROLL? 138257 . 143220) (TEXEC.DISPLAYTEXT 
-143222 . 149997) (\\TEXEC.TEXTBOUT 149999 . 153007) (\\TEXEC.TEXTBOUT1 153009 . 158643) (
-\\TEXEC.TEXTBOUT2 158645 . 160976) (\\TEXEC.TEXTBOUT3 160978 . 162368) (\\TEXEC.TEXTBOUT4 162370 . 
-164413) (\\TEXEC.SELFN 164415 . 165790) (TEXEC.PRINTARGS 165792 . 170755) (TEXEC.PROCENTRYFN 170757 . 
-171298) (TEXEC.PROCEXITFN 171300 . 171706)) (171768 178143 (TEXEC 171778 . 176200) (TTEXEC 176202 . 
-178141)))))
+  (FILEMAP (NIL (3048 171118 (TEXEC.BACKSKREAD 3058 . 7682) (TEXEC.OPENTEXTSTREAM 7684 . 9742) (
+TEXEC.DEFAULT.MENUFN 9744 . 13790) (TEXEC.DO?CMD 13792 . 19110) (TEXEC.CREATEMENU 19112 . 19570) (
+TEXEC.GET 19572 . 28407) (TEXEC.INCLUDE 28409 . 41794) (TEXEC.FIND.FORWARD 41796 . 54684) (
+TEXEC.FIND.BACKWARD 54686 . 68188) (TEXEC.MENU.WHENHELDFN 68190 . 68849) (TEXEC.SHRINK.ICONCREATE 
+68851 . 71607) (TEXEC.FILLBUFFER 71609 . 88043) (TEXEC.FILLBUFFER.TCLASS 88045 . 94385) (
+TEXEC.CHSELPENDING 94387 . 102877) (TEXEC.FILLBUFFER.CHARDELETE 102879 . 104934) (
+TEXEC.FILLBUFFER.WORDDELETE 104936 . 110064) (TEXEC.FILLBUFFER.LINEDELETE 110066 . 112948) (
+TEXEC.PARENCOUNT 112950 . 114339) (TEXEC.PARENMATCH 114341 . 115881) (TEXEC.FLASHCARET 115883 . 118542
+) (TEXEC.TEXTSTREAM.TO.LINEBUF 118544 . 121231) (TEXEC.FIX 121233 . 124402) (TEXEC.NTHBUFCHARBACK 
+124404 . 125467) (TEXEC.NTHBACKCHNUM 125469 . 126754) (TEXEC.EOTP 126756 . 127489) (TEXEC.GETKEY 
+127491 . 130407) (TEXEC.INSERTCHAR 130409 . 132710) (TEXEC.DELETE 132712 . 133487) (TEXEC.\\CHDEL1 
+133489 . 136614) (TEXEC.?EQUAL 136616 . 137665) (TEDIT.SCROLL? 137667 . 142630) (TEXEC.DISPLAYTEXT 
+142632 . 149407) (\\TEXEC.TEXTBOUT 149409 . 152417) (\\TEXEC.TEXTBOUT1 152419 . 158053) (
+\\TEXEC.TEXTBOUT2 158055 . 160386) (\\TEXEC.TEXTBOUT3 160388 . 161778) (\\TEXEC.TEXTBOUT4 161780 . 
+163823) (\\TEXEC.SELFN 163825 . 165200) (TEXEC.PRINTARGS 165202 . 170165) (TEXEC.PROCENTRYFN 170167 . 
+170708) (TEXEC.PROCEXITFN 170710 . 171116)) (171178 177553 (TEXEC 171188 . 175610) (TTEXEC 175612 . 
+177551)))))
 STOP
diff --git a/library/TEXEC.LCOM b/library/TEXEC.LCOM
index 1570ee44..eeb1bf40 100644
Binary files a/library/TEXEC.LCOM and b/library/TEXEC.LCOM differ
diff --git a/library/tedit/TEDIT b/library/tedit/TEDIT
index 1f4de309..5f71d9a4 100644
--- a/library/tedit/TEDIT
+++ b/library/tedit/TEDIT
@@ -1,12 +1,10 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 7-Mar-2024 08:14:51" {WMEDLEY}<library>tedit>TEDIT.;504 120660 
+(FILECREATED " 1-Apr-2024 09:46:05" {WMEDLEY}<library>TEDIT>TEDIT.;538 125643 
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS TEXTOBJ TEXTSTREAM TEDIT.MOVE)
-
-      :PREVIOUS-DATE " 4-Mar-2024 22:50:24" {WMEDLEY}<library>tedit>TEDIT.;499)
+      :PREVIOUS-DATE "31-Mar-2024 10:14:22" {WMEDLEY}<library>TEDIT>TEDIT.;537)
 
 
 (PRETTYCOMPRINT TEDITCOMS)
@@ -33,20 +31,20 @@
                              (INITVARS (CHECK-TEDIT-ASSERTIONS T)))
                       (MACROS OBJECT.ALLOWS)))
         (FILES TEDIT-PCTREE TEDIT-STREAM TEDIT-COMMAND TEDIT-SCREEN TEDIT-ABBREV TEDIT-LOOKS)
-        (FNS \CREATE.TEDIT.RESTART.MENU)
-        (VARS (TEDIT.TERMSA.FONTS NIL)
+        [VARS (TEDIT.TERMSA.FONTS NIL)
               (TEDIT.TENTATIVE NIL)
               (TEDIT.DEFAULT.PROPS NIL)
-              (TEDIT.STARTUP.MONITORLOCK (CREATE.MONITORLOCK 'TEDIT.STARTUP))
-              (TEDIT.RESTART.MENU (\CREATE.TEDIT.RESTART.MENU)))
+              (TEDIT.STARTUP.MONITORLOCK (CREATE.MONITORLOCK 'TEDIT.STARTUP]
         (GLOBALVARS TEDIT.TENTATIVE TEDIT.DEFAULT.PROPS)
         
         (* ;; "Unslashed functions.  Public?")
 
-        (FNS TEDIT COERCETEXTOBJ TEDIT.CONCAT \TEDIT.CONCAT.PAGEFRAMES \TEDIT.GET.PAGE.HEADINGS 
-             \TEDIT.CONCAT.INSTALL.HEADINGS TEDITSTRING TEDIT-SEE TEDIT.CHARWIDTH TEDIT.COPY 
-             TEDIT.DELETE TEDIT.INSERT TEDIT.KILL TEDIT.QUIT TEDIT.DO.BLUEPENDINGDELETE TEDIT.MOVE 
-             TEDIT.STRINGWIDTH TEXTOBJ TEDITMENUP TEXTSTREAM)
+        (FNS TEDIT TEXTSTREAM TEXTSTREAMP TEDITMENUP COERCETEXTSTREAM TEDIT.CONCAT TEDITSTRING 
+             TEDIT-SEE TEDIT.COPY TEDIT.DELETE TEDIT.INSERT TEDIT.KILL TEDIT.QUIT TEDIT.MOVE 
+             TEDIT.STRINGWIDTH TEDIT.CHARWIDTH)
+        (FNS TEXTOBJ COERCETEXTOBJ)
+        (FNS \TEDIT.CONCAT.PAGEFRAMES \TEDIT.GET.PAGE.HEADINGS \TEDIT.CONCAT.INSTALL.HEADINGS 
+             \TEDIT.DO.BLUEPENDINGDELETE)
         (FNS \TEDIT.MOVE.MSG \TEDIT.READONLY)
         (FNS TEDIT.NCHARS TEDIT.RPLCHARCODE TEDIT.NTHCHARCODE \TEDIT.PIECE.NTHCHARCODE)
         
@@ -164,16 +162,6 @@
 )
 
 (FILESLOAD TEDIT-PCTREE TEDIT-STREAM TEDIT-COMMAND TEDIT-SCREEN TEDIT-ABBREV TEDIT-LOOKS)
-(DEFINEQ
-
-(\CREATE.TEDIT.RESTART.MENU
-  [LAMBDA NIL                                                (* ; "Edited 28-Aug-2022 22:45 by rmk")
-
-    (* ;; "Separate dinky function to compile for SUNLOADUP without DWIM.")
-
-    (CREATE MENU
-           ITEMS _ '(NewEditProcess])
-)
 
 (RPAQQ TEDIT.TERMSA.FONTS NIL)
 
@@ -182,8 +170,6 @@
 (RPAQQ TEDIT.DEFAULT.PROPS NIL)
 
 (RPAQ TEDIT.STARTUP.MONITORLOCK (CREATE.MONITORLOCK 'TEDIT.STARTUP))
-
-(RPAQ TEDIT.RESTART.MENU (\CREATE.TEDIT.RESTART.MENU))
 (DECLARE%: DOEVAL@COMPILE DONTCOPY
 
 (GLOBALVARS TEDIT.TENTATIVE TEDIT.DEFAULT.PROPS)
@@ -198,6 +184,8 @@
 (TEDIT
   [LAMBDA (TEXT WINDOW DONTSPAWN PROPS)
 
+    (* ;; "Edited  9-Mar-2024 22:47 by rmk")
+
     (* ;; "Edited 20-Oct-2023 11:02 by rmk")
 
     (* ;; "Edited 17-Oct-2023 08:53 by rmk")
@@ -224,9 +212,7 @@
                "Mark the document as actively in edit, so caret flashes when the window first opens.")
          (SETQ TSTREAM (OPENTEXTSTREAM TEXT (OR WINDOW 'Tedit)
                               NIL NIL PROPS))
-         (CL:UNLESS (WINDOWP WINDOW)
-             (SETQ WINDOW (CAR (GETTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
-                                      \WINDOW))))
+         (SETQ WINDOW (\TEDIT.PRIMARYW TSTREAM))
          (COND
             (DONTSPAWN                                       (* ; 
                                      "Either no processes running, or specifically not to spawn one.")
@@ -250,8 +236,57 @@
                    (TTY.PROCESS PROC))
                PROC])
 
-(COERCETEXTOBJ
-  [LAMBDA (TSTREAM TYPE OUTPUTSTREAM)                        (* ; "Edited 13-Jan-2024 20:01 by rmk")
+(TEXTSTREAM
+  [LAMBDA (TSTREAM? NOERROR)                                 (* ; "Edited 20-Mar-2024 08:51 by rmk")
+                                                             (* ; "Edited 24-Mar-2023 18:01 by rmk")
+                                                             (* jds "11-Jul-85 12:06")
+
+    (* ;; "Convert from any designator of a textstream to that  textstream.")
+
+    (LET (TS WINDOW X)
+         [SETQ TS (if (type? TEXTSTREAM TSTREAM?)
+                      then TSTREAM?
+                    elseif (type? TEXTOBJ TSTREAM?)
+                      then (FGETTOBJ TSTREAM? STREAMHINT)
+                    elseif (SETQ WINDOW (if (WINDOWP TSTREAM?)
+                                          elseif (PROCESSP TSTREAM?)
+                                            then (PROCESS.WINDOW TSTREAM?)
+                                          elseif (DISPLAYSTREAMP TSTREAM?)
+                                            then (WFROMDS TSTREAM?)))
+                      then (if (type? TEXTSTREAM (SETQ X (fetch (TEXTWINDOW WTEXTSTREAM) of WINDOW)))
+                               then X
+                             elseif (type? TEXTOBJ (SETQ X (fetch (TEXTWINDOW WTEXTOBJ) of WINDOW)))
+                               then (FGETTOBJ X STREAMHINT))
+                    elseif (type? SELECTION TSTREAM?)
+                      then (CL:WHEN (type? TEXTOBJ (SETQ X (FGETSEL TSTREAM? SELTEXTOBJ)))
+                                  (FGETTOBJ X STREAMHINT]
+         (OR TS (CL:UNLESS NOERROR (ERROR TSTREAM? "is not a Tedit document"])
+
+(TEXTSTREAMP
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 20-Mar-2024 07:55 by rmk")
+                                                             (* jds " 3-Apr-84 14:34")
+
+    (* ;; "Returns the TSTREAM if it is a text stream, else NIL.  Use TEXTSTREAM for coercion.")
+
+    (CL:WHEN (type? TEXTSTREAM TSTREAM)
+           TSTREAM])
+
+(TEDITMENUP
+  [LAMBDA (WINDOW TITLE)                                     (* ; "Edited 15-Mar-2024 15:39 by rmk")
+                                                             (* ; "Edited  7-Dec-2023 21:06 by rmk")
+                                                             (* ; "Edited 20-Sep-2023 22:36 by rmk")
+                                                             (* ; "Edited 10-Apr-2023 10:14 by rmk")
+    (CL:WHEN (AND (WINDOWP WINDOW)
+                  (WINDOWPROP WINDOW 'TEDITMENU)
+                  (fetch (TEXTWINDOW WTEXTOBJ) of WINDOW)
+                  (CL:IF TITLE
+                      (STRING.EQUAL TITLE (WINDOWPROP WINDOW 'TITLE))
+                      T))
+        (WINDOWPROP WINDOW 'TITLE))])
+
+(COERCETEXTSTREAM
+  [LAMBDA (TSTREAM TYPE OUTPUTSTREAM)                        (* ; "Edited 17-Mar-2024 12:05 by rmk")
+                                                             (* ; "Edited 13-Jan-2024 20:01 by rmk")
                                                              (* ; "Edited 26-Dec-2023 12:29 by rmk")
                                                              (* ; "Edited 18-Dec-2023 23:13 by rmk")
                                                              (* ; "Edited 21-Nov-2023 00:08 by rmk")
@@ -270,7 +305,7 @@
          (SETQ TSTREAM (TEXTSTREAM TEXTOBJ))
          (SELECTQ TYPE
              ((STRINGP STRING) 
-                  (\TEXTSETFILEPTR TSTREAM 0)                (* ; 
+                  (\TEDIT.TEXTSETFILEPTR TSTREAM 0)          (* ; 
                                       "This gets underneath the OPENP test of the generic SETFILEPTR")
 
                   (* ;; "Allocstring presumably errors if greater than max stringsize.")
@@ -311,7 +346,8 @@
              NIL])
 
 (TEDIT.CONCAT
-  [LAMBDA (TSTREAMS SEPARATOR)                               (* ; "Edited 18-Jan-2024 00:03 by rmk")
+  [LAMBDA (TSTREAMS SEPARATOR)                               (* ; "Edited 17-Mar-2024 00:21 by rmk")
+                                                             (* ; "Edited 18-Jan-2024 00:03 by rmk")
 
     (* ;; "Produces a textstream that contains the concatenation of all of the TSTREAMS, separated by SEPARATOR.  Any stream that is not already a text stream is first converted to a plaintext stream.  SEPARATOR if provided as a string or character is inserted between the files.")
 
@@ -343,7 +379,7 @@
                                                              (* ; "Dummy")
                  do (CL:WHEN (FGETTOBJ TSOBJ FORMATTEDP)
                            (FSETTOBJ CTEXTOBJ FORMATTEDP T))
-                    (for PC NEWPIECE inpieces (\FIRSTPIECE TSOBJ)
+                    (for PC NEWPIECE inpieces (\TEDIT.FIRSTPIECE TSOBJ)
                        do (SETQ NEWPIECE (\TEDIT.COPYPIECE PC TSOBJ CTEXTOBJ NIL 'COPY))
                           (FSETPC PREVPC NEXTPIECE NEWPIECE)
                           (FSETPC NEWPIECE PREVPIECE PREVPC)
@@ -351,130 +387,31 @@
 
                     (* ;; "Information for pageframe adjustments")
 
-                    (push INITIALFILEPIECES (\FIRSTPIECE TSOBJ))
+                    (push INITIALFILEPIECES (\TEDIT.FIRSTPIECE TSOBJ))
                     (CL:WHEN SEPARATOR
                         (CL:UNLESS (EQ TSOBJ LASTTOBJ)
                             (SETQ PREVPC (\TEDIT.MAKE.STRINGPIECE PREVPC SEPARATOR))))
-                 finally (\INSERTPIECES (NEXTPIECE FIRSTPC)
+                 finally (\TEDIT.INSERTPIECES (NEXTPIECE FIRSTPC)
                                 NIL CTEXTOBJ)
                        (\TEDIT.CONCAT.PAGEFRAMES CTEXTOBJ TSTEXTOBJECTS (DREVERSE INITIALFILEPIECES))
                        (\TEDIT.UNIQUIFY.ALL CTEXTOBJ)))
           CSTREAM])
 
-(\TEDIT.CONCAT.PAGEFRAMES
-  [LAMBDA (CTEXTOBJ TSTEXTOBJECTS INITIALFILEPIECES)         (* ; "Edited 18-Jan-2024 22:16 by rmk")
-
-    (* ;; "The individual files may have their own heading paragraphs specified in their pieces and in their pageframes.  Since the heading types are global for the file, we have to make sure the any conflicting heading-type names are made distinct within the combined toplevel pageframe, and that any new names are propagated into the FMTSPEC's of the pieces within each file.")
-
-    (* ;; 
-  "Scan all the first/left/right heading frames, grouping all of the heading types by their regions.")
-
-    (LET (FIRSTREGIONS LEFTREGIONS RIGHTREGIONS FIRSTNEW LEFTNEW RIGHTNEW)
-
-         (* ;; "Index first, even, odd types by region.  Keep the lists separate for the final step of building the concat pageframes.")
-
-         (* ;; "If the same region is appears in both left and right headings, presumably the type-names will be different--and we maintain that difference as we canonicalize. ")
-
-         (for TSOBJ FRAMES in TSTEXTOBJECTS do (SETQ FRAMES (GETTOBJ TSOBJ TXTPAGEFRAMES))
-                                               (SETQ FIRSTREGIONS (\TEDIT.GET.PAGE.HEADINGS
-                                                                   (CAR FRAMES)
-                                                                   FIRSTREGIONS))
-                                               (SETQ LEFTREGIONS (\TEDIT.GET.PAGE.HEADINGS
-                                                                  (CADR FRAMES)
-                                                                  LEFTREGIONS))
-                                               (SETQ RIGHTREGIONS (\TEDIT.GET.PAGE.HEADINGS
-                                                                   (CADDR FRAMES)
-                                                                   RIGHTREGIONS)))
-
-         (* ;; "Invert these to map all encountered types with a given region into a canonical type with that region. ")
-
-         [for R in FIRSTREGIONS as I from 1
-            do (for TYPE in (CDR R) do (push FIRSTNEW (LIST TYPE (PACK* 'HeadingF I)
-                                                            (CAR R]
-         [for R in LEFTREGIONS as I from 1
-            do (for TYPE in (CDR R) do (push LEFTNEW (LIST TYPE (PACK* 'HeadingL I)
-                                                           (CAR R]
-         [for R in RIGHTREGIONS as I from 1
-            do (for TYPE in (CDR R) do (push RIGHTNEW (LIST TYPE (PACK* 'HeadingR I)
-                                                            (CAR R]
-
-         (* ;; "Replace the type in each heading piece to its canonical type. Presumably the input typenames were sorted by first/left/right, so a given name only appears in one of the list.  So we can append.")
-
-         [for PC PPARALOOKS (ALLNEW _ (APPEND FIRSTNEW LEFTNEW RIGHTNEW)) inpieces (\FIRSTPIECE
-                                                                                    CTEXTOBJ)
-            eachtime (SETQ PPARALOOKS (PPARALOOKS PC)) when (EQ 'PAGEHEADING (fetch (FMTSPEC 
-                                                                                          FMTPARATYPE
-                                                                                           )
-                                                                                of PPARALOOKS))
-            do (FSETPC PC PPARALOOKS (create FMTSPEC using PPARALOOKS FMTPARASUBTYPE _
-                                                           (CADR (ASSOC (fetch (FMTSPEC 
-                                                                                      FMTPARASUBTYPE)
-                                                                           of PPARALOOKS)
-                                                                        ALLNEW]
-
-         (* ;; "Finally, build the pageframes for the new types and their regions. We take the page frame of the first TSOBJ as the base pattern")
-
-         [SETQ CPAGEFRAME (\TEDIT.PARSE.PAGEFRAMES (\TEDIT.UNPARSE.PAGEFRAMES (FGETTOBJ (CAR 
-                                                                                        TSTEXTOBJECTS
-                                                                                             )
-                                                                                     TXTPAGEFRAMES]
-         (\TEDIT.CONCAT.INSTALL.HEADINGS (CAR CPAGEFRAME)
-                FIRSTNEW)
-         (\TEDIT.CONCAT.INSTALL.HEADINGS (CADR CPAGEFRAME)
-                LEFTNEW)
-         (\TEDIT.CONCAT.INSTALL.HEADINGS (CADDR CPAGEFRAME)
-                RIGHTNEW)
-         (FSETTOBJ CTEXTOBJ TXTPAGEFRAMES CPAGEFRAME])
-
-(\TEDIT.GET.PAGE.HEADINGS
-  [LAMBDA (PAGEREGION HEADLIST)                              (* ; "Edited 18-Jan-2024 21:36 by rmk")
-
-    (* ;; "Produces an ALIST that maps each different heading region to a list of heading types that have that region.  All of those heading types can be reduced to a single type.")
-
-    (CL:WHEN (EQ 'PAGE (fetch (PAGEREGION REGIONFILLMETHOD) of PAGEREGION))
-        [for PH in (fetch (PAGEREGION REGIONSUBBOXES) of PAGEREGION)
-           when [AND (EQ 'HEADING (fetch (PAGEREGION REGIONFILLMETHOD) of PH))
-                     (EQ 'HEADINGTYPE (CAR (fetch (PAGEREGION REGIONLOCALINFO) of PH]
-           do (pushnew [CDR (OR (SASSOC (fetch (PAGEREGION REGIONSPEC) of PH)
-                                       HEADLIST)
-                                (CAR (PUSH HEADLIST (CONS (fetch (PAGEREGION REGIONSPEC) of PH]
-                     (CADR (fetch (PAGEREGION REGIONLOCALINFO) of PH]
-        HEADLIST)])
-
-(\TEDIT.CONCAT.INSTALL.HEADINGS
-  [LAMBDA (PAGEREGION NEWTYPES)                              (* ; "Edited 18-Jan-2024 22:02 by rmk")
-
-    (* ;; 
-    "Smash headings representing NEWTYPES into PAGEREGION, removing any headings previously there.")
-
-    (CL:WHEN (EQ 'PAGE (fetch (PAGEREGION REGIONFILLMETHOD) of PAGEREGION))
-
-        (* ;; "Replace all the old headings with the new ones, keeping all other subboxes")
-
-        (* ;; "NEWTYPES is the list that maps old types to new types.  We first reduce it to just a new-type region list.")
-
-        [change (fetch (PAGEREGION REGIONSUBBOXES) of PAGEREGION)
-               (NCONC (for SPF in DATUM unless (EQ 'HEADING (fetch (PAGEREGION REGIONFILLMETHOD)
-                                                               of SPF)) collect SPF)
-                      (for R in (for NT in NEWTYPES unless (ASSOC (CADR NT)
-                                                                  $$VAL) collect (CDR NT))
-                         collect (create PAGEREGION
-                                        REGIONFILLMETHOD _ 'HEADING
-                                        REGIONLOCALINFO _ (LIST 'HEADINGTYPE (CAR R))
-                                        REGIONSPEC _ (CADR R])])
-
 (TEDITSTRING
   [LAMBDA (TEXT WINDOW DONTSPAWN PROPS)
 
-(* ;;; "Edited 16-Dec-2023 12:06 by rmk")
+(* ;;; "Edited 31-Mar-2024 10:13 by rmk: If TEXT is NIL, don't coerce it to %"NIL%"")
+
+(* ;;; "Edited 31-Mar-2024 10:12 by rmk")
 
 (* ;;; "Edited  9-May-2023 21:55 by rmk")
 
 (* ;;; "Edited 23-May-2022 15:52 by rmk")
 
-(* ;;; "Edited 19-May-2022 22:46 by rmk: An interface function to replace calls to TEDIT when the text argument may be the string to be edited rather than the name of a file.  This enables the transition that gets TEDIT aligned with the convention that strings, as well as litatoms, are file names")
+(* ;;; "Edited 19-May-2022 22:46 by rmk: An interface function to replace calls to TEDIT when the text argument may be the string to be edited rather than the name of a file.  This enables the transition that gets TEDIT aligned with the convention that strings, as well as litatoms, are file names.")
 
-    (SETQ TEXT (MKSTRING TEXT))
+    (CL:WHEN TEXT
+        (SETQ TEXT (MKSTRING TEXT)))
     (TEDIT (LET ((TSTR (OPENTEXTSTREAM)))
                 (TEDIT.INSERT TSTR TEXT 1 NIL T)
                 (TEDIT.SETSEL TSTR 1 0 'LEFT)
@@ -497,47 +434,9 @@
 
     (TEXTSTREAM (TEDIT FILE WINDOW NIL `(READONLY T LEAVETTY T FONT ,DEFAULTFONT])
 
-(TEDIT.CHARWIDTH
-  [LAMBDA (CH FONT TERMSA)                                   (* jds "22-OCT-83 19:32")
-          
-          (* Returns the width of CH in FONT printed according to any special printing 
-          instructions in CHARTABLE TERMSA)
-
-    (COND
-       (TERMSA                                               (* There IS a TERMTABLE to account for)
-              (SELECTC (fetch CCECHO of (\SYNCODE TERMSA CH))
-                  (INDICATE.CCE (IPLUS (COND
-                                          ((IGREATERP CH 127)(* META character)
-                                           (SETQ CH (LOGAND CH 127))
-                                           (CHARWIDTH (CHARCODE %#)
-                                                  FONT))
-                                          (T 0))
-                                       (COND
-                                          ((ILESSP CH 32)    (* CONTROL character)
-                                           (SETQ CH (LOGOR CH 64))
-                                           (CHARWIDTH (CHARCODE ^)
-                                                  FONT))
-                                          (T 0))
-                                       (CHARWIDTH CH FONT)))
-                  (SIMULATE.CCE (SELCHARQ CH
-                                     ((EOL CR LF) 
-                                          (IMAX 6 (CHARWIDTH CH FONT)))
-                                     (ESCAPE (CHARWIDTH (CHARCODE $)
-                                                    FONT))
-                                     (BELL 0)
-                                     (TAB 36)
-                                     (CHARWIDTH CH FONT)))
-                  (REAL.CCE (CHARWIDTH CH FONT))
-                  (IGNORE.CCE 0)
-                  (SHOULDNT)))
-       (T (* The usual case is to treat every character as a graphic.)
-          (SELCHARQ CH
-               (CR (IMAX 6 (CHARWIDTH CH FONT)))
-               (TAB 36)
-               (CHARWIDTH CH FONT])
-
 (TEDIT.COPY
-  [LAMBDA (FROM TO)                                          (* ; "Edited 20-Feb-2024 17:03 by rmk")
+  [LAMBDA (FROM TO)                                          (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited 20-Feb-2024 17:03 by rmk")
                                                              (* ; "Edited  1-Feb-2024 20:37 by rmk")
                                                              (* ; "Edited 20-May-2023 18:47 by rmk")
                                                              (* ; "Edited 15-May-2023 22:11 by rmk")
@@ -551,8 +450,8 @@
         (PROG ((TOBJ (GETSEL TO SELTEXTOBJ))
                (FOBJ (GETSEL FROM SELTEXTOBJ))
                FROMPIECES)
-              (\SHOWSEL FROM NIL)                            (* ; "Turn off any current highlighting")
-              (\SHOWSEL TO NIL)
+              (\TEDIT.SHOWSEL FROM NIL)                      (* ; "Turn off any current highlighting")
+              (\TEDIT.SHOWSEL TO NIL)
 
          (* ;; "Install FROM pieces  at TO, first clearing out the blue pending delete.")
 
@@ -560,7 +459,7 @@
 
          (* ;; "Grab (a copy of) the source pieces, if image object allows")
 
-              (SETQ FROMPIECES (\SELPIECES.COPY (\SELPIECES FROM)
+              (SETQ FROMPIECES (\TEDIT.SELPIECES.COPY (\TEDIT.SELPIECES FROM)
                                       'COPY TOBJ FOBJ))
               (CL:UNLESS FROMPIECES (RETURN))
 
@@ -579,10 +478,10 @@
 
          (* ;; "")
 
-              (\SHOWSEL TO NIL)                              (* ; 
+              (\TEDIT.SHOWSEL TO NIL)                        (* ; 
                                                        "Take down anything that might thave appeared")
-              (\FIXSEL TO TOBJ)
-              (\SHOWSEL TO T)))])
+              (\TEDIT.FIXSEL TO TOBJ)
+              (\TEDIT.SHOWSEL TO T)))])
 
 (TEDIT.DELETE
   [LAMBDA (STREAM SEL LEN LEAVECARETLOOKS)                   (* ; "Edited 23-May-2023 12:57 by rmk")
@@ -675,23 +574,9 @@
                     "Wait until the Edit process has had a chance to go away before continuing here.")
                                                                                (DISMISS))))])
 
-(TEDIT.DO.BLUEPENDINGDELETE
-  [LAMBDA (SEL TEXTOBJ)                                      (* ; "Edited 24-Dec-2023 00:01 by rmk")
-                                                             (* ; "Edited  8-Jul-2023 22:48 by rmk")
-                                                             (* ; "Edited  4-May-2023 00:05 by rmk")
-                                                             (* ; "Edited 22-Apr-2023 18:31 by rmk")
-                                                             (* ; "Edited 29-May-91 18:21 by jds")
-
-    (* ;; "Check for blue-pending-delete, and do it if it's there.")
-
-    (* ;; "Return T if the deletion was made.  For people who need to know")
-
-    (CL:WHEN (GETTOBJ TEXTOBJ BLUEPENDINGDELETE)
-        (TEDIT.RESET.EXTEND.PENDING.DELETE SEL)              (* ; "Make it a normal selection again.")
-        (\TEDIT.DELETE TEXTOBJ SEL T))])
-
 (TEDIT.MOVE
-  [LAMBDA (FROM TO)                                          (* ; "Edited  5-Mar-2024 00:22 by rmk")
+  [LAMBDA (FROM TO)                                          (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited  5-Mar-2024 00:22 by rmk")
                                                              (* ; "Edited  1-Mar-2024 20:13 by rmk")
                                                              (* ; "Edited 20-Feb-2024 20:07 by rmk")
                                                              (* ; "Edited 15-Feb-2024 21:27 by rmk")
@@ -712,8 +597,8 @@
         (PROG ((TOBJ (GETSEL TO SELTEXTOBJ))
                (FOBJ (GETSEL FROM SELTEXTOBJ))
                FROMPIECES)
-              (\SHOWSEL FROM NIL)                            (* ; "Turn off any current highlighting")
-              (\SHOWSEL TO NIL)
+              (\TEDIT.SHOWSEL FROM NIL)                      (* ; "Turn off any current highlighting")
+              (\TEDIT.SHOWSEL TO NIL)
 
          (* ;; "Install FROM pieces  at TO, first clearing out the blue pending delete.  The move-event may be a composite of both.  If we are doing a move in the same textobject, the TO selection (= SEL for  a CTRL-SHIFIT SELOPERATION) must be updated to reflect a preceding FROM-deletion.")
 
@@ -721,7 +606,7 @@
 
          (* ;; "Grab (a copy of) the source pieces, if image objects allow copying")
 
-              (SETQ FROMPIECES (\SELPIECES.COPY (\SELPIECES FROM)
+              (SETQ FROMPIECES (\TEDIT.SELPIECES.COPY (\TEDIT.SELPIECES FROM)
                                       'COPY TOBJ FOBJ))
               (CL:UNLESS FROMPIECES (RETURN))
 
@@ -752,8 +637,8 @@
                        (\TEDIT.REPLACE.SELPIECES FROMPIECES TOBJ TO)
                 else (\TEDIT.INSERT.SELPIECES FROMPIECES TOBJ TO))
               (\TEDIT.SET.SEL.LOOKS TO 'NORMAL)
-              (\FIXSEL TO TOBJ)
-              (\SHOWSEL TO T)
+              (\TEDIT.FIXSEL TO TOBJ)
+              (\TEDIT.SHOWSEL TO T)
 
          (* ;; "Create a :Move event that combines the insert with the prior delete/replace.If FOBJ=TOBJ, the delete and insert happened in the same document.   If the events happened in different documents, the delete event is already in FOBJ and we leave it there so that event can be undone by a separate undo action in FOBJ.  But we still include in the TOBJ move event:  if we undo the move, we certainly want to undo the insert.  And if the delete event is still the next undoing candidate in FOBJ, it makes sense to do the FOBJ undo, otherwise not.  \TEDIT.UNDO.MOVE figures this out.")
 
@@ -789,64 +674,195 @@
                                         (TAB 36)
                                         (CHARWIDTH CH FONT])
 
+(TEDIT.CHARWIDTH
+  [LAMBDA (CH FONT TERMSA)                                   (* jds "22-OCT-83 19:32")
+          
+          (* Returns the width of CH in FONT printed according to any special printing 
+          instructions in CHARTABLE TERMSA)
+
+    (COND
+       (TERMSA                                               (* There IS a TERMTABLE to account for)
+              (SELECTC (fetch CCECHO of (\SYNCODE TERMSA CH))
+                  (INDICATE.CCE (IPLUS (COND
+                                          ((IGREATERP CH 127)(* META character)
+                                           (SETQ CH (LOGAND CH 127))
+                                           (CHARWIDTH (CHARCODE %#)
+                                                  FONT))
+                                          (T 0))
+                                       (COND
+                                          ((ILESSP CH 32)    (* CONTROL character)
+                                           (SETQ CH (LOGOR CH 64))
+                                           (CHARWIDTH (CHARCODE ^)
+                                                  FONT))
+                                          (T 0))
+                                       (CHARWIDTH CH FONT)))
+                  (SIMULATE.CCE (SELCHARQ CH
+                                     ((EOL CR LF) 
+                                          (IMAX 6 (CHARWIDTH CH FONT)))
+                                     (ESCAPE (CHARWIDTH (CHARCODE $)
+                                                    FONT))
+                                     (BELL 0)
+                                     (TAB 36)
+                                     (CHARWIDTH CH FONT)))
+                  (REAL.CCE (CHARWIDTH CH FONT))
+                  (IGNORE.CCE 0)
+                  (SHOULDNT)))
+       (T (* The usual case is to treat every character as a graphic.)
+          (SELCHARQ CH
+               (CR (IMAX 6 (CHARWIDTH CH FONT)))
+               (TAB 36)
+               (CHARWIDTH CH FONT])
+)
+(DEFINEQ
+
 (TEXTOBJ
-  [LAMBDA (STREAM NOERROR)                                   (* ; "Edited  7-Mar-2024 08:14 by rmk")
-                                                             (* ; "Edited 16-Jun-2023 08:21 by rmk")
-                                                             (* ; "Edited  6-Jun-2023 15:23 by rmk")
-                                                             (* ; "Edited 10-Apr-2023 09:32 by rmk")
-                                                             (* ; "Edited  5-Apr-2023 15:12 by rmk")
-                                                             (* ; "Edited 24-Mar-2023 18:01 by rmk")
-                                                             (* jds "11-Jul-85 12:06")
-
-    (* ;; "Convert from any designator of a textobj to that  textobj")
-
-    (LET (TOBJ)
-         (if (type? TEXTOBJ STREAM)
-             then STREAM
-           else (SETQ TOBJ (if [AND (type? STREAM STREAM)
-                                    (type? TEXTOBJ (SETQ TOBJ (fetch (TEXTSTREAM TEXTOBJ)
-                                                                 of STREAM]
-                               then 
-                                    (* ;; 
-                                "Text stream - test TEXTOBJ to distinguish displaystream case below.")
-
-                                    TOBJ
-                             else (WINDOWP STREAM)
-                               then (WINDOWPROP STREAM 'TEXTOBJ)
-                             elseif (AND (PROCESSP STREAM)
-                                         (PROCESS.WINDOW STREAM))
-                               then                          (* ; "It's an edit PROCESS")
-                                    (WINDOWPROP (PROCESS.WINDOW STREAM)
-                                           'TEXTOBJ)
-                             elseif (DISPLAYSTREAMP STREAM)
-                               then (WINDOWPROP TOBJ 'TEXTOBJ)
-                             elseif (type? SELECTION STREAM)
-                               then (GETSEL STREAM SELTEXTOBJ)))
-                (if (type? TEXTOBJ TOBJ)
-                    then TOBJ
-                  elseif (NOT NOERROR)
-                    then (ERROR STREAM "is not a Tedit document"])
-
-(TEDITMENUP
-  [LAMBDA (WINDOW TITLE)                                     (* ; "Edited  7-Dec-2023 21:06 by rmk")
-                                                             (* ; "Edited 20-Sep-2023 22:36 by rmk")
-                                                             (* ; "Edited 10-Apr-2023 10:14 by rmk")
-    (CL:WHEN (AND (WINDOWP WINDOW)
-                  (WINDOWPROP WINDOW 'TEDITMENU)
-                  (WINDOWPROP WINDOW 'TEXTOBJ)
-                  (CL:IF TITLE
-                      (STRING.EQUAL TITLE (WINDOWPROP WINDOW 'TITLE))
-                      T))
-        (WINDOWPROP WINDOW 'TITLE))])
-
-(TEXTSTREAM
-  [LAMBDA (STREAM NOERROR)                                   (* ; "Edited  7-Mar-2024 08:11 by rmk")
-                                                             (* ; "Edited 21-Aug-2022 08:14 by rmk")
+  [LAMBDA (TEXTOBJ? NOERROR)                                 (* ; "Edited 20-Mar-2024 07:36 by rmk")
                                                             (* ; "Edited 12-Jun-90 17:50 by mitani")
-                                                             (* ; 
-                                                           "Force a textobj or stream to be a stream")
-    (LET ((TOBJ (TEXTOBJ STREAM NOERROR)))
-         (CL:WHEN TOBJ (GETTOBJ TOBJ STREAMHINT])
+    (if (type? TEXTOBJ TEXTOBJ?)
+        then TEXTOBJ?
+      else (LET ((TSTRM (TEXTSTREAM TEXTOBJ? NOERROR)))
+                (CL:WHEN TSTRM
+                    (fetch (TEXTSTREAM TEXTOBJ) of TSTRM))])
+
+(COERCETEXTOBJ
+  [LAMBDA (TSTREAM TYPE OUTPUTSTREAM)                        (* ; "Edited 20-Mar-2024 08:02 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:05 by rmk")
+                                                             (* ; "Edited 13-Jan-2024 20:01 by rmk")
+                                                             (* ; "Edited 26-Dec-2023 12:29 by rmk")
+                                                             (* ; "Edited 18-Dec-2023 23:13 by rmk")
+                                                             (* ; "Edited 21-Nov-2023 00:08 by rmk")
+                                                             (* ; "Edited 15-Sep-2023 00:08 by rmk")
+                                                             (* ; "Edited 15-Aug-2023 20:20 by rmk")
+                                                             (* ; "Edited  8-May-2023 13:25 by rmk")
+                                                             (* ; "Edited  4-May-2023 12:13 by rmk")
+                                                             (* ; "Edited 11-Jun-99 15:10 by rmk:")
+                                                             (* ; "Edited 18-Apr-93 23:42 by jds")
+
+    (* ;; "Documented entry, to be deprecated in favor of COERCEDTEXTSTREAM.")
+
+    (COERCETEXTSTREAM TSTREAM TYPE OUTPUTSTREAM])
+)
+(DEFINEQ
+
+(\TEDIT.CONCAT.PAGEFRAMES
+  [LAMBDA (CTEXTOBJ TSTEXTOBJECTS INITIALFILEPIECES)         (* ; "Edited 17-Mar-2024 13:20 by rmk")
+                                                             (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited 18-Jan-2024 22:16 by rmk")
+
+    (* ;; "The individual files may have their own heading paragraphs specified in their pieces and in their pageframes.  Since the heading types are global for the file, we have to make sure the any conflicting heading-type names are made distinct within the combined toplevel pageframe, and that any new names are propagated into the FMTSPEC's of the pieces within each file.")
+
+    (* ;; 
+  "Scan all the first/left/right heading frames, grouping all of the heading types by their regions.")
+
+    (LET (FIRSTREGIONS LEFTREGIONS RIGHTREGIONS FIRSTNEW LEFTNEW RIGHTNEW CPAGEFRAME)
+
+         (* ;; "Index first, even, odd types by region.  Keep the lists separate for the final step of building the concat pageframes.")
+
+         (* ;; "If the same region is appears in both left and right headings, presumably the type-names will be different--and we maintain that difference as we canonicalize. ")
+
+         (for TSOBJ FRAMES in TSTEXTOBJECTS do (SETQ FRAMES (GETTOBJ TSOBJ TXTPAGEFRAMES))
+                                               (SETQ FIRSTREGIONS (\TEDIT.GET.PAGE.HEADINGS
+                                                                   (CAR FRAMES)
+                                                                   FIRSTREGIONS))
+                                               (SETQ LEFTREGIONS (\TEDIT.GET.PAGE.HEADINGS
+                                                                  (CADR FRAMES)
+                                                                  LEFTREGIONS))
+                                               (SETQ RIGHTREGIONS (\TEDIT.GET.PAGE.HEADINGS
+                                                                   (CADDR FRAMES)
+                                                                   RIGHTREGIONS)))
+
+         (* ;; "Invert these to map all encountered types with a given region into a canonical type with that region. ")
+
+         [for R in FIRSTREGIONS as I from 1
+            do (for TYPE in (CDR R) do (push FIRSTNEW (LIST TYPE (PACK* 'HeadingF I)
+                                                            (CAR R]
+         [for R in LEFTREGIONS as I from 1
+            do (for TYPE in (CDR R) do (push LEFTNEW (LIST TYPE (PACK* 'HeadingL I)
+                                                           (CAR R]
+         [for R in RIGHTREGIONS as I from 1
+            do (for TYPE in (CDR R) do (push RIGHTNEW (LIST TYPE (PACK* 'HeadingR I)
+                                                            (CAR R]
+
+         (* ;; "Replace the type in each heading piece to its canonical type. Presumably the input typenames were sorted by first/left/right, so a given name only appears in one of the list.  So we can append.")
+
+         [for PC PPARALOOKS (ALLNEW _ (APPEND FIRSTNEW LEFTNEW RIGHTNEW)) inpieces (\TEDIT.FIRSTPIECE
+                                                                                    CTEXTOBJ)
+            eachtime (SETQ PPARALOOKS (PPARALOOKS PC)) when (EQ 'PAGEHEADING (fetch (FMTSPEC 
+                                                                                          FMTPARATYPE
+                                                                                           )
+                                                                                of PPARALOOKS))
+            do (FSETPC PC PPARALOOKS (create FMTSPEC using PPARALOOKS FMTPARASUBTYPE _
+                                                           (CADR (ASSOC (fetch (FMTSPEC 
+                                                                                      FMTPARASUBTYPE)
+                                                                           of PPARALOOKS)
+                                                                        ALLNEW]
+
+         (* ;; "Finally, build the pageframes for the new types and their regions. We take the page frame of the first TSOBJ as the base pattern")
+
+         [SETQ CPAGEFRAME (\TEDIT.PARSE.PAGEFRAMES (\TEDIT.UNPARSE.PAGEFRAMES (FGETTOBJ (CAR 
+                                                                                        TSTEXTOBJECTS
+                                                                                             )
+                                                                                     TXTPAGEFRAMES]
+         (\TEDIT.CONCAT.INSTALL.HEADINGS (CAR CPAGEFRAME)
+                FIRSTNEW)
+         (\TEDIT.CONCAT.INSTALL.HEADINGS (CADR CPAGEFRAME)
+                LEFTNEW)
+         (\TEDIT.CONCAT.INSTALL.HEADINGS (CADDR CPAGEFRAME)
+                RIGHTNEW)
+         (FSETTOBJ CTEXTOBJ TXTPAGEFRAMES CPAGEFRAME])
+
+(\TEDIT.GET.PAGE.HEADINGS
+  [LAMBDA (PAGEREGION HEADLIST)                              (* ; "Edited 18-Jan-2024 21:36 by rmk")
+
+    (* ;; "Produces an ALIST that maps each different heading region to a list of heading types that have that region.  All of those heading types can be reduced to a single type.")
+
+    (CL:WHEN (EQ 'PAGE (fetch (PAGEREGION REGIONFILLMETHOD) of PAGEREGION))
+        [for PH in (fetch (PAGEREGION REGIONSUBBOXES) of PAGEREGION)
+           when [AND (EQ 'HEADING (fetch (PAGEREGION REGIONFILLMETHOD) of PH))
+                     (EQ 'HEADINGTYPE (CAR (fetch (PAGEREGION REGIONLOCALINFO) of PH]
+           do (pushnew [CDR (OR (SASSOC (fetch (PAGEREGION REGIONSPEC) of PH)
+                                       HEADLIST)
+                                (CAR (PUSH HEADLIST (CONS (fetch (PAGEREGION REGIONSPEC) of PH]
+                     (CADR (fetch (PAGEREGION REGIONLOCALINFO) of PH]
+        HEADLIST)])
+
+(\TEDIT.CONCAT.INSTALL.HEADINGS
+  [LAMBDA (PAGEREGION NEWTYPES)                              (* ; "Edited 18-Jan-2024 22:02 by rmk")
+
+    (* ;; 
+    "Smash headings representing NEWTYPES into PAGEREGION, removing any headings previously there.")
+
+    (CL:WHEN (EQ 'PAGE (fetch (PAGEREGION REGIONFILLMETHOD) of PAGEREGION))
+
+        (* ;; "Replace all the old headings with the new ones, keeping all other subboxes")
+
+        (* ;; "NEWTYPES is the list that maps old types to new types.  We first reduce it to just a new-type region list.")
+
+        [change (fetch (PAGEREGION REGIONSUBBOXES) of PAGEREGION)
+               (NCONC (for SPF in DATUM unless (EQ 'HEADING (fetch (PAGEREGION REGIONFILLMETHOD)
+                                                               of SPF)) collect SPF)
+                      (for R in (for NT in NEWTYPES unless (ASSOC (CADR NT)
+                                                                  $$VAL) collect (CDR NT))
+                         collect (create PAGEREGION
+                                        REGIONFILLMETHOD _ 'HEADING
+                                        REGIONLOCALINFO _ (LIST 'HEADINGTYPE (CAR R))
+                                        REGIONSPEC _ (CADR R])])
+
+(\TEDIT.DO.BLUEPENDINGDELETE
+  [LAMBDA (SEL TEXTOBJ)                                      (* ; "Edited  9-Mar-2024 11:33 by rmk")
+                                                             (* ; "Edited 24-Dec-2023 00:01 by rmk")
+                                                             (* ; "Edited  8-Jul-2023 22:48 by rmk")
+                                                             (* ; "Edited  4-May-2023 00:05 by rmk")
+                                                             (* ; "Edited 22-Apr-2023 18:31 by rmk")
+                                                             (* ; "Edited 29-May-91 18:21 by jds")
+
+    (* ;; "Check for blue-pending-delete, and do it if it's there.")
+
+    (* ;; "Return T if the deletion was made.  For people who need to know")
+
+    (CL:WHEN (GETTOBJ TEXTOBJ BLUEPENDINGDELETE)
+        (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ)     (* ; "Make it a normal selection again.")
+        (\TEDIT.DELETE TEXTOBJ SEL T))])
 )
 (DEFINEQ
 
@@ -900,7 +916,8 @@
                TEXTLEN))])
 
 (TEDIT.RPLCHARCODE
-  [LAMBDA (TSTREAM N NEWCHARCODE NEWCHARLOOKS)               (* ; "Edited 29-Dec-2023 11:50 by rmk")
+  [LAMBDA (TSTREAM N NEWCHARCODE NEWCHARLOOKS)               (* ; "Edited 17-Mar-2024 00:24 by rmk")
+                                                             (* ; "Edited 29-Dec-2023 11:50 by rmk")
                                                              (* ; "Edited  7-Dec-2023 16:01 by rmk")
                                                              (* ; "Edited  1-Dec-2023 21:52 by rmk")
                                                              (* ; "Edited  9-Nov-2023 15:53 by rmk")
@@ -929,9 +946,9 @@
 
          (* ;; "Chop off the suffix.  Unless N was last in PC, the piece containing is new.")
 
-         (\ALIGNEDPIECE (ADD1 N)
+         (\TEDIT.ALIGNEDPIECE (ADD1 N)
                 TEXTOBJ)
-         (SETQ PC (\ALIGNEDPIECE N TEXTOBJ))                 (* ; 
+         (SETQ PC (\TEDIT.ALIGNEDPIECE N TEXTOBJ))           (* ; 
                                                 "Chop off the prefix. PC is now the singleton target")
          (if (IMAGEOBJP NEWCHARCODE)
              then (FSETPC PC PBINABLE NIL)
@@ -958,7 +975,8 @@
          NEWCHARCODE])
 
 (TEDIT.NTHCHARCODE
-  [LAMBDA (TSTREAM N)                                        (* ; "Edited  1-Feb-2024 09:50 by rmk")
+  [LAMBDA (TSTREAM N)                                        (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited  1-Feb-2024 09:50 by rmk")
                                                              (* ; "Edited  8-Nov-2023 08:41 by rmk")
                                                              (* ; "Edited  4-Nov-2023 15:23 by rmk")
 
@@ -984,12 +1002,13 @@
                                    N 1)))]
          (CL:WHEN (AND (IGEQ N 1)
                        (ILEQ N (FGETTOBJ TEXTOBJ TEXTLEN)))
-             (\TEDIT.PIECE.NTHCHARCODE TEXTOBJ (\CHTOPC N TEXTOBJ T)
+             (\TEDIT.PIECE.NTHCHARCODE TEXTOBJ (\TEDIT.CHTOPC N TEXTOBJ T)
                     (IDIFFERENCE (ADD1 N)
                            START-OF-PIECE)))])
 
 (\TEDIT.PIECE.NTHCHARCODE
-  [LAMBDA (TEXTOBJ PC OFFSET)                                (* ; "Edited  1-Feb-2024 09:55 by rmk")
+  [LAMBDA (TEXTOBJ PC OFFSET)                                (* ; "Edited 22-Mar-2024 00:02 by rmk")
+                                                             (* ; "Edited  1-Feb-2024 09:55 by rmk")
                                                              (* ; "Edited  6-Jan-2024 16:36 by rmk")
                                                              (* ; "Edited 29-Dec-2023 11:55 by rmk")
                                                              (* ; "Edited  8-Dec-2023 22:54 by rmk")
@@ -1011,9 +1030,9 @@
                  (FATFILE1.PTYPE 
                       (\SETFILEPTR PCONTENTS (IPLUS (PFPOS PC)
                                                     (SUB1 OFFSET)))
-                      (LOGOR (LLSH (PCHARSET PC)
-                                   8)
-                             (BIN PCONTENTS)))
+                      (create WORD
+                             HIBYTE _ (PCHARSET PC)
+                             LOBYTE _ (BIN PCONTENTS)))
                  (FATFILE2.PTYPE 
                       (\SETFILEPTR PCONTENTS (IPLUS (PFPOS PC)
                                                     (UNFOLD (SUB1 OFFSET)
@@ -1040,7 +1059,8 @@
 (DEFINEQ
 
 (\TEDIT1
-  [LAMBDA (TSTREAM WINDOW UNSPAWNED)                         (* ; "Edited 22-Sep-2023 20:23 by rmk")
+  [LAMBDA (TSTREAM WINDOW UNSPAWNED)                         (* ; "Edited 17-Mar-2024 12:51 by rmk")
+                                                             (* ; "Edited 22-Sep-2023 20:23 by rmk")
                                                              (* ; "Edited 13-Sep-2023 22:37 by rmk")
                                                             (* ; "Edited 12-Jun-90 17:51 by mitani")
 
@@ -1049,7 +1069,7 @@
     (LET ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)))
          (\TEDIT.COMMAND.LOOP TEXTOBJ)                       (* ; "Run the editing engine")
          (CLOSEW WINDOW)                                     (* ; "Close the edit window")
-         (\TEXTCLOSEF TSTREAM)                               (* ; "Close the underlying files")
+         (\TEDIT.TEXTCLOSEF TSTREAM)                         (* ; "Close the underlying files")
          (replace (STREAM ACCESSBITS) of TSTREAM with BothBits)
                                                              (* ; 
                                                              "But leave the stream itself accessible")
@@ -1068,7 +1088,10 @@
                 (T TSTREAM)))])
 
 (\TEDIT.INSERT
-  [LAMBDA (INSERT SEL TEXTOBJ DONTSCROLL)                    (* ; "Edited 18-Feb-2024 15:30 by rmk")
+  [LAMBDA (INSERT SEL TEXTOBJ DONTSCROLL)                    (* ; "Edited 17-Mar-2024 11:41 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:32 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:36 by rmk")
+                                                             (* ; "Edited 18-Feb-2024 15:30 by rmk")
                                                              (* ; "Edited  9-Feb-2024 10:52 by rmk")
                                                              (* ; "Edited 28-Jan-2024 23:29 by rmk")
                                                              (* ; "Edited 14-Jan-2024 12:14 by rmk")
@@ -1104,21 +1127,23 @@
                (* ;; "Check for blue-pending-delete, and do it if it's there.")
 
                (CL:WHEN (FGETTOBJ TEXTOBJ BLUEPENDINGDELETE)
-                   (TEDIT.RESET.EXTEND.PENDING.DELETE SEL)   (* ; "Make it a normal selection again.")
+                   (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ)
+                                                             (* ; "Make it a normal selection again.")
                    (\TEDIT.DELETE TEXTOBJ SEL))
                (PROG ((CHNO (TEDIT.GETPOINT TEXTOBJ SEL))
                       (PANES (FGETTOBJ TEXTOBJ \WINDOW))
                       NCHARSADDED)
                      (CL:WHEN PANES
                          (CL:UNLESS DONTSCROLL (TEDIT.NORMALIZECARET TEXTOBJ SEL))
-                         (\SHOWSEL SEL NIL))                 (* ; "Turn off any old highlights")
+                         (\TEDIT.SHOWSEL SEL NIL))           (* ; "Turn off any old highlights")
                      (if (CHARCODEP INSERT)
                          then 
                               (* ;; "Meta,EOL causes a line break but not a paragraph break, in terms of formatting.  Original code converted to a formatted file on the first appearance of Meta,EOL, not clear why and so removed.")
 
                               (* ;; "FORM is not included in the EOL characters.  It breaks a line, but the first line after it doesn't necessarily have first-line margins.   CR/LF maybe should have been converted by plaintext reader or \TEXTBOUT.")
 
-                              [\INSERTCH INSERT CHNO TEXTOBJ (FMEMB INSERT (CHARCODE (EOL CR LF]
+                              [\TEDIT.INSERTCH INSERT CHNO TEXTOBJ (FMEMB INSERT
+                                                                          (CHARCODE (EOL CR LF]
                               (SETQ NCHARSADDED 1)
                        else 
                             (* ;; 
@@ -1127,9 +1152,9 @@
                             (if [thereis CH instring INSERT
                                    suchthat (FMEMB CH (CHARCODE (EOL CR LF]
                                 then [for CH instring INSERT as NCH# from CHNO
-                                        do (\INSERTCH CH NCH# TEXTOBJ (FMEMB CH
-                                                                             (CHARCODE (EOL CR LF]
-                              else (\INSERTCH INSERT CHNO TEXTOBJ))
+                                        do (\TEDIT.INSERTCH CH NCH# TEXTOBJ
+                                                  (FMEMB CH (CHARCODE (EOL CR LF]
+                              else (\TEDIT.INSERTCH INSERT CHNO TEXTOBJ))
                             (SETQ NCHARSADDED (NCHARS INSERT)))
                      (FSETTOBJ TEXTOBJ \DIRTY T)
 
@@ -1146,11 +1171,12 @@
                             'RIGHT)
                      (\TEDIT.SET.SEL.LOOKS SEL 'NORMAL)
                      (CL:UNLESS DONTSCROLL (TEDIT.NORMALIZECARET TEXTOBJ SEL))
-                     (\SHOWSEL SEL T)
+                     (\TEDIT.SHOWSEL SEL T)
                      (for PANE in PANES do (\TEDIT.SET.WINDOW.EXTENT TEXTOBJ PANE])])
 
 (\TEDIT.REPLACE.SELPIECES
-  [LAMBDA (SELPIECES TEXTOBJ SEL DONTDISPLAY)                (* ; "Edited 17-Feb-2024 16:34 by rmk")
+  [LAMBDA (SELPIECES TEXTOBJ SEL DONTDISPLAY)                (* ; "Edited 15-Mar-2024 13:32 by rmk")
+                                                             (* ; "Edited 17-Feb-2024 16:34 by rmk")
                                                              (* ; "Edited 27-May-2023 11:22 by rmk")
                                                              (* ; "Edited 24-May-2023 22:38 by rmk")
 
@@ -1158,7 +1184,7 @@
 
     (LET ((POINT (GETSEL SEL POINT))
           DELEVENT)                                          (* ; "Keep the SEL point in case ")
-         (\SHOWSEL SEL NIL)
+         (\TEDIT.SHOWSEL SEL NIL)
          (CL:WHEN (\TEDIT.DELETE TEXTOBJ SEL T)
              (SETQ DELEVENT (\TEDIT.LASTEVENT TEXTOBJ))
              (\TEDIT.INSERT.SELPIECES SELPIECES TEXTOBJ SEL DONTDISPLAY)
@@ -1175,11 +1201,12 @@
 
              (* ;; "Make sure SEL is off to guarantee turning on")
 
-             (\SHOWSEL SEL NIL))
-         (\SHOWSEL SEL T])
+             (\TEDIT.SHOWSEL SEL NIL))
+         (\TEDIT.SHOWSEL SEL T])
 
 (\TEDIT.INSERT.SELPIECES
-  [LAMBDA (SELPIECES TEXTOBJ TARGETSEL DONTDISPLAY)          (* ; "Edited 15-Feb-2024 23:58 by rmk")
+  [LAMBDA (SELPIECES TEXTOBJ TARGETSEL DONTDISPLAY)          (* ; "Edited 17-Mar-2024 11:43 by rmk")
+                                                             (* ; "Edited 15-Feb-2024 23:58 by rmk")
                                                              (* ; "Edited 13-Feb-2024 09:01 by rmk")
                                                              (* ; "Edited 11-Feb-2024 11:42 by rmk")
                                                              (* ; "Edited 29-Aug-2023 10:35 by rmk")
@@ -1192,16 +1219,15 @@
     (* ;; 
     "Insert SELPIECES into TEXTOBJ at TARGETSEL's caret. TARGETSEL can be a character position.")
 
-    (* ;; 
- "\INSERTCH.HISTORY uses the first piece to decide whether it is in a consecutive run of insertions.")
+    (* ;; "\TEDIT.INSERTCH.HISTORY uses the first piece to decide whether it is in a consecutive run of insertions.")
 
     (CL:WHEN (AND SELPIECES (fetch (SELPIECES SPFIRST) of SELPIECES))
         (LET ((INSCH# (TEDIT.GETPOINT NIL TARGETSEL))
               (SPLEN (fetch (SELPIECES SPLEN) of SELPIECES))
               (SPFIRST (fetch (SELPIECES SPFIRST) of SELPIECES))
               NEXTPC)
-             (SETQ NEXTPC (\ALIGNEDPIECE INSCH# TEXTOBJ))
-             (\INSERTPIECES SPFIRST NEXTPC TEXTOBJ)
+             (SETQ NEXTPC (\TEDIT.ALIGNEDPIECE INSCH# TEXTOBJ))
+             (\TEDIT.INSERTPIECES SPFIRST NEXTPC TEXTOBJ)
              (\TEDIT.DIFFUSE.PARALOOKS (PREVPIECE SPFIRST)
                     NEXTPC)
              (\TEDIT.UPDATE.LINES TEXTOBJ 'INSERTION INSCH# SPLEN DONTDISPLAY)
@@ -1282,34 +1308,38 @@
                                           (FGETTOBJ TEXTOBJ STREAMHINT])])
 
 (\TEDIT.RESTARTFN
-  [LAMBDA (TEXT WINDOW PROPS)                                (* ; "Edited 22-Sep-2023 20:31 by rmk")
+  [LAMBDA (TSTREAM WINDOW PROPS)                             (* ; "Edited 17-Mar-2024 16:58 by rmk")
+                                                             (* ; "Edited 22-Sep-2023 20:31 by rmk")
                                                              (* ; "Edited 21-Aug-2022 08:13 by rmk")
                                                             (* ; "Edited 12-Jun-90 17:51 by mitani")
-                                                             (* ; "Restarts a TEdit session.")
-    (replace (TEXTOBJ \WINDOW) of (fetch (TEXTSTREAM TEXTOBJ) of TEXT) with NIL)
+
+    (* ;; "RMK: not sure why it needs to full around with the window and create a new stream. Why not just restart the process and command loop?")
+
+    (SETQ TSTREAM (TEXTSTREAM TSTREAM))
+    (SETQ TSTREAM (OPENTEXTSTREAM TSTREAM WINDOW NIL NIL PROPS))
+    (LET* ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM))
+           (ODIRTY (GETTOBJ TEXTOBJ \DIRTY)))                (* ; 
+                                                   "Unattach the window, so we don't do a redisplay.")
+          (SETTOBJ TEXTOBJ \WINDOW)                          (* ; "Reopen, reattach")
+          (SETQ TSTREAM (OPENTEXTSTREAM TSTREAM WINDOW NIL NIL PROPS))
+          (SETQ TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM))
+                                                             (* ; "New stream maybe new textobj.")
+          (SETTOBJ TEXTOBJ \DIRTY ODIRTY)                    (* ; "Preserve dirty")
+          (\TEDIT.COMMAND.LOOP TEXTOBJ)                      (* ; "Run the editing engine")
+          (CLOSEW WINDOW)                                    (* ; "Close the edit window.  WHY ??")
+          (\TEDIT.TEXTCLOSEF TSTREAM)                        (* ; "Close the underlying files")
+          (replace (STREAM ACCESSBITS) of TSTREAM with BothBits)
                                                              (* ; 
-                                                         "Unattach the window, so we do a redisplay.")
-    (LET [(ODIRTY (fetch (TEXTOBJ \DIRTY) of (fetch (TEXTSTREAM TEXTOBJ) of TEXT]
-         (SETQ TEXT (OPENTEXTSTREAM TEXT WINDOW NIL NIL PROPS))
-         (SETTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TEXT)
-                \DIRTY ODIRTY))                              (* ; 
-                                                             "Now reconnect the world together again")
-    (\TEDIT.COMMAND.LOOP (fetch (TEXTSTREAM TEXTOBJ) of TEXT))
-                                                             (* ; "Run the editing engine")
-    (CLOSEW WINDOW)                                          (* ; "Close the edit window")
-    (\TEXTCLOSEF TEXT)                                       (* ; "Close the underlying files")
-    (replace (STREAM ACCESSBITS) of TEXT with BothBits)      (* ; 
                                                              "But leave the stream itself accessible")
                                                              (* ; 
                                                "Apply any post-window-close (and post-QUIT) function")
-    (CL:WHEN (GETTEXTPROP (fetch (TEXTSTREAM TEXTOBJ) of TEXT)
-                    'AFTERQUITFN)
-        (APPLY* (GETTEXTPROP (fetch (TEXTSTREAM TEXTOBJ) of TEXT)
-                       'AFTERQUITFN)
-               WINDOW TEXT))])
+          (CL:WHEN (GETTEXTPROP TEXTOBJ 'AFTERQUITFN)
+              (APPLY* (GETTEXTPROP TEXTOBJ 'AFTERQUITFN)
+                     WINDOW TSTREAM))])
 
 (\TEDIT.CHARDELETE
-  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 23-Dec-2023 17:32 by rmk")
+  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 23-Dec-2023 17:32 by rmk")
                                                              (* ; "Edited 24-May-2023 22:50 by rmk")
                                                              (* ; "Edited 22-May-2023 23:24 by rmk")
                                                              (* ; "Edited 19-Apr-93 10:50 by jds")
@@ -1324,7 +1354,7 @@
 
      (* ;; "Back up to the first visible character--that's the target, unless it is protected")
 
-          (for PC START-OF-PIECE backpieces (SETQ FIRSTPIECE (\CHTOPC CH# TEXTOBJ T))
+          (for PC START-OF-PIECE backpieces (SETQ FIRSTPIECE (\TEDIT.CHTOPC CH# TEXTOBJ T))
              declare (SPECVARS START-OF-PIECE) until (fetch (CHARLOOKS CLPROTECTED)
                                                         of (PLOOKS PC))
              do (if (VISIBLEPIECEP PC)
@@ -1342,7 +1372,8 @@
                     then (add START-OF-PIECE (IMINUS (PLEN PC])
 
 (\TEDIT.CHARDELETE.FORWARD
-  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 24-Dec-2023 00:36 by rmk")
+  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 24-Dec-2023 00:36 by rmk")
 
     (* ;; "This creates a selection specifying a deletion of the single character just after SEL's caret, and then uses that to delete the character.  It assumes that SEL can be smashed.")
 
@@ -1353,7 +1384,7 @@
 
      (* ;; "Forward to the first visible character--that's the target, unless it is protected")
 
-          (for PC START-OF-PIECE inpieces (SETQ FIRSTPIECE (\CHTOPC CH# TEXTOBJ T))
+          (for PC START-OF-PIECE inpieces (SETQ FIRSTPIECE (\TEDIT.CHTOPC CH# TEXTOBJ T))
              declare (SPECVARS START-OF-PIECE) until (fetch (CHARLOOKS CLPROTECTED)
                                                         of (PLOOKS PC))
              do (if (VISIBLEPIECEP PC)
@@ -1437,7 +1468,8 @@
           (RETURN NEWPC])
 
 (\TEDIT.APPLY.OBJFN
-  [LAMBDA (OBJ OPERATION FROMTOBJ TOTOBJ PROMPTTEXTOBJ)      (* ; "Edited 15-Jul-2023 10:43 by rmk")
+  [LAMBDA (OBJ OPERATION FROMTOBJ TOTOBJ PROMPTTEXTOBJ)      (* ; "Edited 15-Mar-2024 15:38 by rmk")
+                                                             (* ; "Edited 15-Jul-2023 10:43 by rmk")
                                                              (* ; "Edited  9-Jul-2023 16:24 by rmk")
                                                              (* ; "Edited  6-Jun-2023 13:35 by rmk")
                                                              (* ; "Edited 30-May-2023 08:15 by rmk")
@@ -1473,8 +1505,7 @@
 
           (CL:WHEN [AND (EQ OPERATION 'COPY)
                         (SETQ OBJFN (IMAGEOBJPROP OBJ 'WHENCOPIEDFN))
-                        (MEMB (APPLY* OBJFN OBJ (WINDOWPROP (CAR (fetch (TEXTOBJ \WINDOW)
-                                                                    of TOTOBJ))
+                        (MEMB (APPLY* OBJFN OBJ (WINDOWPROP (\TEDIT.PRIMARYW TOTOBJ)
                                                        'DSP)
                                      (fetch (TEXTOBJ STREAMHINT) of FROMTOBJ)
                                      (fetch (TEXTOBJ STREAMHINT) of TOTOBJ))
@@ -1484,7 +1515,8 @@
                       OBJ])
 
 (\TEDIT.DELETE
-  [LAMBDA (TEXTOBJ TARGETSEL DONTDISPLAY)                    (* ; "Edited 21-Feb-2024 20:40 by rmk")
+  [LAMBDA (TEXTOBJ TARGETSEL DONTDISPLAY)                    (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited 21-Feb-2024 20:40 by rmk")
                                                              (* ; "Edited 20-Feb-2024 20:09 by rmk")
                                                              (* ; "Edited 19-Feb-2024 11:48 by rmk")
                                                              (* ; "Edited 16-Feb-2024 08:46 by rmk")
@@ -1508,7 +1540,7 @@
                             1))
             (LET ((SEL (FGETTOBJ TEXTOBJ SEL))
                   (TCH# (FGETSEL TARGETSEL CH#)))
-                 (\SHOWSEL SEL NIL)
+                 (\TEDIT.SHOWSEL SEL NIL)
                  (CL:UNLESS DONTDISPLAY                      (* ; 
                                                        "Make sure target is on-screen in the SELPANE")
                      (AND NIL (TEDIT.NORMALIZECARET TEXTOBJ TARGETSEL)))
@@ -1529,8 +1561,8 @@
                      (* ;; "In any event, TARGETSEL's characters are all gone, reduce it to a point selection in case it is still in use.  And then SEL moves to the position of the deletion.")
 
                      (\TEDIT.UPDATE.SEL SEL TCH# 0 'LEFT)
-                     (\FIXSEL SEL TEXTOBJ)
-                     (CL:UNLESS DONTDISPLAY (\SHOWSEL SEL T))
+                     (\TEDIT.FIXSEL SEL TEXTOBJ)
+                     (CL:UNLESS DONTDISPLAY (\TEDIT.SHOWSEL SEL T))
                      T))))])
 
 (\TEDIT.DIFFUSE.PARALOOKS
@@ -1559,14 +1591,15 @@
                      (PPARALAST PC)) do (FSETPC PC PPARALOOKS PPLOOKS)))])
 
 (\TEDIT.QUIT
-  [LAMBDA (W NOFORCE)                                        (* ; "Edited 22-Sep-2023 20:21 by rmk")
+  [LAMBDA (W NOFORCE)                                        (* ; "Edited 20-Mar-2024 10:53 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 15:38 by rmk")
+                                                             (* ; "Edited 22-Sep-2023 20:21 by rmk")
                                                              (* ; "Edited 20-Sep-2023 23:24 by rmk")
                                                             (* ; "Edited 12-Jun-90 17:50 by mitani")
 
     (* ;; "Called by the default TEDIT.DEFAULT.MENUFN to perform the QUIT command.")
 
-    (PROG* ((TEXTOBJ (\DTEST (WINDOWPROP W 'TEXTOBJ)
-                            'TEXTOBJ))
+    (PROG* ((TEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW WTEXTOBJ) of W)))
             (QUITFNS (GETTEXTPROP TEXTOBJ 'QUITFN))
             QUITFLG RESP)
            [for QUITFN inside QUITFNS until (OR (EQ QUITFLG 'DON'T)
@@ -1602,14 +1635,15 @@
            (RETURN (FGETTOBJ TEXTOBJ EDITFINISHEDFLG])
 
 (\TEDIT.WORDDELETE
-  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 25-Dec-2023 00:03 by rmk")
+  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 20-Mar-2024 11:08 by rmk")
+                                                             (* ; "Edited 25-Dec-2023 00:03 by rmk")
                                                              (* ; "Edited 23-May-2023 16:37 by rmk")
                                                              (* ; "Edited 22-May-2023 10:52 by rmk")
                                                              (* ; "Edited 29-May-91 18:22 by jds")
 
     (* ;; "This deletes all characters from the character just before the caret to the beginning of the preceding word, skipping over separators to reach the target word.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (CL:UNLESS SEL
         (SETQ SEL (FGETTOBJ TEXTOBJ SEL)))
     (PROG ((LASTNO (SUB1 (TEDIT.GETPOINT SEL)))
@@ -1625,14 +1659,15 @@
           (\TEDIT.DELETE TEXTOBJ SEL])
 
 (\TEDIT.WORDDELETE.FORWARD
-  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 25-Dec-2023 00:20 by rmk")
+  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 20-Mar-2024 10:54 by rmk")
+                                                             (* ; "Edited 25-Dec-2023 00:20 by rmk")
                                                              (* ; "Edited 23-May-2023 16:37 by rmk")
                                                              (* ; "Edited 22-May-2023 10:52 by rmk")
                                                              (* ; "Edited 29-May-91 18:22 by jds")
 
     (* ;; "This deletes all characters from the character just after the caret to the end of the following word, skipping over separators to reach the target word.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (CL:UNLESS SEL
         (SETQ SEL (FGETTOBJ TEXTOBJ SEL)))
     (PROG ((FIRSTNO (TEDIT.GETPOINT SEL))
@@ -1679,7 +1714,8 @@
                 SPLASTCHAR _ (CAR LAST])
 
 (\TEDIT.PARA.FIRST
-  [LAMBDA (TEXTOBJ CHNO PROTECTEDNOTOK)                      (* ; "Edited 19-Jan-2024 10:10 by rmk")
+  [LAMBDA (TEXTOBJ CHNO PROTECTEDNOTOK)                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 19-Jan-2024 10:10 by rmk")
                                                              (* ; "Edited 26-Dec-2023 09:14 by rmk")
                                                              (* ; "Edited 24-Dec-2023 22:14 by rmk")
                                                              (* ; "Edited 11-Dec-2023 21:52 by rmk")
@@ -1694,12 +1730,12 @@
                     then (SETQ CHPIECE (fetch (SELPIECES SPFIRST) of CHNO))
                          (SETQ START (fetch (SELPIECES SPFIRSTCHAR) of CHNO))
                   elseif (type? PIECE CHNO)
-                    then (SETQ START (\PCTOCH CHNO TEXTOBJ))
+                    then (SETQ START (\TEDIT.PCTOCH CHNO TEXTOBJ))
                          (SETQ CHPIECE CHNO)
                   else [SETQ CHNO (CL:IF (type? SELECTION CHNO)
                                       (FGETSEL CHNO CH#)
                                       (IMAX 0 (IMIN CHNO (TEXTLEN TEXTOBJ))))]
-                       (SETQ CHPIECE (\CHTOPC CHNO TEXTOBJ T))
+                       (SETQ CHPIECE (\TEDIT.CHTOPC CHNO TEXTOBJ T))
                        (SETQ START START-OF-PIECE))
 
                 (* ;; 
@@ -1716,10 +1752,11 @@
                                                     (RETURN (CONS (IDIFFERENCE START PLENTOT)
                                                                   (CL:IF PC
                                                                       (NEXTPIECE PC)
-                                                                      (\FIRSTPIECE TEXTOBJ))])
+                                                                      (\TEDIT.FIRSTPIECE TEXTOBJ))])
 
 (\TEDIT.PARA.LAST
-  [LAMBDA (TEXTOBJ CHNO PROTECTEDNOTOK)                      (* ; "Edited 19-Jan-2024 10:37 by rmk")
+  [LAMBDA (TEXTOBJ CHNO PROTECTEDNOTOK)                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 19-Jan-2024 10:37 by rmk")
                                                              (* ; "Edited 26-Dec-2023 09:14 by rmk")
                                                              (* ; "Edited 24-Dec-2023 22:16 by rmk")
                                                              (* ; "Edited 11-Dec-2023 23:02 by rmk")
@@ -1737,10 +1774,10 @@
                                                 (PLEN CHPIECE]
                   elseif (type? PIECE CHNO)
                     then (SETQ CHPIECE CHNO)
-                         (SETQ END (\PCTOCH CHNO TEXTOBJ))
-                  else (SETQ CHPIECE (\CHTOPC (CL:IF (type? SELECTION CHNO)
-                                                  (SUB1 (FGETSEL CHNO CHLIM))
-                                                  CHNO)
+                         (SETQ END (\TEDIT.PCTOCH CHNO TEXTOBJ))
+                  else (SETQ CHPIECE (\TEDIT.CHTOPC (CL:IF (type? SELECTION CHNO)
+                                                        (SUB1 (FGETSEL CHNO CHLIM))
+                                                        CHNO)
                                             TEXTOBJ T))
                        (SETQ END START-OF-PIECE))            (* ; "Find the paragraph's last char")
 
@@ -1756,7 +1793,9 @@
 (DEFINEQ
 
 (\TEDIT.WORD.FIRST
-  [LAMBDA (TEXTOBJ CHNO WORDBOUNDTABLE)                      (* ; "Edited 25-Dec-2023 18:53 by rmk")
+  [LAMBDA (TEXTOBJ CHNO WORDBOUNDTABLE)                      (* ; "Edited 20-Mar-2024 10:54 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:05 by rmk")
+                                                             (* ; "Edited 25-Dec-2023 18:53 by rmk")
                                                              (* ; "Edited 23-May-2023 16:37 by rmk")
                                                              (* ; "Edited 22-May-2023 10:52 by rmk")
                                                              (* ; "Edited 29-May-91 18:22 by jds")
@@ -1769,7 +1808,7 @@
 
     (* ;; "Punctuation is tricky:  It stops whitespace and text, and its immediate predecessor doesn't matter.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (PROG ((TSTREAM (FGETTOBJ TEXTOBJ STREAMHINT))
            (READSA (fetch READSA of (OR WORDBOUNDTABLE (FGETTOBJ TEXTOBJ TXTWTBL)
                                         TEDIT.WORDBOUND.READTABLE)))
@@ -1777,7 +1816,7 @@
           (CL:WHEN (ILEQ CHNO 1)                             (* ; "Beginning of document")
               (RETURN 1))
           (SETQ CHNO (IMIN CHNO (FGETTOBJ TEXTOBJ TEXTLEN)))
-          (\TEXTSETFILEPTR TSTREAM (SUB1 CHNO))              (* ; "Fileptrs are one back")
+          (\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 CHNO))        (* ; "Fileptrs are one back")
           (SETQ CH (BIN TSTREAM))                            (* ; "The char at CHNO")
           (CL:WHEN (AND (CHARCODEP CH)
                         (EQ PUNCT.TTC (\SYNCODE READSA CH)))
@@ -1830,7 +1869,9 @@
                                   2)])
 
 (\TEDIT.WORD.LAST
-  [LAMBDA (TEXTOBJ CHNO WORDBOUNDTABLE)                      (* ; "Edited 25-Dec-2023 18:38 by rmk")
+  [LAMBDA (TEXTOBJ CHNO WORDBOUNDTABLE)                      (* ; "Edited 20-Mar-2024 10:54 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:05 by rmk")
+                                                             (* ; "Edited 25-Dec-2023 18:38 by rmk")
                                                              (* ; "Edited 23-May-2023 16:37 by rmk")
                                                              (* ; "Edited 22-May-2023 10:52 by rmk")
                                                              (* ; "Edited 29-May-91 18:22 by jds")
@@ -1844,7 +1885,7 @@
     (* ;; 
   "Punctuation is tricky:  It stops whitespace and text, and its immediate successor doesn't matter.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (PROG ((TSTREAM (FGETTOBJ TEXTOBJ STREAMHINT))
            (READSA (fetch READSA of (OR WORDBOUNDTABLE (FGETTOBJ TEXTOBJ TXTWTBL)
                                         TEDIT.WORDBOUND.READTABLE)))
@@ -1853,7 +1894,7 @@
           (CL:WHEN (IGEQ CHNO TEXTLEN)
                  (RETURN TEXTLEN))
           (SETQ CHNO (IMAX CHNO 1))
-          (\TEXTSETFILEPTR TSTREAM (SUB1 CHNO))              (* ; "Fileptrs are one back")
+          (\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 CHNO))        (* ; "Fileptrs are one back")
           (SETQ CH (BIN TSTREAM))                            (* ; "The char at CHNO")
           (CL:WHEN (AND (CHARCODEP CH)
                         (EQ PUNCT.TTC (\SYNCODE READSA CH)))
@@ -1909,7 +1950,8 @@
 (DEFINEQ
 
 (TEDIT.INSERT.OBJECT
-  [LAMBDA (OBJECT TSTREAM CH#)                               (* ; "Edited  3-Mar-2024 13:01 by rmk")
+  [LAMBDA (OBJECT TSTREAM CH#)                               (* ; "Edited 16-Mar-2024 00:08 by rmk")
+                                                             (* ; "Edited  3-Mar-2024 13:01 by rmk")
                                                              (* ; "Edited  9-Feb-2024 10:52 by rmk")
                                                              (* ; "Edited 28-Jan-2024 23:29 by rmk")
                                                              (* ; "Edited 11-Dec-2023 08:21 by rmk")
@@ -1938,12 +1980,12 @@
                   (FSETPC OBJPC PTYPE SUBSTREAM.PTYPE)
                   (FSETPC OBJPC PLEN (TEXTLEN (fetch (TEXTSTREAM TEXTOBJ) of SUBSTREAM))))
               (SETQ OBJSELPIECES
-               (\SELPIECES.COPY (create SELPIECES
-                                       SPLEN _ 1
-                                       SPFIRST _ OBJPC
-                                       SPLAST _ OBJPC
-                                       SPFIRSTCHAR _ CH#
-                                       SPLASTCHAR _ CH#)
+               (\TEDIT.SELPIECES.COPY (create SELPIECES
+                                             SPLEN _ 1
+                                             SPFIRST _ OBJPC
+                                             SPLAST _ OBJPC
+                                             SPFIRSTCHAR _ CH#
+                                             SPLASTCHAR _ CH#)
                       'INSERT TEXTOBJ))
               (CL:UNLESS OBJSELPIECES                        (* ; "Copy may not be allowed")
                   (RETURN))
@@ -1954,10 +1996,10 @@
          " OBJSELPIECES contains (a copy of) the object piece, and the object approved of insertion.")
 
               (SETQ SEL (TEXTSEL TEXTOBJ))
-              (\SHOWSEL SEL NIL)
+              (\TEDIT.SHOWSEL SEL NIL)
               (CL:WHEN (type? SELECTION CH#)
                   (SETQ CH# (GETSEL CH# CH#)))
-              (TEDIT.DO.BLUEPENDINGDELETE SEL TEXTOBJ)       (* ; 
+              (\TEDIT.DO.BLUEPENDINGDELETE SEL TEXTOBJ)      (* ; 
                                                             "Do the pending delete, if there is one.")
               (CL:WHEN CH#
                   (\TEDIT.UPDATE.SEL SEL (IMIN CH# (ADD1 (TEXTLEN TEXTOBJ)))
@@ -1965,10 +2007,11 @@
                          'LEFT))
               (\TEDIT.INSERT.SELPIECES OBJSELPIECES TEXTOBJ SEL)
               (TEDIT.NORMALIZECARET TEXTOBJ)
-              (\SHOWSEL SEL T)))])
+              (\TEDIT.SHOWSEL SEL T)))])
 
 (TEDIT.EDIT.OBJECT
-  [LAMBDA (STREAM OBJ)                                       (* ; "Edited  2-Dec-2023 09:57 by rmk")
+  [LAMBDA (STREAM OBJ)                                       (* ; "Edited 15-Mar-2024 14:23 by rmk")
+                                                             (* ; "Edited  2-Dec-2023 09:57 by rmk")
                                                              (* ; "Edited 19-May-2023 21:35 by rmk")
                                                              (* ; "Edited 27-Apr-2023 00:14 by rmk")
                                                              (* ; "Edited 21-Oct-2022 18:37 by rmk")
@@ -1983,7 +2026,7 @@
                      (\TEDIT.UPDATE.SEL SEL CH# 1)
                      (SETSEL SEL SELOBJ OBJ)
                      (SETSEL SEL SELTEXTOBJ TEXTOBJ)
-                     (\FIXSEL SEL TEXTOBJ))
+                     (\TEDIT.FIXSEL SEL TEXTOBJ))
                 (T (TEDIT.PROMPTPRINT TEXTOBJ "Can't find specified object." T]
             (T (SETQ SEL (FGETTOBJ TEXTOBJ SEL))
                (SETQ OBJ (GETSEL SEL SELOBJ]
@@ -1996,18 +2039,20 @@
                                                    "If the editfn makes a change, update the screen.")
                      (for LINE inside (GETSEL SEL L1) do (FSETLD LINE LDIRTY T))
                      (FSETTOBJ TEXTOBJ TXTNEEDSUPDATE T)
-                     (TEDIT.UPDATE.SCREEN TEXTOBJ]
+                     (\TEDIT.UPDATE.SCREEN TEXTOBJ]
             (T                                               (* ; "No object selected.")
                (TEDIT.PROMPTPRINT TEXTOBJ "Please select an editable object first." T])
 
 (TEDIT.FIND.OBJECT
-  [LAMBDA (TEXTOBJ OBJ)                                      (* ; "Edited  6-Nov-2022 11:12 by rmk")
+  [LAMBDA (TEXTOBJ OBJ)                                      (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited  6-Nov-2022 11:12 by rmk")
                                                              (* ; "Edited  3-May-93 12:52 by jds")
-    (for CH# from 1 by (PLEN PC) as PC inpieces (\FIRSTPIECE (TEXTOBJ TEXTOBJ))
+    (for CH# from 1 by (PLEN PC) as PC inpieces (\TEDIT.FIRSTPIECE (TEXTOBJ TEXTOBJ))
        when (EQ OBJ (PCONTENTS PC)) do (RETURN CH#])
 
 (TEDIT.OBJECT.CHANGED
-  [LAMBDA (TSTREAM OBJECT)                                   (* ; "Edited 21-Oct-2023 08:59 by rmk")
+  [LAMBDA (TSTREAM OBJECT)                                   (* ; "Edited 17-Mar-2024 00:25 by rmk")
+                                                             (* ; "Edited 21-Oct-2023 08:59 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:57 by rmk")
                                                              (* ; "Edited 10-Apr-2023 00:02 by rmk")
                                                              (* ; "Edited  9-Sep-2022 09:32 by rmk")
@@ -2017,31 +2062,32 @@
                    "Notify TEdit that an object has changed, and the display may need to be updated.")
     (LET ((TEXTOBJ (TEXTOBJ TSTREAM))
           OBJPIECE CHANGEDCH#)
-         [SETQ OBJPIECE (find PC inpieces (\FIRSTPIECE TEXTOBJ) suchthat (EQ OBJECT (PCONTENTS PC]
-                                                             (* ; 
+         [SETQ OBJPIECE (find PC inpieces (\TEDIT.FIRSTPIECE TEXTOBJ)
+                           suchthat (EQ OBJECT (PCONTENTS PC](* ; 
                                                              "Find the piece containing this object")
          (CL:UNLESS OBJPIECE (HELP "Changed OBJECT not found!?"))
-         (SETQ CHANGEDCH# (\PCTOCH OBJPIECE TEXTOBJ))        (* ; "Get the CH# of the changed object")
+         (SETQ CHANGEDCH# (\TEDIT.PCTOCH OBJPIECE TEXTOBJ))  (* ; "Get the CH# of the changed object")
          (\TEDIT.MARK.LINES.DIRTY TEXTOBJ CHANGEDCH# CHANGEDCH#)
                                                              (* ; "Mark affected lines")
          (replace (TEXTOBJ \DIRTY) of TEXTOBJ with T)        (* ; "And mark the document dirty.")
-         (\SHOWSEL (fetch (TEXTOBJ SEL) of TEXTOBJ)
+         (\TEDIT.SHOWSEL (fetch (TEXTOBJ SEL) of TEXTOBJ)
                 NIL)
-         (TEDIT.UPDATE.SCREEN TEXTOBJ)
-         (\FIXSEL (fetch (TEXTOBJ SEL) of TEXTOBJ)
+         (\TEDIT.UPDATE.SCREEN TEXTOBJ)
+         (\TEDIT.FIXSEL (fetch (TEXTOBJ SEL) of TEXTOBJ)
                 TEXTOBJ)
-         (\SHOWSEL (fetch (TEXTOBJ SEL) of TEXTOBJ)
+         (\TEDIT.SHOWSEL (fetch (TEXTOBJ SEL) of TEXTOBJ)
                 T])
 
 (TEDIT.MAP.OBJECTS
-  [LAMBDA (TEXTOBJ FN FNARG COLLECT?)                        (* ; "Edited  4-Mar-2024 16:12 by rmk")
+  [LAMBDA (TEXTOBJ FN FNARG COLLECT?)                        (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited  4-Mar-2024 16:12 by rmk")
                                                              (* ; "Edited  6-Nov-2022 12:15 by rmk")
 
     (* ;; "Apply FN to each of the imageobjects in TEXTOBJ.  If COLLECT? value is the list of (CH# OBJ FNVAL) pairs that satisfy the predicate")
 
     (* ;; "FN is a function of 3 args ( CH#-of-OBJ  OBJ   FNARG)")
 
-    (for CH# OBJ FNVAL from 1 by (PLEN PC) as PC inpieces (\FIRSTPIECE (TEXTOBJ TEXTOBJ))
+    (for CH# OBJ FNVAL from 1 by (PLEN PC) as PC inpieces (\TEDIT.FIRSTPIECE (TEXTOBJ TEXTOBJ))
        when (AND (EQ OBJECT.PTYPE (PTYPE PC))
                  (type? IMAGEOBJ (SETQ OBJ (PCONTENTS PC)))
                  (SETQ FNVAL (APPLY* FN CH# OBJ FNARG)))
@@ -2068,7 +2114,7 @@
 (* ; "TEDIT Support information")
 
 
-(RPAQQ TEDITSYSTEMDATE " 7-Mar-2024 08:14:51")
+(RPAQQ TEDITSYSTEMDATE " 1-Apr-2024 09:46:05")
 
 
 
@@ -2078,24 +2124,25 @@
 (ADDTOVAR PRINTFILETYPES (TEDIT (TEST \TEDIT.GET.TRAILER)
                                 (EXTENSION (TEDIT))))
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (4341 6283 (MAKE-TEDIT-EXPORTS.ALL 4351 . 4897) (UPDATE-TEDIT 4899 . 5512) (EDIT-TEDIT 
-5514 . 6281)) (7615 7908 (\CREATE.TEDIT.RESTART.MENU 7625 . 7906)) (8283 46720 (TEDIT 8293 . 10898) (
-COERCETEXTOBJ 10900 . 14999) (TEDIT.CONCAT 15001 . 18053) (\TEDIT.CONCAT.PAGEFRAMES 18055 . 22954) (
-\TEDIT.GET.PAGE.HEADINGS 22956 . 23985) (\TEDIT.CONCAT.INSTALL.HEADINGS 23987 . 25318) (TEDITSTRING 
-25320 . 26058) (TEDIT-SEE 26060 . 26619) (TEDIT.CHARWIDTH 26621 . 28645) (TEDIT.COPY 28647 . 30808) (
-TEDIT.DELETE 30810 . 31783) (TEDIT.INSERT 31785 . 33855) (TEDIT.KILL 33857 . 34559) (TEDIT.QUIT 34561
- . 36129) (TEDIT.DO.BLUEPENDINGDELETE 36131 . 37063) (TEDIT.MOVE 37065 . 42430) (TEDIT.STRINGWIDTH 
-42432 . 43103) (TEXTOBJ 43105 . 45459) (TEDITMENUP 45461 . 46099) (TEXTSTREAM 46101 . 46718)) (46721 
-48876 (\TEDIT.MOVE.MSG 46731 . 48384) (\TEDIT.READONLY 48386 . 48874)) (48877 56995 (TEDIT.NCHARS 
-48887 . 49260) (TEDIT.RPLCHARCODE 49262 . 52615) (TEDIT.NTHCHARCODE 52617 . 54279) (
-\TEDIT.PIECE.NTHCHARCODE 54281 . 56993)) (57041 96253 (\TEDIT1 57051 . 58910) (\TEDIT.INSERT 58912 . 
-64660) (\TEDIT.REPLACE.SELPIECES 64662 . 66334) (\TEDIT.INSERT.SELPIECES 66336 . 68637) (
-\TEDIT.OBJECT.SHOWSEL 68639 . 72399) (\TEDIT.RESTARTFN 72401 . 74539) (\TEDIT.CHARDELETE 74541 . 76539
-) (\TEDIT.CHARDELETE.FORWARD 76541 . 78053) (\TEDIT.COPYPIECE 78055 . 82793) (\TEDIT.APPLY.OBJFN 82795
- . 85868) (\TEDIT.DELETE 85870 . 89000) (\TEDIT.DIFFUSE.PARALOOKS 89002 . 91273) (\TEDIT.QUIT 91275 . 
-93710) (\TEDIT.WORDDELETE 93712 . 94985) (\TEDIT.WORDDELETE.FORWARD 94987 . 96251)) (96254 103226 (
-\TEDIT.PARAPIECES 96264 . 97985) (\TEDIT.PARA.FIRST 97987 . 100626) (\TEDIT.PARA.LAST 100628 . 103224)
-) (103227 111315 (\TEDIT.WORD.FIRST 103237 . 107381) (\TEDIT.WORD.LAST 107383 . 111313)) (111356 
-120002 (TEDIT.INSERT.OBJECT 111366 . 114639) (TEDIT.EDIT.OBJECT 114641 . 116680) (TEDIT.FIND.OBJECT 
-116682 . 117089) (TEDIT.OBJECT.CHANGED 117091 . 119058) (TEDIT.MAP.OBJECTS 119060 . 120000)))))
+  (FILEMAP (NIL (4237 6179 (MAKE-TEDIT-EXPORTS.ALL 4247 . 4793) (UPDATE-TEDIT 4795 . 5408) (EDIT-TEDIT 
+5410 . 6177)) (7825 37823 (TEDIT 7835 . 10360) (TEXTSTREAM 10362 . 12033) (TEXTSTREAMP 12035 . 12419) 
+(TEDITMENUP 12421 . 13187) (COERCETEXTSTREAM 13189 . 17400) (TEDIT.CONCAT 17402 . 20581) (TEDITSTRING 
+20583 . 21436) (TEDIT-SEE 21438 . 21997) (TEDIT.COPY 21999 . 24295) (TEDIT.DELETE 24297 . 25270) (
+TEDIT.INSERT 25272 . 27342) (TEDIT.KILL 27344 . 28046) (TEDIT.QUIT 28048 . 29616) (TEDIT.MOVE 29618 . 
+35122) (TEDIT.STRINGWIDTH 35124 . 35795) (TEDIT.CHARWIDTH 35797 . 37821)) (37824 39765 (TEXTOBJ 37834
+ . 38299) (COERCETEXTOBJ 38301 . 39763)) (39766 48320 (\TEDIT.CONCAT.PAGEFRAMES 39776 . 44910) (
+\TEDIT.GET.PAGE.HEADINGS 44912 . 45941) (\TEDIT.CONCAT.INSTALL.HEADINGS 45943 . 47274) (
+\TEDIT.DO.BLUEPENDINGDELETE 47276 . 48318)) (48321 50476 (\TEDIT.MOVE.MSG 48331 . 49984) (
+\TEDIT.READONLY 49986 . 50474)) (50477 58947 (TEDIT.NCHARS 50487 . 50860) (TEDIT.RPLCHARCODE 50862 . 
+54330) (TEDIT.NTHCHARCODE 54332 . 56109) (\TEDIT.PIECE.NTHCHARCODE 56111 . 58945)) (58993 99952 (
+\TEDIT1 59003 . 60971) (\TEDIT.INSERT 60973 . 67187) (\TEDIT.REPLACE.SELPIECES 67189 . 68988) (
+\TEDIT.INSERT.SELPIECES 68990 . 71412) (\TEDIT.OBJECT.SHOWSEL 71414 . 75174) (\TEDIT.RESTARTFN 75176
+ . 77463) (\TEDIT.CHARDELETE 77465 . 79578) (\TEDIT.CHARDELETE.FORWARD 79580 . 81207) (
+\TEDIT.COPYPIECE 81209 . 85947) (\TEDIT.APPLY.OBJFN 85949 . 89034) (\TEDIT.DELETE 89036 . 92293) (
+\TEDIT.DIFFUSE.PARALOOKS 92295 . 94566) (\TEDIT.QUIT 94568 . 97205) (\TEDIT.WORDDELETE 97207 . 98582) 
+(\TEDIT.WORDDELETE.FORWARD 98584 . 99950)) (99953 107185 (\TEDIT.PARAPIECES 99963 . 101684) (
+\TEDIT.PARA.FIRST 101686 . 104452) (\TEDIT.PARA.LAST 104454 . 107183)) (107186 115696 (
+\TEDIT.WORD.FIRST 107196 . 111551) (\TEDIT.WORD.LAST 111553 . 115694)) (115737 124985 (
+TEDIT.INSERT.OBJECT 115747 . 119177) (TEDIT.EDIT.OBJECT 119179 . 121334) (TEDIT.FIND.OBJECT 121336 . 
+121858) (TEDIT.OBJECT.CHANGED 121860 . 123926) (TEDIT.MAP.OBJECTS 123928 . 124983)))))
 STOP
diff --git a/library/tedit/TEDIT-ABBREV b/library/tedit/TEDIT-ABBREV
index 9b959f9a..28459e35 100644
--- a/library/tedit/TEDIT-ABBREV
+++ b/library/tedit/TEDIT-ABBREV
@@ -1,10 +1,14 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "12-Jun-2023 10:34:12" {WMEDLEY}<library>tedit>TEDIT-ABBREV.;6 9257   
+(FILECREATED "17-Mar-2024 18:15:40" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-ABBREV.;8 9500   
 
       :EDIT-BY rmk
 
-      :PREVIOUS-DATE "17-May-2023 13:40:00" {WMEDLEY}<library>tedit>TEDIT-ABBREV.;5)
+      :CHANGES-TO (FNS \TEDIT.ABBREV.EXPAND)
+
+      :PREVIOUS-DATE "17-Mar-2024 12:06:12" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-ABBREV.;7)
 
 
 (PRETTYCOMPRINT TEDIT-ABBREVCOMS)
@@ -61,7 +65,8 @@
 (DEFINEQ
 
 (\TEDIT.ABBREV.EXPAND
-  [LAMBDA (TSTREAM)                                          (* ; "Edited 17-May-2023 13:31 by rmk")
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 17-Mar-2024 12:06 by rmk")
+                                                             (* ; "Edited 17-May-2023 13:31 by rmk")
                                                              (* ; "Edited  8-Sep-2022 23:53 by rmk")
                                                              (* ; "Edited  1-Aug-2022 12:04 by rmk")
                                                              (* ; "Edited 30-May-91 19:27 by jds")
@@ -76,7 +81,7 @@
               (CL:WHEN (ZEROP CH#)                           (* ; 
                                        "If we're off the front of the document, don't bother trying.")
                   (RETURN))
-              (\TEXTSETFILEPTR TSTREAM (SUB1 CH#)
+              (\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 CH#)
                      CH#)
               [SETQ CH (MKSTRING (CHARACTER (BIN TSTREAM]
               (TEDIT.SETSEL TSTREAM CH# 1 'RIGHT))
@@ -201,6 +206,6 @@
          ("DATE" . \TEDIT.EXPAND.DATE)
          (">>DATE<<" . \TEDIT.EXPAND.DATE)))
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (2866 7913 (\TEDIT.ABBREV.EXPAND 2876 . 5128) (\TEDIT.EXPAND.DATE 5130 . 5763) (
-\TEDIT.TRY.ABBREV 5765 . 7911)))))
+  (FILEMAP (NIL (2994 8156 (\TEDIT.ABBREV.EXPAND 3004 . 5371) (\TEDIT.EXPAND.DATE 5373 . 6006) (
+\TEDIT.TRY.ABBREV 6008 . 8154)))))
 STOP
diff --git a/library/tedit/TEDIT-ABBREV.LCOM b/library/tedit/TEDIT-ABBREV.LCOM
index 4c61db59..b6856760 100644
Binary files a/library/tedit/TEDIT-ABBREV.LCOM and b/library/tedit/TEDIT-ABBREV.LCOM differ
diff --git a/library/tedit/TEDIT-COMMAND b/library/tedit/TEDIT-COMMAND
index 28567a65..f8b2990e 100644
--- a/library/tedit/TEDIT-COMMAND
+++ b/library/tedit/TEDIT-COMMAND
@@ -1,12 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "26-Feb-2024 11:22:29" {WMEDLEY}<library>tedit>TEDIT-COMMAND.;62 45850  
+(FILECREATED "27-Mar-2024 15:28:15" {WMEDLEY}<library>tedit>TEDIT-COMMAND.;71 46623  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS \TEDIT.COMMAND.LOOP)
+      :CHANGES-TO (FNS \TEDIT.INTERRUPT.SETUP)
 
-      :PREVIOUS-DATE "22-Feb-2024 23:15:00" {WMEDLEY}<library>tedit>TEDIT-COMMAND.;61)
+      :PREVIOUS-DATE "20-Mar-2024 11:07:16" {WMEDLEY}<library>tedit>TEDIT-COMMAND.;70)
 
 
 (PRETTYCOMPRINT TEDIT-COMMANDCOMS)
@@ -212,31 +212,30 @@
 (DEFINEQ
 
 (\TEDIT.INTERRUPT.SETUP
-  [LAMBDA (PROC FORCEOFF)                                    (* ; "Edited 22-Sep-2023 20:45 by rmk")
+  [LAMBDA (PROC FORCEOFF)                                    (* ; "Edited 27-Mar-2024 15:27 by rmk")
+                                                             (* ; "Edited 22-Sep-2023 20:45 by rmk")
                                                              (* jds "12-Sep-84 15:36")
 
     (* ;; "Disarm any inconvenient interrupts, and save re-arming info on the window.")
 
-    [LET [(TEXTOBJ (AND (PROCESSPROP PROC 'WINDOW)
-                        (WINDOWPROP (PROCESSPROP PROC 'WINDOW)
-                               'TEXTOBJ)
-                        (TEXTOBJ (PROCESSPROP PROC 'WINDOW]
-         (UNINTERRUPTABLY
-             [COND
-                ((AND FORCEOFF (PROCESSPROP PROC 'TEDIT.INTERRUPTS))
+    [LET ((TEXTOBJ (TEXTOBJ PROC T)))
+         (CL:WHEN TEXTOBJ
+             (UNINTERRUPTABLY
+                 [COND
+                    ((AND FORCEOFF (PROCESSPROP PROC 'TEDIT.INTERRUPTS))
                                                              (* ; 
                                                        "There are disarmed interrupts;  re-arm them.")
-                 (RESET.INTERRUPTS (PROCESSPROP PROC 'TEDIT.INTERRUPTS))
-                 (PROCESSPROP PROC 'TEDIT.INTERRUPTS NIL))
-                ([AND (NOT FORCEOFF)
-                      (NOT (PROCESSPROP PROC 'TEDIT.INTERRUPTS]
+                     (RESET.INTERRUPTS (PROCESSPROP PROC 'TEDIT.INTERRUPTS))
+                     (PROCESSPROP PROC 'TEDIT.INTERRUPTS NIL))
+                    ([AND (NOT FORCEOFF)
+                          (NOT (PROCESSPROP PROC 'TEDIT.INTERRUPTS]
                                                              (* ; 
                                                    "There aren't any interrupts disarmed;  go do it.")
-                 (PROCESSPROP PROC 'TEDIT.INTERRUPTS (RESET.INTERRUPTS
-                                                      (OR (AND TEXTOBJ (GETTEXTPROP TEXTOBJ
-                                                                              'INTERRUPTS))
-                                                          TEDIT.INTERRUPTS)
-                                                      T])]
+                     (PROCESSPROP PROC 'TEDIT.INTERRUPTS (RESET.INTERRUPTS
+                                                          (OR (AND TEXTOBJ (GETTEXTPROP TEXTOBJ
+                                                                                  'INTERRUPTS))
+                                                              TEDIT.INTERRUPTS)
+                                                          T]))]
     PROC])
 
 (\TEDIT.MARKACTIVE
@@ -250,7 +249,10 @@
     TEXTOBJ])
 
 (\TEDIT.COMMAND.LOOP
-  [LAMBDA (STREAM RTBL)                                      (* ; "Edited 24-Feb-2024 15:33 by rmk")
+  [LAMBDA (STREAM RTBL)                                      (* ; "Edited 20-Mar-2024 10:59 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:23 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:35 by rmk")
+                                                             (* ; "Edited 24-Feb-2024 15:33 by rmk")
                                                              (* ; "Edited 21-Feb-2024 14:49 by rmk")
                                                              (* ; "Edited 18-Feb-2024 23:35 by rmk")
                                                              (* ; "Edited 24-Dec-2023 09:50 by rmk")
@@ -264,7 +266,7 @@
                         (fetch (TEXTSTREAM TEXTOBJ) of STREAM)
                         STREAM))
            SEL PANES)
-          (\DTEST TEXTOBJ 'TEXTOBJ)
+          (TEXTOBJ! TEXTOBJ)
           (SETQ SEL (TEXTSEL TEXTOBJ))
           (SETQ PANES (FGETTOBJ TEXTOBJ \WINDOW))
           (SETQ RTBL (OR RTBL (FGETTOBJ TEXTOBJ TXTRTBL)
@@ -302,10 +304,10 @@
                              (CL:WHEN (FGETTOBJ TEXTOBJ TXTNEEDSUPDATE)
                                                              (* ; 
                      "We got here somehow with the window not in sync with the text.  Run an update.")
-                                 (\SHOWSEL SEL NIL)
-                                 (TEDIT.UPDATE.SCREEN TEXTOBJ)
-                                 (\FIXSEL SEL TEXTOBJ)
-                                 (\SHOWSEL SEL T))
+                                 (\TEDIT.SHOWSEL SEL NIL)
+                                 (\TEDIT.UPDATE.SCREEN TEXTOBJ)
+                                 (\TEDIT.FIXSEL SEL TEXTOBJ)
+                                 (\TEDIT.SHOWSEL SEL T))
                              (\TEDIT.FLASHCARET TEXTOBJ)     (* ; 
                   "Flash the caret periodically (BUT not while we're here only to cleanup and quit.)")
                              (FSETTOBJ TEXTOBJ EDITOPACTIVE T)
@@ -321,12 +323,12 @@
 
                              (SELECTQ (PROG1 SELOPERATION (SETQ SELOPERATION NIL))
                                  (NORMAL (CL:WHEN (FGETSEL SOURCESEL SET)
-                                             (SETQ SEL (\COPYSEL SOURCESEL SEL))
+                                             (SETQ SEL (\TEDIT.COPYSEL SOURCESEL SEL))
                                                              (* ; "SOURCESEL is new SEL selection")
                                              (FSETTOBJ TEXTOBJ CARETLOOKS (
                                                                           \TEDIT.GET.INSERT.CHARLOOKS
                                                                            TEXTOBJ SEL))
-                                             (\SHOWSEL SEL T)))
+                                             (\TEDIT.SHOWSEL SEL T)))
                                  (MOVE                       (* ; "Move source to SEL")
                                        (TEDIT.MOVE SOURCESEL SEL))
                                  (COPY                       (* ; "Copy source to SEL.")
@@ -359,28 +361,28 @@
                                        (CHARDELETE.TTC       (* ; 
                                        "Backspace handler: Remove the character just before SEL:CH#.")
                                             (\TEDIT.CHARDELETE TEXTOBJ SEL)
-                                            (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                            (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ))
                                        (CHARDELETE.FORWARD.TTC 
                                             (\TEDIT.CHARDELETE.FORWARD TEXTOBJ SEL)
-                                            (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                            (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ))
                                        (WORDDELETE.TTC 
                                             (\TEDIT.WORDDELETE TEXTOBJ SEL)
-                                            (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                            (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ))
                                        (WORDDELETE.FORWARD.TTC 
                                             (\TEDIT.WORDDELETE.FORWARD TEXTOBJ SEL)
-                                            (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                            (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ))
                                        (DELETE.TTC           (* ; 
                                                     "DEL Key handler: Delete the selected characters")
                                                    (\TEDIT.DELETE TEXTOBJ SEL)
-                                                   (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                                   (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ))
                                        (UNDO.TTC             (* ; 
                                                         "He hit the CANCEL key, so go UNDO something")
                                                  (TEDIT.UNDO TEXTOBJ)
-                                                 (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                                 (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ))
                                        (REDO.TTC             (* ; 
                                                           "He hit the REDO key, so go REDO something")
                                                  (TEDIT.REDO TEXTOBJ)
-                                                 (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                                 (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ))
                                        (FUNCTIONCALL.TTC     (* ; 
                                                  "This is a special character -- it calls a function")
                                             (CL:WHEN [SETQ FN (CAR (FETCH MACROFN
@@ -395,9 +397,9 @@
                                                 (CL:UNLESS (MEMB CH WHEELSCROLLCHARCODES)
                                                              (* ; 
                          "The wheelscroll FN handled the selection. should preserve the highlighting")
-                                                    (\SHOWSEL SEL NIL)
-                                                    (TEDIT.RESET.EXTEND.PENDING.DELETE SEL)
-                                                    (\SHOWSEL SEL T))))
+                                                    (\TEDIT.SHOWSEL SEL NIL)
+                                                    (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ)
+                                                    (\TEDIT.SHOWSEL SEL T))))
                                        (NEXT.TTC             (* ; 
                        "Move to the next blank to fill in.  For now, blanks are delimited by >>...<<")
                                                  (TEDIT.NEXT TEXTOBJ))
@@ -409,14 +411,17 @@
                                            (CHARDELETE.TC    (* ; 
                                        "Backspace handler: Remove the character just before SEL:CH#.")
                                                           (\TEDIT.CHARDELETE TEXTOBJ SEL)
-                                                          (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                                          (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL 
+                                                                 TEXTOBJ))
                                            (WORDDELETE.TC    (* ; "Back-WORD handler")
                                                           (\TEDIT.WORDDELETE TEXTOBJ)
-                                                          (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                                          (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL 
+                                                                 TEXTOBJ))
                                            (LINEDELETE.TC    (* ; 
                                                     "DEL Key handler: Delete the selected characters")
                                                           (\TEDIT.DELETE TEXTOBJ SEL)
-                                                          (TEDIT.RESET.EXTEND.PENDING.DELETE SEL))
+                                                          (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL 
+                                                                 TEXTOBJ))
                                            (CL:WHEN CH       (* ; 
                                                              "Any other key: insert the character.")
                                                (\TEDIT.INSERT CH SEL TEXTOBJ))])
@@ -424,7 +429,8 @@
                   (FSETTOBJ TEXTOBJ EDITOPACTIVE NIL))))])
 
 (\TEDIT.COMMAND.RESET.SETUP
-  [LAMBDA (TEXT&WIND STARTING)                               (* ; "Edited 22-Feb-2024 23:14 by rmk")
+  [LAMBDA (TEXT&WIND STARTING)                               (* ; "Edited 17-Mar-2024 18:54 by rmk")
+                                                             (* ; "Edited 22-Feb-2024 23:14 by rmk")
                                                              (* ; "Edited  5-Oct-2023 22:41 by rmk")
                                                              (* ; "Edited 22-Sep-2023 20:41 by rmk")
                                                              (* ; "Edited 16-Sep-2023 22:30 by rmk")
@@ -434,7 +440,7 @@
     (* ;; "If STARTING is T, set up the reset-driven connections and values for editing;  otherwise, break links and reset values for non-editing")
 
     (PROG ((TEXTOBJ (CAR TEXT&WIND))
-           (WINDOW (CADR TEXT&WIND))
+           (PANES (CADR TEXT&WIND))
            (OTTYWINDOW (CADDR TEXT&WIND))
            (OTTYENTRYFN (CADDDR TEXT&WIND))
            (OTTYEXITFN (CAR (CDDDDR TEXT&WIND)))
@@ -447,7 +453,7 @@
                              "Mark us busy until we're set up, so that nobody tries any funny stuff.")
                     (SETQ OWINDOW (PROCESSPROP (THIS.PROCESS)
                                          'WINDOW
-                                         (CAR WINDOW)))      (* ; 
+                                         (CAR PANES)))       (* ; 
                                                              "Attach the process to this window.")
                     (\TEDIT.INTERRUPT.SETUP (THIS.PROCESS))  (* ; 
                                      "Disarm all interrupt chars, re-arm them when we leave the edit")
@@ -473,7 +479,7 @@
                                                              (* ; 
                            "So that there isn't a circularity in the PROCESS -> TTYWINDOW -> PROCESS")
                         (WINDOWPROP TTYWINDOW 'COPYINSERTFN (FUNCTION \TEDIT.COPYINSERTFN))
-                        (WINDOWPROP TTYWINDOW 'MAINWINDOW (CAR WINDOW)))
+                        (WINDOWPROP TTYWINDOW 'MAINWINDOW (CAR PANES)))
                     (FSETTOBJ TEXTOBJ TXTEDITING T)          (* ; 
                                             "Tell TEdit that this document is actively being edited.")
                                                              (* ; 
@@ -483,20 +489,20 @@
                                                  "Coming OUT OF the command loop -- reset everything")
                 (PROCESSPROP (THIS.PROCESS)
                        'WINDOW
-                       (CAR WINDOW))                         (* ; 
+                       (CAR PANES))                          (* ; 
                               "Detach the window from the edit process, to prevent circularity there")
-                (WINDOWPROP (CAR WINDOW)
+                (WINDOWPROP (CAR PANES)
                        'PROCESS NIL)
                 (\TEDIT.INTERRUPT.SETUP (THIS.PROCESS)
                        T)                                    (* ; 
                                                      "Re-arm the interrupts we turned off coming in.")
                 (CL:WHEN [AND (TXTFILE TEXTOBJ)
-                              (NOT (fetch (TEXTWINDOW CLOSINGFILE) of (CAR WINDOW]
+                              (NOT (fetch (TEXTWINDOW CLOSINGFILE) of (CAR PANES]
                                                              (* ; 
          "Remember to close the file we were editing (Only if the window function isn't closing it.)")
                     (CLOSEF? (TXTFILE TEXTOBJ))              (* ; 
                                                        "Let anyone else who wants to close the file.")
-                    (replace (TEXTWINDOW CLOSINGFILE) of (CAR WINDOW) with NIL))
+                    (replace (TEXTWINDOW CLOSINGFILE) of (CAR PANES) with NIL))
                 (PROCESSPROP (THIS.PROCESS)
                        'TTYEXITFN OTTYEXITFN)
                 (PROCESSPROP (THIS.PROCESS)
@@ -512,7 +518,7 @@
                     (TTYDISPLAYSTREAM OTTYWINDOW)
                     (PROCESSPROP (THIS.PROCESS)
                            'TEDITTTYWINDOW NIL))]
-          (RETURN (LIST TEXTOBJ WINDOW OTTYWINDOW OTTYENTRYFN OTTYEXITFN OWINDOW])
+          (RETURN (LIST TEXTOBJ PANES OTTYWINDOW OTTYENTRYFN OTTYEXITFN OWINDOW])
 )
 
 (RPAQ? TEDIT.INTERRUPTS '((2 BREAK)
@@ -834,10 +840,10 @@
 
 (RPAQ WHEELSCROLLCHARCODES (\TEDIT.WHEELSCROLL))
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (7792 28983 (\TEDIT.INTERRUPT.SETUP 7802 . 9442) (\TEDIT.MARKACTIVE 9444 . 9656) (
-\TEDIT.MARKINACTIVE 9658 . 9874) (\TEDIT.COMMAND.LOOP 9876 . 22486) (\TEDIT.COMMAND.RESET.SETUP 22488
- . 28981)) (29267 44464 (\TEDIT.READTABLE 29277 . 30934) (\TEDIT.WORDBOUND.READTABLE 30936 . 33529) (
-TEDIT.GETSYNTAX 33531 . 35970) (TEDIT.SETSYNTAX 35972 . 38450) (TEDIT.GETFUNCTION 38452 . 39812) (
-TEDIT.SETFUNCTION 39814 . 42253) (TEDIT.WORDGET 42255 . 42516) (TEDIT.WORDSET 42518 . 43215) (
-TEDIT.ATOMBOUND.READTABLE 43217 . 44462)) (44792 45701 (\TEDIT.WHEELSCROLL 44802 . 45699)))))
+  (FILEMAP (NIL (7795 29756 (\TEDIT.INTERRUPT.SETUP 7805 . 9452) (\TEDIT.MARKACTIVE 9454 . 9666) (
+\TEDIT.MARKINACTIVE 9668 . 9884) (\TEDIT.COMMAND.LOOP 9886 . 23156) (\TEDIT.COMMAND.RESET.SETUP 23158
+ . 29754)) (30040 45237 (\TEDIT.READTABLE 30050 . 31707) (\TEDIT.WORDBOUND.READTABLE 31709 . 34302) (
+TEDIT.GETSYNTAX 34304 . 36743) (TEDIT.SETSYNTAX 36745 . 39223) (TEDIT.GETFUNCTION 39225 . 40585) (
+TEDIT.SETFUNCTION 40587 . 43026) (TEDIT.WORDGET 43028 . 43289) (TEDIT.WORDSET 43291 . 43988) (
+TEDIT.ATOMBOUND.READTABLE 43990 . 45235)) (45565 46474 (\TEDIT.WHEELSCROLL 45575 . 46472)))))
 STOP
diff --git a/library/tedit/TEDIT-COMMAND.LCOM b/library/tedit/TEDIT-COMMAND.LCOM
index 207a1dff..32b66ea8 100644
Binary files a/library/tedit/TEDIT-COMMAND.LCOM and b/library/tedit/TEDIT-COMMAND.LCOM differ
diff --git a/library/tedit/TEDIT-FILE b/library/tedit/TEDIT-FILE
index 7f379568..e6776c36 100644
--- a/library/tedit/TEDIT-FILE
+++ b/library/tedit/TEDIT-FILE
@@ -1,18 +1,18 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "31-Mar-2024 23:50:57" {MEDLEY}<library>tedit>TEDIT-FILE.;2 152351 
+(FILECREATED "31-Mar-2024 23:54:56" {WMEDLEY}<library>tedit>TEDIT-FILE.;528 154611 
 
       :EDIT-BY rmk
 
       :CHANGES-TO (FNS TEDIT.PUT)
 
-      :PREVIOUS-DATE "11-Mar-2024 00:38:51" {MEDLEY}<library>tedit>TEDIT-FILE.;1)
+      :PREVIOUS-DATE "26-Mar-2024 22:10:58" {WMEDLEY}<library>tedit>TEDIT-FILE.;527)
 
 
 (PRETTYCOMPRINT TEDIT-FILECOMS)
 
 (RPAQQ TEDIT-FILECOMS
-       ((DECLARE%: EVAL@COMPILE DONTCOPY (CONSTANTS (\PieceDescriptorLOOKS 0)
+       [(DECLARE%: EVAL@COMPILE DONTCOPY (CONSTANTS (\PieceDescriptorLOOKS 0)
                                                 (\PieceDescriptorOBJECT 1)
                                                 (\PieceDescriptorPARA 2)
                                                 (\PieceDescriptorPAGEFRAME 3)
@@ -24,8 +24,8 @@
         (COMS 
               (* ;; "Public entries ")
 
-              (FNS TEDIT.GET TEDIT.FORMATTEDFILEP TEDIT.FILEDATE \TEDIT.GET.IDATE3 TEDIT.INCLUDE 
-                   TEDIT.RAW.INCLUDE TEDIT.PUT TEDIT.PUT.STREAM)
+              (FNS TEDIT.GET TEDIT.FORMATTEDFILEP TEDIT.FILEDATE TEDIT.INCLUDE TEDIT.RAW.INCLUDE 
+                   TEDIT.PUT TEDIT.PUT.STREAM)
               
               (* ;; "Getting (pageframe functions on TEDIT-PAGE)")
 
@@ -37,7 +37,7 @@
   "Until CL:COMPILE-FILE and any others are updated, They should use the public TEDIT.FORMATTEDFILEP")
 
                     (P (MOVD? '\TEDIT.GET.TRAILER '\TEDIT.FORMATTEDP1]
-              (FNS \TEDIT.GET.PIECES3 \TEDIT.MAKE.STRINGPIECE)
+              (FNS \TEDIT.GET.PIECES3 \TEDIT.GET.IDATE3 \TEDIT.MAKE.STRINGPIECE)
               (FNS \TEDIT.GET.UNFORMATTED.FILE.XCCS \TEDIT.INTERPRET.XCCS.SHIFTS)
                                                              (* ; "XCCS")
               (FNS \TEDIT.GET.UNFORMATTED.FILE.UTF8)
@@ -45,7 +45,7 @@
               (FNS \TEDIT.GET.CHARLOOKS.LIST \TEDIT.GET.SINGLE.CHARLOOKS \TEDIT.GET.CHARLOOKS 
                    \TEDIT.GET.PARALOOKS.INDEX \TEDIT.GET.CHARLOOKS.INDEX)
               (FNS \TEDIT.GET.PARALOOKS.LIST \TEDIT.GET.SINGLE.PARALOOKS \TEDIT.GET.PARALOOKS)
-              (FNS TEDIT.GET.OBJECT))
+              (FNS \TEDIT.GET.OBJECT))
         (COMS 
               (* ;; "Putting (pageframe functions on TEDIT-PAGE)")
 
@@ -53,16 +53,14 @@
                    \TEDIT.PUT.UTF8.SPLITPIECES \TEDIT.PUT.PCTB.NEXTNEW \TEDIT.INSERT.NEWPIECES 
                    \TEDIT.PUTRESET \ARBOUT \ATMOUT \DWOUT \STRINGOUT)
               (FNS \TEDIT.PUT.CHARLOOKS.LIST \TEDIT.PUT.SINGLE.CHARLOOKS \TEDIT.PUT.CHARLOOKS 
-                   \TEDIT.PUT.CHARLOOKS1)
-              (FNS \TEDIT.PUT.PARALOOKS.LIST \TEDIT.PUT.SINGLE.PARALOOKS \TEDIT.PUT.PARALOOKS)
-              (FNS TEDIT.PUT.OBJECT))
+                   \TEDIT.PUT.CHARLOOKS1 \TEDIT.PUT.OBJECT)
+              (FNS \TEDIT.PUT.PARALOOKS.LIST \TEDIT.PUT.SINGLE.PARALOOKS \TEDIT.PUT.PARALOOKS))
         (GLOBALVARS TEDIT.INPUT.FORMATS *TEDIT-FILE-READTABLE*)
         (FNS TEDITFROMLISPSOURCE)
         (ADDVARS (TEDIT.INPUT.FORMATS (LISPSOURCEFILEP TEDITFROMLISPSOURCE)))
-        (INITVARS (*TEDIT-FILE-READTABLE* (COPYREADTABLE \ORIGREADTABLE))
-                                                             (* ; 
+        (INITVARS                                            (* ; 
                                          "For consistent reading and writing of info on TEdit files.")
-               )))
+               (*TEDIT-FILE-READTABLE* (COPYREADTABLE \ORIGREADTABLE])
 (DECLARE%: EVAL@COMPILE DONTCOPY 
 (DECLARE%: EVAL@COMPILE 
 
@@ -117,7 +115,9 @@
 (DEFINEQ
 
 (TEDIT.GET
-  [LAMBDA (TSTREAM FILE UNFORMATTED? PROPS)                  (* ; "Edited 21-Jan-2024 23:13 by rmk")
+  [LAMBDA (TSTREAM FILE UNFORMATTED? PROPS)                  (* ; "Edited 17-Mar-2024 18:17 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited 21-Jan-2024 23:13 by rmk")
                                                              (* ; "Edited 22-Sep-2023 20:16 by rmk")
                                                              (* ; "Edited 18-Sep-2023 16:41 by rmk")
                                                              (* ; "Edited  9-Sep-2023 17:24 by rmk")
@@ -158,16 +158,15 @@
                      T)
               (RETURN NIL))
           (RESETLST
-              (RESETSAVE (TTYDISPLAYSTREAM (OR (AND (NEQ 'DON'T (GETTOBJ TEXTOBJ PROMPTWINDOW)
-                                                         'DON'T)
+              (RESETSAVE (TTYDISPLAYSTREAM (OR (AND (NEQ 'DON'T (GETTOBJ TEXTOBJ PROMPTWINDOW))
                                                     (GETTOBJ TEXTOBJ PROMPTWINDOW))
                                                PROMPTWINDOW)))
 
               (* ;; "New file is good, clean out the old stuff")
 
-              (\SHOWSEL (TEXTSEL TEXTOBJ)
+              (\TEDIT.SHOWSEL (TEXTSEL TEXTOBJ)
                      NIL)
-              (\TEXTCLOSEF TEXTOBJ)                          (* ; 
+              (\TEDIT.TEXTCLOSEF TEXTOBJ)                    (* ; 
                                                              "Close the old files, still in TXTFILE")
 
               (* ;; "")
@@ -184,7 +183,7 @@
               (SETQ NTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of NTSTREAM))
               (replace (TEXTSTREAM TEXTOBJ) of TSTREAM with NTEXTOBJ)
               (SETTOBJ NTEXTOBJ STREAMHINT TSTREAM)
-              (\TEXTSETFILEPTR TSTREAM 0)
+              (\TEDIT.TEXTSETFILEPTR TSTREAM 0)
               (CL:WHEN MAINWINDOW
                   (\TEDIT.UPDATE.TITLE NTEXTOBJ)
                   (WINDOWPROP MAINWINDOW 'TEDITCREATED TEDITCREATED)
@@ -197,23 +196,29 @@
           (RETURN TSTREAM])
 
 (TEDIT.FORMATTEDFILEP
-  [LAMBDA (FILE)                                             (* ; "Edited 18-Jan-2024 10:29 by rmk")
+  [LAMBDA (FILE)                                             (* ; "Edited 26-Mar-2024 22:10 by rmk")
+                                                             (* ; "Edited 18-Jan-2024 10:29 by rmk")
                                                              (* ; "Edited 13-Jan-2024 11:57 by rmk")
                                                              (* ; "Edited 12-Jul-2023 23:35 by rmk")
 
     (* ;; "If FILE is a Tedit formatted stream or the name of a Tedit formatted file, returns a pair consistening of its version number and piececount.  Piececount is probably useless.")
 
-    (RESETLST
-        (LET ((STREAM (STREAMP FILE)))
-             [if STREAM
-                 then [RESETSAVE (GETFILEPTR FILE)
-                             `(PROGN (SETFILEPTR ,FILE OLDVALUE]
-               else (RESETSAVE (SETQ STREAM (OPENSTREAM FILE 'INPUT))
-                           `(PROGN (CLOSEF? OLDVALUE]
-             (\TEDIT.GET.TRAILER STREAM)))])
+    (CL:WHEN FILE
+        (RESETLST
+            (LET ((STREAM (GETSTREAM FILE 'INPUT T)))
+                 [if STREAM
+                     then [RESETSAVE (GETFILEPTR FILE)
+                                 `(PROGN (SETFILEPTR ,FILE OLDVALUE]
+                   else (RESETSAVE (SETQ STREAM (OPENSTREAM (CL:IF (STREAMP FILE)
+                                                                (FULLNAME FILE)
+                                                                FILE)
+                                                       'INPUT))
+                               `(PROGN (CLOSEF? OLDVALUE]
+                 (\TEDIT.GET.TRAILER STREAM))))])
 
 (TEDIT.FILEDATE
-  [LAMBDA (FILE INTEGER)                                     (* ; "Edited 18-Jan-2024 10:26 by rmk")
+  [LAMBDA (FILE INTEGER)                                     (* ; "Edited 26-Mar-2024 21:37 by rmk")
+                                                             (* ; "Edited 18-Jan-2024 10:26 by rmk")
                                                              (* ; "Edited 13-Jan-2024 10:20 by rmk")
                                                              (* ; "Edited 19-Dec-2023 10:13 by rmk")
                                                              (* ; "Edited  6-Dec-2023 20:11 by rmk")
@@ -223,51 +228,15 @@
 
     (* ;; "FILE must be random access.  If not, then presumably we first have to fetch the last 5+4+8 bytes to someplace else.")
 
-    (CL:WHEN FILE
-        (RESETLST
-            (LET ((STREAM (\GETSTREAM FILE 'INPUT T))
-                  IDATE)
-                 [if STREAM
-                     then [RESETSAVE (GETFILEPTR STREAM)
-                                 `(PROGN (SETFILEPTR ,STREAM OLDVALUE]
-                   else (RESETSAVE (SETQ STREAM (OPENSTREAM FILE 'INPUT))
-                               `(PROGN (CLOSEF? OLDVALUE]
-                 [SETQ IDATE (CAR (LAST (\TEDIT.GET.TRAILER STREAM]
-                 (CL:UNLESS IDATE
-                     (SETQ IDATE (GETFILEINFO STREAM 'ICREATIONDATE)))
-                 (CL:IF INTEGER
-                     IDATE
-                     (GDATE IDATE)))))])
-
-(\TEDIT.GET.IDATE3
-  [LAMBDA (STREAM END)                                       (* ; "Edited  6-Dec-2023 16:55 by rmk")
-
-    (* ;; "Returns the integer IDATE for slightly updated version 3 files, otherwise NIL.  4 for the bytes of the IDATE, 8 for the header. Leaves resets to starting position (assumes an error wouldn't matter).")
-
-    (CL:WHEN (IGREATERP END (IPLUS (CONSTANT (NCHARS "DATE:"))
-                                   4 8))
-        (LET ((FILEPTR (GETFILEPTR STREAM)))
-             (SETFILEPTR STREAM (IDIFFERENCE END (IPLUS (CONSTANT (NCHARS "DATE:"))
-                                                        4 8)))
-
-             (* ;; 
-     "DATE: is the marker for this extension to version 3 (could be removed if version is update).  ")
-
-             (PROG1 (CL:WHEN (AND (EQ (CHARCODE D)
-                                      (BIN STREAM))
-                                  (EQ (CHARCODE A)
-                                      (BIN STREAM))
-                                  (EQ (CHARCODE T)
-                                      (BIN STREAM))
-                                  (EQ (CHARCODE E)
-                                      (BIN STREAM))
-                                  (EQ (CHARCODE %:)
-                                      (BIN STREAM)))
-                           (\DWIN STREAM))
-                    (SETFILEPTR STREAM FILEPTR))))])
+    (LET [(IDATE (CAR (LAST (TEDIT.FORMATTEDFILEP FILE]
+         (CL:WHEN IDATE
+             (CL:IF INTEGER
+                 IDATE
+                 (GDATE IDATE)))])
 
 (TEDIT.INCLUDE
-  [LAMBDA (TSTREAM FILE START END SAFE PLAINTEXT)            (* ; "Edited 16-Feb-2024 23:54 by rmk")
+  [LAMBDA (TSTREAM FILE START END SAFE PLAINTEXT)            (* ; "Edited 17-Mar-2024 12:06 by rmk")
+                                                             (* ; "Edited 16-Feb-2024 23:54 by rmk")
                                                              (* ; "Edited 13-Jan-2024 09:39 by rmk")
                                                              (* ; "Edited 12-Nov-2023 12:29 by rmk")
                                                              (* ; "Edited 23-Jul-2023 15:30 by rmk")
@@ -384,7 +353,7 @@
 
          (* ;; "The exit conditions are not documented, but we set the fileptr to the end of the insertion and  return the length of the insertion.")
 
-              (\TEXTSETFILEPTR (FGETTOBJ TEXTOBJ STREAMHINT)
+              (\TEDIT.TEXTSETFILEPTR (FGETTOBJ TEXTOBJ STREAMHINT)
                      (SUB1 (FGETSEL TSEL CHLIM)))
               (RETURN (FGETSEL FSEL DCH))))])
 
@@ -398,7 +367,7 @@
     (TEDIT.INCLUDE TSTREAM INFILE START END SAFE T])
 
 (TEDIT.PUT
-  [LAMBDA (TSTREAM FILE FORCENEW UNFORMATTED? FORMAT)        (* ; "Edited 31-Mar-2024 23:50 by rmk")
+  [LAMBDA (TSTREAM FILE FORCENEW UNFORMATTED? FORMAT)        (* ; "Edited 31-Mar-2024 23:54 by rmk")
                                                              (* ; "Edited  7-Feb-2024 13:31 by rmk")
                                                              (* ; "Edited  4-Feb-2024 00:10 by rmk")
                                                              (* ; "Edited 22-Dec-2023 10:41 by rmk")
@@ -517,6 +486,8 @@
 
 (TEDIT.PUT.STREAM
   [LAMBDA (TSTREAM DESTSTREAM UNFORMATTED? EXTERNALFORMAT CONTINUE)
+                                                             (* ; "Edited 19-Mar-2024 21:38 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 17:29 by rmk")
                                                              (* ; "Edited  7-Feb-2024 12:41 by rmk")
                                                              (* ; "Edited  4-Feb-2024 00:19 by rmk")
                                                              (* ; "")
@@ -559,9 +530,10 @@
 
                       (\TEDIT.HISTORYADD TEXTOBJ (create TEDITHISTORYEVENT
                                                         THACTION _ :Put))
+                      DESTSTREAM
                elseif OPENEDHERE
                  then (OR (CLOSEF? DESTSTREAM)
-                          (FULLNMAE DESTSTREAM))
+                          (FULLNAME DESTSTREAM))
                else DESTSTREAM)))])
 )
 
@@ -572,7 +544,8 @@
 (DEFINEQ
 
 (\TEDIT.GET.FOREIGN.FILE
-  [LAMBDA (TEXT TSTREAM START END PROPS)                     (* ; "Edited 22-Oct-2023 20:40 by rmk")
+  [LAMBDA (TEXT TSTREAM START END PROPS)                     (* ; "Edited 17-Mar-2024 00:21 by rmk")
+                                                             (* ; "Edited 22-Oct-2023 20:40 by rmk")
                                                              (* ; "Edited 18-Sep-2023 16:40 by rmk")
                                                              (* ; "Edited 10-Aug-2023 17:26 by rmk")
                                                              (* ; "Edited  6-Sep-2022 12:18 by rmk")
@@ -603,7 +576,7 @@
                        (TEXTSTREAMP FSTREAM))                (* ; "Return NIL if we couldn't convert")
              (CL:UNLESS (EQ TSTREAM FSTREAM)
                  (SETQ FTEXTOBJ (TEXTOBJ FSTREAM))
-                 (\INSERTPIECES (\FIRSTPIECE FTEXTOBJ)
+                 (\TEDIT.INSERTPIECES (\TEDIT.FIRSTPIECE FTEXTOBJ)
                         NIL TTEXTOBJ)
                  (FSETTOBJ TTEXTOBJ LASTPIECE (FGETTOBJ FTEXTOBJ LASTPIECE))
                                                              (* ; "Last piece  have different looks")
@@ -613,7 +586,8 @@
              TSTREAM)])
 
 (\TEDIT.GET.UNFORMATTED.FILE
-  [LAMBDA (STREAM TSTREAM START END PROPS)                   (* ; "Edited  5-Feb-2024 09:26 by rmk")
+  [LAMBDA (STREAM TSTREAM START END PROPS)                   (* ; "Edited 17-Mar-2024 00:21 by rmk")
+                                                             (* ; "Edited  5-Feb-2024 09:26 by rmk")
                                                              (* ; "Edited 21-Jan-2024 09:42 by rmk")
                                                              (* ; "Edited 29-Dec-2023 11:52 by rmk")
                                                              (* ; "Edited 27-Dec-2023 13:33 by rmk")
@@ -670,10 +644,11 @@
                          PTYPE _ THINFILE.PTYPE
                          PBYTESPERCHAR _ 1
                          PBINABLE _ (fetch (STREAM BINABLE) of STREAM]
-             (\INSERTPIECES PIECES NIL TEXTOBJ)))])
+             (\TEDIT.INSERTPIECES PIECES NIL TEXTOBJ)))])
 
 (\TEDIT.GET.FORMATTED.FILE
-  [LAMBDA (TEXT TSTREAM START END PROPS)                     (* ; "Edited  5-Feb-2024 09:25 by rmk")
+  [LAMBDA (TEXT TSTREAM START END PROPS)                     (* ; "Edited 17-Mar-2024 00:21 by rmk")
+                                                             (* ; "Edited  5-Feb-2024 09:25 by rmk")
                                                              (* ; "Edited 21-Jan-2024 10:25 by rmk")
                                                              (* ; "Edited 18-Jan-2024 10:25 by rmk")
                                                              (* ; "Edited 27-Oct-2023 13:48 by rmk")
@@ -696,7 +671,7 @@
                     (CL:WHEN (\TEDIT.GET.IDATE3 TEXT END)    (* ; 
                                                            "IDATE means 3.1, LINELEADING above-hack.")
                         (FSETTOBJ TEXTOBJ TXTLINELEADINGABOVE T))
-                    (\INSERTPIECES (\TEDIT.GET.PIECES3 TEXT TEXTOBJ PCCOUNT START END)
+                    (\TEDIT.INSERTPIECES (\TEDIT.GET.PIECES3 TEXT TEXTOBJ PCCOUNT START END)
                            NIL TEXTOBJ))
                  (2                                          (* ; "Version 2;  obsoleted 5/22/85")
                     (\TEDIT.GET.PCTB2 TEXT TEXTOBJ PCCOUNT START END))
@@ -704,16 +679,17 @@
                                                    "Version 1;  obsoleted at INTERMEZZO release 2/85")
                     (\TEDIT.GET.PCTB1 TEXT TEXTOBJ PCCOUNT START END))
                  (0                                          (* ; "VERSION 0")
-                    (TEDIT.GET.PCTB0 TEXT TEXTOBJ (CADR PCCOUNT)
+                    (\TEDIT.GET.PCTB0 TEXT TEXTOBJ (CADR PCCOUNT)
                            PCCOUNT START END))
                  (SHOULDNT "File format version incompatible with this version of TEdit."))
-             (CL:WHEN (SETQ PC (PREVPIECE (\LASTPIECE TEXTOBJ)))
+             (CL:WHEN (SETQ PC (PREVPIECE (\TEDIT.LASTPIECE TEXTOBJ)))
                     (FSETPC PC PPARALAST T))
              (\TEDIT.TRANSLATE.ASCIICHARS TEXTOBJ NIL)
              TEXTOBJ)])
 
 (\TEDIT.FORMATTEDSTREAMP
-  [LAMBDA (TSTREAM)                                          (* ; "Edited 22-Sep-2023 20:17 by rmk")
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited 22-Sep-2023 20:17 by rmk")
                                                              (* ; "Edited 15-Sep-2023 00:09 by rmk")
                                                              (* ; "Edited 15-Aug-2023 17:35 by rmk")
                                                              (* ; "Edited 16-Sep-2022 21:00 by rmk")
@@ -727,7 +703,8 @@
          (for PC (FORMATLEVEL _ 0)
               (DEFAULTCLOOKS _ (FGETTOBJ TEXTOBJ DEFAULTCHARLOOKS))
               (DEFAULTPLOOKS _ (FGETTOBJ TEXTOBJ FMTSPEC))
-              (TENTATIVE _ (GETTEXTPROP TEXTOBJ 'TEDIT.TENTATIVE)) inpieces (\FIRSTPIECE TEXTOBJ)
+              (TENTATIVE _ (GETTEXTPROP TEXTOBJ 'TEDIT.TENTATIVE)) inpieces (\TEDIT.FIRSTPIECE 
+                                                                                   TEXTOBJ)
             do [COND
                   ((EQ OBJECT.PTYPE (PTYPE PC))              (* ; 
                                                              "OBJECTS require the special format")
@@ -735,11 +712,11 @@
                    (GO $$OUT))
                   ([OR (AND (PPARALAST PC)
                             (NEXTPIECE PC))
-                       (NOT (EQFMTSPEC DEFAULTPLOOKS (PPARALOOKS PC]
+                       (NOT (\TEDIT.EQFMTSPEC DEFAULTPLOOKS (PPARALOOKS PC]
                                                              (* ; 
                                                    "A paragraph break not at the end, or a new plook")
                    (SETQ FORMATLEVEL (IMAX FORMATLEVEL 3)))
-                  ((OR (NOT (EQCLOOKS DEFAULTCLOOKS (PLOOKS PC)))
+                  ((OR (NOT (\TEDIT.EQCLOOKS DEFAULTCLOOKS (PLOOKS PC)))
                        (AND TENTATIVE (PNEW PC)))            (* ; "Change in font, size, etc.")
                    (SETQ FORMATLEVEL (IMAX FORMATLEVEL 2)))
                   ((MEMB (PTYPE PC)
@@ -809,7 +786,8 @@
           (RETURN STR])
 
 (\TEDIT.GET.TRAILER
-  [LAMBDA (STREAM LEN)                                       (* ; "Edited 18-Jan-2024 10:22 by rmk")
+  [LAMBDA (STREAM LEN)                                       (* ; "Edited 26-Mar-2024 21:36 by rmk")
+                                                             (* ; "Edited 18-Jan-2024 10:22 by rmk")
                                                              (* ; "Edited 16-Jan-2024 22:39 by rmk")
                                                              (* ; "Edited 15-Jan-2024 17:38 by rmk")
                                                              (* ; "Edited 13-Jan-2024 21:49 by rmk")
@@ -830,7 +808,8 @@
                                   31415))
              (PROG1 (SELECTQ VERSION
                         (3                                   (* ; "Current version")
-                           (SETQ IDATE (\TEDIT.GET.IDATE3 STREAM LEN))
+                           [SETQ IDATE (OR (\TEDIT.GET.IDATE3 STREAM LEN)
+                                           (GETFILEINFO STREAM 'ICREATIONDATE]
                            (SETQ TRAILERSIZE (IPLUS 8 (CL:IF IDATE
                                                           (IPLUS (CONSTANT (NCHARS "DATE:"))
                                                                  4)
@@ -884,7 +863,9 @@
 (DEFINEQ
 
 (\TEDIT.GET.PIECES3
-  [LAMBDA (TEXT TEXTOBJ PCCOUNT CURFILEBYTE# END)            (* ; "Edited 14-Jan-2024 00:22 by rmk")
+  [LAMBDA (TEXT TEXTOBJ PCCOUNT CURFILEBYTE# END)            (* ; "Edited 20-Mar-2024 10:59 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:37 by rmk")
+                                                             (* ; "Edited 14-Jan-2024 00:22 by rmk")
                                                              (* ; "Edited 11-Jan-2024 12:37 by rmk")
                                                              (* ; "Edited 19-Dec-2023 10:13 by rmk")
                                                              (* ; "Edited  8-Dec-2023 22:49 by rmk")
@@ -895,7 +876,7 @@
 
     (* ;; "This runs through the Looks table portion of the TEXT file, gathering the looks and  installing pointers to positions in the character section of the file.  It doesn't actually examine the characters in the file.  It returns a piece chain that covers the text but that hasn't been installed in the btree.  The pieces need further adjustment for character encoding and to prevent mutlibyte characters from crossing buffer boundaries before they are installed in the btree.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (SETFILEPTR TEXT (IDIFFERENCE (OR END (GETEOFPTR TEXT))
                             8))
     (SETFILEPTR TEXT (\DWIN TEXT))                           (* ; "Pieceinfo byte #")
@@ -949,7 +930,7 @@
                            PPARALOOKS _ OLDPARALOOKS
                            PTYPE _ OBJECT.PTYPE
                            PREVPIECE _ PREVPC))
-                   (TEDIT.GET.OBJECT (GETTOBJ TEXTOBJ STREAMHINT)
+                   (\TEDIT.GET.OBJECT (GETTOBJ TEXTOBJ STREAMHINT)
                           PC TEXT CURFILEBYTE#)
                    (add CURFILEBYTE# BYTELEN)
                    (FSETPC PC PLOOKS (if (ZEROP (BIN TEXT))
@@ -1010,6 +991,33 @@
                                              (\TEDIT.INTERPRET.XCCS.SHIFTS PC TEXT))
                                       (RETURN PC])
 
+(\TEDIT.GET.IDATE3
+  [LAMBDA (STREAM END)                                       (* ; "Edited  6-Dec-2023 16:55 by rmk")
+
+    (* ;; "Returns the integer IDATE for slightly updated version 3 files, otherwise NIL.  4 for the bytes of the IDATE, 8 for the header. Leaves resets to starting position (assumes an error wouldn't matter).")
+
+    (CL:WHEN (IGREATERP END (IPLUS (CONSTANT (NCHARS "DATE:"))
+                                   4 8))
+        (LET ((FILEPTR (GETFILEPTR STREAM)))
+             (SETFILEPTR STREAM (IDIFFERENCE END (IPLUS (CONSTANT (NCHARS "DATE:"))
+                                                        4 8)))
+
+             (* ;; 
+     "DATE: is the marker for this extension to version 3 (could be removed if version is update).  ")
+
+             (PROG1 (CL:WHEN (AND (EQ (CHARCODE D)
+                                      (BIN STREAM))
+                                  (EQ (CHARCODE A)
+                                      (BIN STREAM))
+                                  (EQ (CHARCODE T)
+                                      (BIN STREAM))
+                                  (EQ (CHARCODE E)
+                                      (BIN STREAM))
+                                  (EQ (CHARCODE %:)
+                                      (BIN STREAM)))
+                           (\DWIN STREAM))
+                    (SETFILEPTR STREAM FILEPTR))))])
+
 (\TEDIT.MAKE.STRINGPIECE
   [LAMBDA (PC STRING)                                        (* ; "Edited 23-Jan-2024 14:32 by rmk")
                                                              (* ; "Edited 16-Jan-2024 11:15 by rmk")
@@ -1238,7 +1246,8 @@
 (DEFINEQ
 
 (\TEDIT.GET.UNFORMATTED.FILE.UTF8
-  [LAMBDA (STRM START END DEFAULTCHARLOOKS DEFAULTPARALOOKS) (* ; "Edited  4-Feb-2024 10:12 by rmk")
+  [LAMBDA (STRM START END DEFAULTCHARLOOKS DEFAULTPARALOOKS) (* ; "Edited 11-Mar-2024 23:55 by rmk")
+                                                             (* ; "Edited  4-Feb-2024 10:12 by rmk")
                                                              (* ; "Edited  2-Feb-2024 11:24 by rmk")
                                                              (* ; "Edited 21-Jan-2024 09:41 by rmk")
                                                              (* ; "Edited 12-Jan-2024 13:17 by rmk")
@@ -1257,12 +1266,16 @@
                             PPARALOOKS _ DEFAULTPARALOOKS))
           (NEXTCODESIZE _ 1)
           (SBINABLE _ (fetch (STREAM BINABLE) of STRM))
-          EOLC CHAR PREVPC PTYPE RUNLEN FILEPOS CRBEFORE CODESIZE PREVCRLF first (SETQ CODESIZE 
-                                                                                  NEXTCODESIZE) 
-                                                             (* ; "Assume Ascii to start")
-                                                                                 (SETQ PREVPC FIRSTPC
-                                                                                  ) 
-                                                             (* ; "FIRSTPC is a throwaway")
+          EOLC CHAR PREVPC PTYPE RUNLEN FILEPOS CRBEFORE CODESIZE PREVCRLF
+       first (SELECTQ (READBOM STRM)
+                 (:UTF-8 (add NEXTFILEPOS 3))
+                 ((:UTF-16BE :UTF-16LE)                      (* ; 
+                                        "Presumably we could create a single piece of the right type")
+                      (ERROR "BOM :UTF-16 not yet implemented")
+                      (add NEXTFILEPOS 2))
+                 NIL)
+             (SETQ CODESIZE NEXTCODESIZE)                    (* ; "Assume Ascii to start")
+             (SETQ PREVPC FIRSTPC)                           (* ; "FIRSTPC is a throwaway")
        do (SETQ FILEPOS NEXTFILEPOS)                         (* ; "Start of next file piece")
           (do 
               (* ;; "We stop extending if the next character wouold be out of range, go below to wrap up the final piece. ")
@@ -1582,7 +1595,7 @@
 )
 (DEFINEQ
 
-(TEDIT.GET.OBJECT
+(\TEDIT.GET.OBJECT
   [LAMBDA (TSTREAM PIECE FILE CURFILEBYTE# BYTELEN)          (* ; "Edited  5-Dec-2023 12:28 by rmk")
                                                              (* ; "Edited 26-Nov-2023 10:22 by rmk")
                                                              (* ; "Edited 21-Nov-2023 17:53 by rmk")
@@ -1638,6 +1651,7 @@
 
 (\TEDIT.PUT.PCTB
   [LAMBDA (TEXTOBJ CHARSTREAM FORMATSTREAM CONTINUE KEEPSEPARATE)
+                                                             (* ; "Edited 16-Mar-2024 12:40 by rmk")
                                                              (* ; "Edited 11-Mar-2024 00:33 by rmk")
                                                              (* ; "Edited 25-Jan-2024 00:00 by rmk")
                                                              (* ; "Edited 23-Jan-2024 13:43 by rmk")
@@ -1686,7 +1700,7 @@
          (*PRINT-BASE* _ 10)
          (EXTFORMAT _ (GETSTREAMPROP CHARSTREAM 'FORMAT))
          (EOLC _ (fetch (STREAM EOLCONVENTION) of CHARSTREAM))
-         (NSHIFTBYTES _ 0) inpieces (\FIRSTPIECE TEXTOBJ)
+         (NSHIFTBYTES _ 0) inpieces (\TEDIT.FIRSTPIECE TEXTOBJ)
        first 
              (* ;; "NSHIFTBYTES is for the continuation, so the new pieces can skip any charset shifting.  We can't hide them from the getfunction of version 3, since version 3 assumes that pieces are in contiguous bytes, we can't bump thePFPOS even though we could deal with it here.")
 
@@ -1713,9 +1727,11 @@
 
              (SETQ CURBYTE# (\GETFILEPTR CHARSTREAM))
              (SETQ OLDBYTE# CURBYTE#)
-             (SETQ NSHIFTBYTES (CL:WHEN (\FIRSTPIECE TEXTOBJ)(* ; 
+             (SETQ NSHIFTBYTES (CL:WHEN (\TEDIT.FIRSTPIECE TEXTOBJ)
+                                                             (* ; 
                                                     "Set up for first piece, possibly hiding shifts.")
-                                   (CHARSET CHARSTREAM (CL:IF (THINPIECEP (\FIRSTPIECE TEXTOBJ))
+                                   (CHARSET CHARSTREAM (CL:IF (THINPIECEP (\TEDIT.FIRSTPIECE TEXTOBJ)
+                                                                     )
                                                            0
                                                            T))
                                    (IDIFFERENCE (\GETFILEPTR CHARSTREAM)
@@ -1789,7 +1805,7 @@
               (UTF8.PTYPE (for I from 1 to PLEN do (\OUTCHAR CHARSTREAM (UTF8.INCCODEFN PFILE))))
               (OBJECT.PTYPE                                  (* ; 
                   "It's an object, use its PUTFN. Byte positions don't matter for continued editing.")
-                            (TEDIT.PUT.OBJECT PC CHARSTREAM FORMATSTREAM CURBYTE#)
+                            (\TEDIT.PUT.OBJECT PC CHARSTREAM FORMATSTREAM CURBYTE#)
                             (CL:WHEN NEWPIECES               (* ; 
                                                     "Link in the object piece, for continued editing")
                                 (SETQ NEXTNEW (FSETPC NEXTNEW NEXTPIECE
@@ -1886,14 +1902,15 @@
                                  (CHARCODE (EOL LF])])
 
 (\TEDIT.PUT.UTF8.SPLITPIECES
-  [LAMBDA (TEXTOBJ)                                          (* ; "Edited  3-Feb-2024 14:52 by rmk")
+  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 17-Mar-2024 00:14 by rmk")
+                                                             (* ; "Edited  3-Feb-2024 14:52 by rmk")
                                                              (* ; "Edited 11-Jan-2024 23:29 by rmk")
                                                              (* ; "Edited  5-Jan-2024 11:37 by rmk")
                                                              (* ; "Edited 30-Dec-2023 11:27 by rmk")
 
     (* ;; "We are putting to a UTF-8 format file. This function splits pieces if necessary to ensure that all the characters in a piece map to Unicode characters with the same-length UTF8 encoding. That length is stored in PUTF8BYTESPERCHAR.")
 
-    (for PC inpieces (\FIRSTPIECE TEXTOBJ)
+    (for PC inpieces (\TEDIT.FIRSTPIECE TEXTOBJ)
        do (SELECTC (PTYPE PC)
               (UTF8.PTYPE (FSETPC PC PUTF8BYTESPERCHAR (PBYTESPERCHAR PC)))
               (STRING.PTYPES (for CH BPC instring (PCONTENTS PC) as I from 1
@@ -1909,7 +1926,7 @@
                                                              "The first character defines the piece")
                                      elseif (EQ BPC (NUTF8-CODE-BYTES (UNICODE.TRANSLATE CH 
                                                                              *XCCSTOUNICODE*)))
-                                     else (\SPLITPIECE PC (SUB1 I)
+                                     else (\TEDIT.SPLITPIECE PC (SUB1 I)
                                                  TEXTOBJ)
                                           (SETQ PC (PREVPIECE PC)) 
                                                              (* ; 
@@ -1929,7 +1946,7 @@
                                       (FSETPC PC PUTF8BYTESPERCHAR BPC)
                                elseif (EQ BPC (NUTF8-CODE-BYTES (UNICODE.TRANSLATE (BIN PFILE)
                                                                        *XCCSTOUNICODE*)))
-                               else (\SPLITPIECE PC (SUB1 I)
+                               else (\TEDIT.SPLITPIECE PC (SUB1 I)
                                            TEXTOBJ)
                                     (SETQ PC (PREVPIECE PC))
                                     (FSETPC PC PUTF8BYTESPERCHAR BPC)
@@ -1947,7 +1964,7 @@
                                    )
                                   (FSETPC PC PUTF8BYTESPERCHAR BPC)
                            elseif (EQ BPC (NUTF8-CODE-BYTES (UNICODE.TRANSLATE CH *XCCSTOUNICODE*)))
-                           else (\SPLITPIECE PC (SUB1 I)
+                           else (\TEDIT.SPLITPIECE PC (SUB1 I)
                                        TEXTOBJ)
                                 (SETQ PC (PREVPIECE PC))
                                 (FSETPC PC PUTF8BYTESPERCHAR BPC)
@@ -2011,7 +2028,9 @@
     NEXTNEW])
 
 (\TEDIT.INSERT.NEWPIECES
-  [LAMBDA (STREAM TEXTOBJ NEWPIECES)                         (* ; "Edited  5-Feb-2024 09:24 by rmk")
+  [LAMBDA (STREAM TEXTOBJ NEWPIECES)                         (* ; "Edited 20-Mar-2024 10:59 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:06 by rmk")
+                                                             (* ; "Edited  5-Feb-2024 09:24 by rmk")
                                                              (* ; "Edited  3-Feb-2024 23:59 by rmk")
                                                              (* ; "Edited 21-Jan-2024 09:21 by rmk")
                                                              (* ; "Edited 12-Jan-2024 21:06 by rmk")
@@ -2021,13 +2040,13 @@
 
     (* ;; "This makes the pieces and BTREE of TEXTOBJ consistent with the NEWPIECES chain and the new STREAM.  The character numbers of old and new pieces correspond, so editing can continue without updating panes, lines, or selections (which are all based on character numbers, not particular pieces).  This puts STREAM as the PFILE of each new file piece and then installs NEWPIECES in TEXTOBJ, replacing the BTREE and pieces already there.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
 
     (* ;; "The \SETFILEPTR translates TSTREAM's buffer parameters to the new file. ")
 
     (LET ((TSTREAM (GETTOBJ TEXTOBJ STREAMHINT))
           FILEPTR)
-         (SETQ FILEPTR (\TEXTGETFILEPTR TSTREAM))            (* ; "Restore the editing parameters")
+         (SETQ FILEPTR (\TEDIT.TEXTGETFILEPTR TSTREAM))      (* ; "Restore the editing parameters")
          (for PC (SBINABLE _ (fetch (STREAM BINABLE) of STREAM)) inpieces NEWPIECES
             when (MEMB (PTYPE PC)
                        FILE.PTYPES) do (FSETPC PC PCONTENTS STREAM)
@@ -2037,13 +2056,13 @@
 
          (* ;; "Here, finally, we toss the out-of-date pieces to install the new ones. For complete safety, the rest should be uninterruptable (although the file has just been saved, so nothing would really be lost)")
 
-         (\MAKEPCTB TEXTOBJ)
-         (\INSERTPIECES NEWPIECES NIL TEXTOBJ)               (* ; 
+         (\TEDIT.MAKEPCTB TEXTOBJ)
+         (\TEDIT.INSERTPIECES NEWPIECES NIL TEXTOBJ)         (* ; 
                                                              "Build the tree, then fix the stream")
 
          (* ;; "This guards agains the possiblity that a sequence of edits somehow got the positioning parameters cached in the stream out of step with the document.  This ensures that they are consistent after all the pieces have been written out.")
 
-         (\TEXTSETFILEPTR TSTREAM (IMAX 0 (IMIN FILEPTR (FGETTOBJ TEXTOBJ TEXTLEN])
+         (\TEDIT.TEXTSETFILEPTR TSTREAM (IMAX 0 (IMIN FILEPTR (FGETTOBJ TEXTOBJ TEXTLEN])
 
 (\TEDIT.PUTRESET
   [LAMBDA (PROC&VALUE)                                       (* jds "15-May-85 16:38")
@@ -2238,6 +2257,39 @@
                                    2
                                    0)))                      (* ; "The index into the list of fonts")
     (\WOUT FORMATSTREAM CHARLOOKSINDEX])
+
+(\TEDIT.PUT.OBJECT
+  [LAMBDA (PIECE CHARSTREAM FORMATSTREAM CURFILEBYTE#)       (* ; "Edited 24-Jan-2024 23:35 by rmk")
+                                                             (* ; "Edited 13-Jan-2024 12:20 by rmk")
+                                                             (* ; "Edited 19-Dec-2023 10:14 by rmk")
+                                                             (* ; "Edited 26-Aug-2023 15:13 by rmk")
+                                                             (* ; "Edited 17-Jul-2023 16:39 by rmk")
+                                                             (* ; "Edited  6-Aug-2022 10:02 by rmk")
+                                                            (* ; "Edited 12-Jun-90 17:49 by mitani")
+
+    (* ;; "Given a piece which describes an object, put the object out there.")
+
+    (LET ((OBJECT (PCONTENTS PIECE))
+          (ORIGFILEPTR (GETFILEPTR FORMATSTREAM))
+          BYTELEN)
+         (\DWOUT FORMATSTREAM 0)                             (* ; 
+                                            "Placeholder for byte-length of the object's description")
+         (\WOUT FORMATSTREAM \PieceDescriptorOBJECT)         (* ; 
+                                                             "Mark this as setting the piece's looks")
+         (\ATMOUT FORMATSTREAM (IMAGEOBJPROP OBJECT 'GETFN)) (* ; 
+                                                          "The FN to apply to reconstruct the object")
+         (APPLY* (IMAGEOBJPROP OBJECT 'PUTFN)
+                OBJECT CHARSTREAM)
+         (SETQ BYTELEN (IDIFFERENCE (GETEOFPTR CHARSTREAM)
+                              CURFILEBYTE#))
+         (SETFILEPTR FORMATSTREAM ORIGFILEPTR)               (* ; 
+                          "Now go back and fill in the length of the text description of the object.")
+         (\DWOUT FORMATSTREAM BYTELEN)
+         (SETFILEPTR FORMATSTREAM -1)                        (* ; 
+                                                             "Move back to the end of the looks file")
+         (CL:WHEN (RANDACCESSP CHARSTREAM)                   (* ; "And the end of CHARSTREAM")
+             (SETFILEPTR CHARSTREAM -1))
+         BYTELEN])
 )
 (DEFINEQ
 
@@ -2361,41 +2413,6 @@
                          (GETHASH (PPARALOOKS PC)
                                 PARAHASH])
 )
-(DEFINEQ
-
-(TEDIT.PUT.OBJECT
-  [LAMBDA (PIECE CHARSTREAM FORMATSTREAM CURFILEBYTE#)       (* ; "Edited 24-Jan-2024 23:35 by rmk")
-                                                             (* ; "Edited 13-Jan-2024 12:20 by rmk")
-                                                             (* ; "Edited 19-Dec-2023 10:14 by rmk")
-                                                             (* ; "Edited 26-Aug-2023 15:13 by rmk")
-                                                             (* ; "Edited 17-Jul-2023 16:39 by rmk")
-                                                             (* ; "Edited  6-Aug-2022 10:02 by rmk")
-                                                            (* ; "Edited 12-Jun-90 17:49 by mitani")
-
-    (* ;; "Given a piece which describes an object, put the object out there.")
-
-    (LET ((OBJECT (PCONTENTS PIECE))
-          (ORIGFILEPTR (GETFILEPTR FORMATSTREAM))
-          BYTELEN)
-         (\DWOUT FORMATSTREAM 0)                             (* ; 
-                                            "Placeholder for byte-length of the object's description")
-         (\WOUT FORMATSTREAM \PieceDescriptorOBJECT)         (* ; 
-                                                             "Mark this as setting the piece's looks")
-         (\ATMOUT FORMATSTREAM (IMAGEOBJPROP OBJECT 'GETFN)) (* ; 
-                                                          "The FN to apply to reconstruct the object")
-         (APPLY* (IMAGEOBJPROP OBJECT 'PUTFN)
-                OBJECT CHARSTREAM)
-         (SETQ BYTELEN (IDIFFERENCE (GETEOFPTR CHARSTREAM)
-                              CURFILEBYTE#))
-         (SETFILEPTR FORMATSTREAM ORIGFILEPTR)               (* ; 
-                          "Now go back and fill in the length of the text description of the object.")
-         (\DWOUT FORMATSTREAM BYTELEN)
-         (SETFILEPTR FORMATSTREAM -1)                        (* ; 
-                                                             "Move back to the end of the looks file")
-         (CL:WHEN (RANDACCESSP CHARSTREAM)                   (* ; "And the end of CHARSTREAM")
-             (SETFILEPTR CHARSTREAM -1))
-         BYTELEN])
-)
 (DECLARE%: DOEVAL@COMPILE DONTCOPY
 
 (GLOBALVARS TEDIT.INPUT.FORMATS *TEDIT-FILE-READTABLE*)
@@ -2435,26 +2452,27 @@
 
 (RPAQ? *TEDIT-FILE-READTABLE* (COPYREADTABLE \ORIGREADTABLE))
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (4862 31358 (TEDIT.GET 4872 . 9548) (TEDIT.FORMATTEDFILEP 9550 . 10473) (TEDIT.FILEDATE 
-10475 . 12059) (\TEDIT.GET.IDATE3 12061 . 13456) (TEDIT.INCLUDE 13458 . 20311) (TEDIT.RAW.INCLUDE 
-20313 . 21121) (TEDIT.PUT 21123 . 28066) (TEDIT.PUT.STREAM 28068 . 31356)) (31420 49822 (
-\TEDIT.GET.FOREIGN.FILE 31430 . 34494) (\TEDIT.GET.UNFORMATTED.FILE 34496 . 38255) (
-\TEDIT.GET.FORMATTED.FILE 38257 . 40923) (\TEDIT.FORMATTEDSTREAMP 40925 . 43612) (\ARBIN 43614 . 44334
-) (\ATMIN 44336 . 44873) (\DWIN 44875 . 45254) (\STRINGIN 45256 . 45964) (\TEDIT.GET.TRAILER 45966 . 
-48291) (\TEDIT.CACHEFILE 48293 . 49820)) (49988 61366 (\TEDIT.GET.PIECES3 49998 . 59525) (
-\TEDIT.MAKE.STRINGPIECE 59527 . 61364)) (61367 73310 (\TEDIT.GET.UNFORMATTED.FILE.XCCS 61377 . 67493) 
-(\TEDIT.INTERPRET.XCCS.SHIFTS 67495 . 73308)) (73332 79153 (\TEDIT.GET.UNFORMATTED.FILE.UTF8 73342 . 
-79151)) (79176 87312 (\TEDIT.GET.CHARLOOKS.LIST 79186 . 79800) (\TEDIT.GET.SINGLE.CHARLOOKS 79802 . 
-84124) (\TEDIT.GET.CHARLOOKS 84126 . 85456) (\TEDIT.GET.PARALOOKS.INDEX 85458 . 86002) (
-\TEDIT.GET.CHARLOOKS.INDEX 86004 . 87310)) (87313 95551 (\TEDIT.GET.PARALOOKS.LIST 87323 . 87945) (
-\TEDIT.GET.SINGLE.PARALOOKS 87947 . 94959) (\TEDIT.GET.PARALOOKS 94961 . 95549)) (95552 98950 (
-TEDIT.GET.OBJECT 95562 . 98948)) (99012 130967 (\TEDIT.PUT.PCTB 99022 . 112765) (\TEDIT.PUT.TRAILER 
-112767 . 113534) (\TEDIT.PUT.PCTB.MERGEABLE 113536 . 117054) (\TEDIT.PUT.UTF8.SPLITPIECES 117056 . 
-122010) (\TEDIT.PUT.PCTB.NEXTNEW 122012 . 125787) (\TEDIT.INSERT.NEWPIECES 125789 . 128565) (
-\TEDIT.PUTRESET 128567 . 128809) (\ARBOUT 128811 . 129535) (\ATMOUT 129537 . 130142) (\DWOUT 130144 . 
-130423) (\STRINGOUT 130425 . 130965)) (130968 140097 (\TEDIT.PUT.CHARLOOKS.LIST 130978 . 132650) (
-\TEDIT.PUT.SINGLE.CHARLOOKS 132652 . 137896) (\TEDIT.PUT.CHARLOOKS 137898 . 139042) (
-\TEDIT.PUT.CHARLOOKS1 139044 . 140095)) (140098 148136 (\TEDIT.PUT.PARALOOKS.LIST 140108 . 141010) (
-\TEDIT.PUT.SINGLE.PARALOOKS 141012 . 147061) (\TEDIT.PUT.PARALOOKS 147063 . 148134)) (148137 150410 (
-TEDIT.PUT.OBJECT 148147 . 150408)) (150505 152187 (TEDITFROMLISPSOURCE 150515 . 152185)))))
+  (FILEMAP (NIL (4828 30439 (TEDIT.GET 4838 . 9680) (TEDIT.FORMATTEDFILEP 9682 . 10998) (TEDIT.FILEDATE 
+11000 . 12171) (TEDIT.INCLUDE 12173 . 19141) (TEDIT.RAW.INCLUDE 19143 . 19951) (TEDIT.PUT 19953 . 
+26896) (TEDIT.PUT.STREAM 26898 . 30437)) (30501 49665 (\TEDIT.GET.FOREIGN.FILE 30511 . 33696) (
+\TEDIT.GET.UNFORMATTED.FILE 33698 . 37572) (\TEDIT.GET.FORMATTED.FILE 37574 . 40362) (
+\TEDIT.FORMATTEDSTREAMP 40364 . 43264) (\ARBIN 43266 . 43986) (\ATMIN 43988 . 44525) (\DWIN 44527 . 
+44906) (\STRINGIN 44908 . 45616) (\TEDIT.GET.TRAILER 45618 . 48134) (\TEDIT.CACHEFILE 48136 . 49663)) 
+(49831 62818 (\TEDIT.GET.PIECES3 49841 . 59580) (\TEDIT.GET.IDATE3 59582 . 60977) (
+\TEDIT.MAKE.STRINGPIECE 60979 . 62816)) (62819 74762 (\TEDIT.GET.UNFORMATTED.FILE.XCCS 62829 . 68945) 
+(\TEDIT.INTERPRET.XCCS.SHIFTS 68947 . 74760)) (74784 80806 (\TEDIT.GET.UNFORMATTED.FILE.UTF8 74794 . 
+80804)) (80829 88965 (\TEDIT.GET.CHARLOOKS.LIST 80839 . 81453) (\TEDIT.GET.SINGLE.CHARLOOKS 81455 . 
+85777) (\TEDIT.GET.CHARLOOKS 85779 . 87109) (\TEDIT.GET.PARALOOKS.INDEX 87111 . 87655) (
+\TEDIT.GET.CHARLOOKS.INDEX 87657 . 88963)) (88966 97204 (\TEDIT.GET.PARALOOKS.LIST 88976 . 89598) (
+\TEDIT.GET.SINGLE.PARALOOKS 89600 . 96612) (\TEDIT.GET.PARALOOKS 96614 . 97202)) (97205 100604 (
+\TEDIT.GET.OBJECT 97215 . 100602)) (100666 133237 (\TEDIT.PUT.PCTB 100676 . 114679) (
+\TEDIT.PUT.TRAILER 114681 . 115448) (\TEDIT.PUT.PCTB.MERGEABLE 115450 . 118968) (
+\TEDIT.PUT.UTF8.SPLITPIECES 118970 . 124057) (\TEDIT.PUT.PCTB.NEXTNEW 124059 . 127834) (
+\TEDIT.INSERT.NEWPIECES 127836 . 130835) (\TEDIT.PUTRESET 130837 . 131079) (\ARBOUT 131081 . 131805) (
+\ATMOUT 131807 . 132412) (\DWOUT 132414 . 132693) (\STRINGOUT 132695 . 133235)) (133238 144631 (
+\TEDIT.PUT.CHARLOOKS.LIST 133248 . 134920) (\TEDIT.PUT.SINGLE.CHARLOOKS 134922 . 140166) (
+\TEDIT.PUT.CHARLOOKS 140168 . 141312) (\TEDIT.PUT.CHARLOOKS1 141314 . 142365) (\TEDIT.PUT.OBJECT 
+142367 . 144629)) (144632 152670 (\TEDIT.PUT.PARALOOKS.LIST 144642 . 145544) (
+\TEDIT.PUT.SINGLE.PARALOOKS 145546 . 151595) (\TEDIT.PUT.PARALOOKS 151597 . 152668)) (152765 154447 (
+TEDITFROMLISPSOURCE 152775 . 154445)))))
 STOP
diff --git a/library/tedit/TEDIT-FILE.LCOM b/library/tedit/TEDIT-FILE.LCOM
index 783a8d9d..e9f5dece 100644
Binary files a/library/tedit/TEDIT-FILE.LCOM and b/library/tedit/TEDIT-FILE.LCOM differ
diff --git a/library/tedit/TEDIT-FIND b/library/tedit/TEDIT-FIND
index 8eafce01..bdfc8eaf 100644
--- a/library/tedit/TEDIT-FIND
+++ b/library/tedit/TEDIT-FIND
@@ -1,12 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 4-Mar-2024 22:50:23" {WMEDLEY}<library>tedit>TEDIT-FIND.;93 29098  
+(FILECREATED "17-Mar-2024 12:06:12" {WMEDLEY}<library>tedit>TEDIT-FIND.;102 30083  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS TEDIT.SUBSTITUTE)
+      :CHANGES-TO (FNS \TEDIT.BASICFIND \TEDIT.BASICFIND.BACKWARD \TEDIT.WCFIND.BACKWARD)
 
-      :PREVIOUS-DATE " 3-Mar-2024 20:44:51" {WMEDLEY}<library>tedit>TEDIT-FIND.;92)
+      :PREVIOUS-DATE "15-Mar-2024 14:10:05" {WMEDLEY}<library>tedit>TEDIT-FIND.;98)
 
 
 (PRETTYCOMPRINT TEDIT-FINDCOMS)
@@ -85,7 +85,9 @@
                             TARGETSTRING START END)))))])
 
 (TEDIT.SUBSTITUTE
-  [LAMBDA (TEXTSTREAM PATTERN REPLACEMENT CONFIRM?)          (* ; "Edited  3-Mar-2024 12:24 by rmk")
+  [LAMBDA (TEXTSTREAM PATTERN REPLACEMENT CONFIRM?)          (* ; "Edited 15-Mar-2024 14:09 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:36 by rmk")
+                                                             (* ; "Edited  3-Mar-2024 12:24 by rmk")
                                                              (* ; "Edited 29-Feb-2024 17:00 by rmk")
                                                              (* ; "Edited 27-Feb-2024 08:20 by rmk")
                                                              (* ; "Edited  6-Jan-2024 11:09 by rmk")
@@ -120,7 +122,7 @@
               (if (type? SELPIECES REPLACEMENT)
                 elseif (OR (STRINGP REPLACEMENT)
                            (LITATOM REPLACEMENT))
-                  then (SETQ REPLACEMENT (\SELPIECES.FROM.STRING REPLACEMENT TEXTOBJ))
+                  then (SETQ REPLACEMENT (\TEDIT.SELPIECES.FROM.STRING REPLACEMENT TEXTOBJ))
                 elseif (LISTP REPLACEMENT)
                   then (HELP "LISTP REPLACEMENT"))
 
@@ -144,8 +146,9 @@
                                                 "ing...")
                      T)
               (SETQ SEL (fetch (TEXTOBJ SEL) of TEXTOBJ))
-              (\SHOWSEL SEL NIL)
-              (TEDIT.RESET.EXTEND.PENDING.DELETE SEL)        (* ; "Turn off any blue pending delete")
+              (\TEDIT.SHOWSEL SEL NIL)
+              (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ)
+                                                             (* ; "Turn off any blue pending delete")
 
          (* ;; "STARTCHAR# and ENDCHAR# bound each search. ENDCHAR# has to be reduced as STARTCHAR# increases, so the search stays within the selection.")
 
@@ -163,14 +166,14 @@
                                                       (ADD1 (IDIFFERENCE (CADR RANGE)
                                                                    (CAR RANGE)))
                                                       'RIGHT T))
-                             (\SHOWSEL PENDING.SEL T)
+                             (\TEDIT.SHOWSEL PENDING.SEL T)
                              (TEDIT.NORMALIZECARET TEXTOBJ PENDING.SEL)
                              (SELECTQ (U-CASE (NTHCHAR (TEDIT.GETINPUT TEXTOBJ 
                                                               "OK to replace? ['q' quits]" "Yes")
                                                      1))
                                  (Q (RETURN))
                                  (Y                          (* ; "Do this one")
-                                    (\TEDIT.REPLACE.SELPIECES (\SELPIECES.COPY REPLACEMENT
+                                    (\TEDIT.REPLACE.SELPIECES (\TEDIT.SELPIECES.COPY REPLACEMENT
                                                                      'COPY TEXTOBJ)
                                            TEXTOBJ PENDING.SEL)
                                     (add NREPLACEMENTS 1)
@@ -189,9 +192,8 @@
                      (* ;; "No confirmation required.  Do the substitutions without showing intermediate work, collect all of the replacement events")
 
                      (bind FIRSTHIT HITLEN HITDIFF (TOTALDIFF _ 0)
-                           (SAVESEL _ (\COPYSEL SEL)) while (SETQ RANGE
-                                                             (TEDIT.FIND TEXTOBJ SEARCHSTRING 
-                                                                    STARTCHAR# ENDCHAR# T))
+                           (SAVESEL _ (\TEDIT.COPYSEL SEL))
+                        while (SETQ RANGE (TEDIT.FIND TEXTOBJ SEARCHSTRING STARTCHAR# ENDCHAR# T))
                         collect (CL:UNLESS FIRSTHIT          (* ; "For final line updating.")
                                     (SETQ FIRSTHIT (CAR RANGE)))
                               [SETQ HITLEN (ADD1 (IDIFFERENCE (CADR RANGE)
@@ -199,7 +201,8 @@
                               (\TEDIT.UPDATE.SEL SEL (CAR RANGE)
                                      HITLEN
                                      'RIGHT)
-                              (\TEDIT.REPLACE.SELPIECES (\SELPIECES.COPY REPLACEMENT 'COPY TEXTOBJ)
+                              (\TEDIT.REPLACE.SELPIECES (\TEDIT.SELPIECES.COPY REPLACEMENT
+                                                               'COPY TEXTOBJ)
                                      TEXTOBJ SEL)
                               (add NREPLACEMENTS 1)
                               (SETQ STARTCHAR# (GETSEL SEL CHLIM))
@@ -218,7 +221,7 @@
 
                                  (* ;; "We want the new selection to begin at the beginning of the original selection, somewhere before the first hit, and end at the position that the prior ending moved to.  The text grew or shrank with each hit.")
 
-                                    (\SHOWSEL SEL NIL)
+                                    (\TEDIT.SHOWSEL SEL NIL)
                                     (\TEDIT.UPDATE.SEL SEL (GETSEL SAVESEL CH#)
                                            (IPLUS (GETSEL SAVESEL DCH)
                                                   TOTALDIFF)
@@ -227,10 +230,10 @@
 
          (* ;; "Save the search & replacement strings to offer for next time:")
 
-              (\SHOWSEL SEL T)
+              (\TEDIT.SHOWSEL SEL T)
               (PUTTEXTPROP TEXTOBJ 'TEDIT.LAST.SUBSTITUTE.STRING SEARCHSTRING)
-              (PUTTEXTPROP TEXTOBJ 'TEDIT.LAST.REPLACEMENT.STRING (\SELPIECES.TO.STRING REPLACEMENT 
-                                                                         NIL TEXTOBJ))
+              (PUTTEXTPROP TEXTOBJ 'TEDIT.LAST.REPLACEMENT.STRING (\TEDIT.SELPIECES.TO.STRING 
+                                                                         REPLACEMENT NIL TEXTOBJ))
               (TEDIT.PROMPTPRINT TEXTOBJ (SELECTQ NREPLACEMENTS
                                              (0 (CONCAT " No " ACTIONSTRING "ions made"))
                                              (1 (CONCAT " 1 " ACTIONSTRING "ion made"))
@@ -240,7 +243,8 @@
               (RETURN NREPLACEMENTS)))])
 
 (TEDIT.NEXT
-  [LAMBDA (STREAM)                                           (* ; "Edited 16-Feb-2024 23:48 by rmk")
+  [LAMBDA (STREAM)                                           (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited 16-Feb-2024 23:48 by rmk")
                                                              (* ; "Edited 14-Dec-2023 21:20 by rmk")
                                                              (* ; "Edited 20-Jun-2023 00:05 by rmk")
                                                              (* ; "Edited  3-May-2023 23:47 by rmk")
@@ -269,7 +273,7 @@
                      (replace (TEXTOBJ BLUEPENDINGDELETE) of TEXTOBJ with T)
                                                              (* ; 
                                          "Original comment: %"never pending a deletion%", but it is!")
-                     (\SHOWSEL SEL NIL)                      (* ; 
+                     (\TEDIT.SHOWSEL SEL NIL)                (* ; 
                                                              "Set up SELECTION to be the found text")
                      (\TEDIT.UPDATE.SEL SEL (CAR TARGET)
                             (IDIFFERENCE (ADD1 (CADR TARGET))
@@ -277,11 +281,11 @@
                             'RIGHT)
                      (\TEDIT.SET.SEL.LOOKS SEL 'PENDINGDEL)  (* ; "Always selected normally")
                      (TEDIT.NORMALIZECARET TEXTOBJ)          (* ; "And get it into the window")
-                     (\SHOWSEL SEL T))
+                     (\TEDIT.SHOWSEL SEL T))
              (FIELD                                          (* ; 
    "Update the selection for this textobj from the scratch sel returned from MBUTTON.FIND.NEXT.FIELD")
                     (FSETTOBJ TEXTOBJ BLUEPENDINGDELETE T)
-                    (\SHOWSEL SEL NIL)                       (* ; 
+                    (\TEDIT.SHOWSEL SEL NIL)                 (* ; 
                                                              "Set SELECTION to be the found text")
                     (\TEDIT.UPDATE.SEL SEL (GETSEL FIELDSEL CH#)
                            (GETSEL FIELDSEL DCH)
@@ -340,7 +344,8 @@
                         (OR HITSTART (CAR RESULT])])
 
 (\TEDIT.BASICFIND
-  [LAMBDA (TSTREAM TARGETSTRING START END ANCHORED)          (* ; "Edited 20-Jun-2023 00:11 by rmk")
+  [LAMBDA (TSTREAM TARGETSTRING START END ANCHORED)          (* ; "Edited 17-Mar-2024 12:06 by rmk")
+                                                             (* ; "Edited 20-Jun-2023 00:11 by rmk")
                                                              (* ; "Edited 30-May-91 20:56 by jds")
 
     (* ;; "Search thru TEXTOBJ, starting where the caret is, for an exact match of TARGETSTRING.  Optionally, start the search at character START. ")
@@ -352,7 +357,7 @@
           (ANCHOR _ (SUB1 START)) first [SETQ LASTANCHOR (ADD1 (CL:IF ANCHORED
                                                                    ANCHOR
                                                                    (IDIFFERENCE END NCHARS))]
-       eachtime (\TEXTSETFILEPTR TSTREAM ANCHOR) 
+       eachtime (\TEDIT.TEXTSETFILEPTR TSTREAM ANCHOR) 
 
              (* ;; "Match failed, bump the start--single char wild-card # always matches")
  while [SETQ ANCHOR (find A from (ADD1 ANCHOR) to LASTANCHOR suchthat (EQ CHAR1 (BIN TSTREAM]
@@ -362,14 +367,15 @@
        do (RETURN (LIST ANCHOR (IPLUS ANCHOR (SUB1 NCHARS])
 
 (\TEDIT.WCFIND.BACKWARD
-  [LAMBDA (TSTREAM TARGETLIST START END HITEND ANCHORED)     (* ; "Edited 20-Jun-2023 13:52 by rmk")
+  [LAMBDA (TSTREAM TARGETLIST START END HITEND ANCHORED)     (* ; "Edited 17-Mar-2024 11:59 by rmk")
+                                                             (* ; "Edited 20-Jun-2023 13:52 by rmk")
 
     (* ;; "Returns the (start end) pair of a match possibly with wild cards, where HITEND is the last character of such a match")
 
     (LET (RESULT)
          (COND
             ((NULL TARGETLIST)                               (* ; "Final match")
-             (LIST (ADD1 (\TEXTGETFILEPTR TSTREAM))
+             (LIST (ADD1 (\TEDIT.TEXTGETFILEPTR TSTREAM))
                    (OR HITEND END)))
             [(EQ '%# (CAR TARGETLIST))                       (* ; 
                                                     "Single-char wildcard, next segment is anchored ")
@@ -398,7 +404,8 @@
                     (OR HITEND (CADR RESULT])
 
 (\TEDIT.BASICFIND.BACKWARD
-  [LAMBDA (TSTREAM TARGETSTRING START END ANCHORED)          (* ; "Edited 12-Jul-2023 08:14 by rmk")
+  [LAMBDA (TSTREAM TARGETSTRING START END ANCHORED)          (* ; "Edited 17-Mar-2024 12:06 by rmk")
+                                                             (* ; "Edited 12-Jul-2023 08:14 by rmk")
                                                              (* ; "Edited 23-Apr-2023 12:42 by rmk")
 
     (* ;; "Returns a (Startmatch Endmatch) pair of character positions in TSTREAM that denote the nearest occurrence of TARGETSTRING whose first character is at or ahead of START and whose last character is at or before END. ")
@@ -421,26 +428,28 @@
              (CL:WHEN (ILESSP (IDIFFERENCE END START)
                              NCHARS1)                        (* ; "Too few characters")
                  (RETURN NIL))
-             (\TEXTSETFILEPTR TSTREAM (SUB1 END))
-             (CL:WHEN [AND (EQ CHARN (\TEXTPEEKBIN TSTREAM))
+             (\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 END))
+             (CL:WHEN [AND (EQ CHARN (\TEDIT.TEXTPEEKBIN TSTREAM))
                            (OR (EQ NCHARS1 0)
                                (for I from NCHARS1 to 1 by -1 always (EQ (NTHCHARCODE TARGETSTRING I)
-                                                                         (\TEXTBACKFILEPTR TSTREAM]
+                                                                         (\TEDIT.TEXTBACKFILEPTR
+                                                                          TSTREAM]
                  (RETURN (LIST (IDIFFERENCE END NCHARS1)
                                END)))
              (CL:WHEN ANCHORED                               (* ; "Anchored at END, didn't match")
                  (RETURN NIL))
              (SETQ ANCHOR (SUB1 END))
-             (SETQ LASTANCHOR (IPLUS START NCHARS1)) eachtime (\TEXTSETFILEPTR TSTREAM ANCHOR) 
+             (SETQ LASTANCHOR (IPLUS START NCHARS1)) eachtime (\TEDIT.TEXTSETFILEPTR TSTREAM ANCHOR)
                                                              (* ; 
                                                        "The filepos one before  the last CHARN match")
                                                            (ADD ANCHOR -1) 
                                                              (* ; "For next attempt")
-       while (find old ANCHOR from ANCHOR to LASTANCHOR by -1 suchthat (EQ CHARN (\TEXTBACKFILEPTR
+       while (find old ANCHOR from ANCHOR to LASTANCHOR by -1 suchthat (EQ CHARN (
+                                                                               \TEDIT.TEXTBACKFILEPTR
                                                                                   TSTREAM)))
        when [OR (EQ NCHARS1 0)
                 (for I from NCHARS1 to 1 by -1 always (EQ (NTHCHARCODE TARGETSTRING I)
-                                                          (\TEXTBACKFILEPTR TSTREAM]
+                                                          (\TEDIT.TEXTBACKFILEPTR TSTREAM]
        do (ADD ANCHOR 1)
           (RETURN (LIST (IDIFFERENCE ANCHOR NCHARS1)
                         ANCHOR])
@@ -482,8 +491,8 @@
                                                TARGETSTRING)])
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (782 18465 (TEDIT.FIND 792 . 2432) (TEDIT.FIND.BACKWARD 2434 . 4247) (TEDIT.SUBSTITUTE 
-4249 . 14573) (TEDIT.NEXT 14575 . 18463)) (18498 29075 (\TEDIT.WCFIND 18508 . 20509) (\TEDIT.BASICFIND
- 20511 . 21874) (\TEDIT.WCFIND.BACKWARD 21876 . 23820) (\TEDIT.BASICFIND.BACKWARD 23822 . 27052) (
-\TEDIT.PARSE.SEARCHSTRING 27054 . 29073)))))
+  (FILEMAP (NIL (832 18922 (TEDIT.FIND 842 . 2482) (TEDIT.FIND.BACKWARD 2484 . 4297) (TEDIT.SUBSTITUTE 
+4299 . 14915) (TEDIT.NEXT 14917 . 18920)) (18955 30060 (\TEDIT.WCFIND 18965 . 20966) (\TEDIT.BASICFIND
+ 20968 . 22446) (\TEDIT.WCFIND.BACKWARD 22448 . 24507) (\TEDIT.BASICFIND.BACKWARD 24509 . 28037) (
+\TEDIT.PARSE.SEARCHSTRING 28039 . 30058)))))
 STOP
diff --git a/library/tedit/TEDIT-FIND.LCOM b/library/tedit/TEDIT-FIND.LCOM
index 5371e31f..9c1647ac 100644
Binary files a/library/tedit/TEDIT-FIND.LCOM and b/library/tedit/TEDIT-FIND.LCOM differ
diff --git a/library/tedit/TEDIT-FNKEYS b/library/tedit/TEDIT-FNKEYS
index 46b1ed2a..266fcfad 100644
--- a/library/tedit/TEDIT-FNKEYS
+++ b/library/tedit/TEDIT-FNKEYS
@@ -1,12 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 4-Mar-2024 22:50:23" {WMEDLEY}<library>tedit>TEDIT-FNKEYS.;68 32048  
+(FILECREATED "15-Mar-2024 14:07:55" {WMEDLEY}<library>tedit>TEDIT-FNKEYS.;74 32961  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS \TEDIT.LCASE.SEL \TEDIT.UCASE.SEL)
+      :CHANGES-TO (FNS \TEDIT.LCASE.SEL \TEDIT.UCASE.SEL \TEDIT.KEY.FIND)
 
-      :PREVIOUS-DATE " 3-Mar-2024 20:44:44" {WMEDLEY}<library>tedit>TEDIT-FNKEYS.;67)
+      :PREVIOUS-DATE " 9-Mar-2024 11:47:31" {WMEDLEY}<library>tedit>TEDIT-FNKEYS.;69)
 
 
 (PRETTYCOMPRINT TEDIT-FNKEYSCOMS)
@@ -164,7 +164,9 @@
                                              NIL TEXTOBJ])
 
 (\TEDIT.KEY.FIND
-  [LAMBDA (TEXTSTREAM TEXTOBJ SEL AGAIN BACKWARD)            (* ; "Edited 29-Feb-2024 17:06 by rmk")
+  [LAMBDA (TEXTSTREAM TEXTOBJ SEL AGAIN BACKWARD)            (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:36 by rmk")
+                                                             (* ; "Edited 29-Feb-2024 17:06 by rmk")
                                                              (* ; "Edited 27-Feb-2024 00:22 by rmk")
                                                              (* ; "Edited 16-Feb-2024 23:43 by rmk")
                                                              (* ; "Edited 14-Dec-2023 21:14 by rmk")
@@ -195,7 +197,7 @@
          (CL:WHEN TARGET
              (CL:UNLESS SEL
                  (SETQ SEL (FGETTOBJ TEXTOBJ SEL)))
-             (\SHOWSEL SEL NIL)                              (* ; 
+             (\TEDIT.SHOWSEL SEL NIL)                        (* ; 
                                                             "Save for next search, even if not found")
              (PUTTEXTPROP TEXTOBJ 'TEDIT.LAST.FIND.STRING TARGET)
              (SETQ CH (if BACKWARD
@@ -211,7 +213,8 @@
              (COND
                 (CH (TEDIT.PROMPTPRINT TEXTOBJ (CONCAT "%"" TARGET "%" found")
                            T)                                (* ; "We found the target text.")
-                    (TEDIT.RESET.EXTEND.PENDING.DELETE SEL)  (* ; 
+                    (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ)
+                                                             (* ; 
                                                              "Set up SELECTION to be the found text")
                     (\TEDIT.UPDATE.SEL SEL (CAR CH)
                            (ADD1 (IDIFFERENCE (CADR CH)
@@ -227,11 +230,11 @@
                                                       'WORD
                                                       'CHAR]
                     (FSETTOBJ TEXTOBJ CARETLOOKS (\TEDIT.GET.INSERT.CHARLOOKS TEXTOBJ SEL))
-                    (\FIXSEL SEL TEXTOBJ)
+                    (\TEDIT.FIXSEL SEL TEXTOBJ)
                     (TEDIT.NORMALIZECARET TEXTOBJ))
                 (T (TEDIT.PROMPTPRINT TEXTOBJ (CONCAT "%"" TARGET "%" not found")
                           T)))
-             (\SHOWSEL SEL T))])
+             (\TEDIT.SHOWSEL SEL T))])
 
 (\TEDIT.GET.TARGET.STRING
   [LAMBDA (TEXTOBJ PROP)                                     (* ; "Edited 29-Feb-2024 17:08 by rmk")
@@ -284,13 +287,16 @@
                  SEL])
 
 (\TEDIT.LCASE.SEL
-  [LAMBDA (STREAM TEXTOBJ SEL)                               (* ; "Edited  3-Mar-2024 12:28 by rmk")
+  [LAMBDA (STREAM TEXTOBJ SEL)                               (* ; "Edited 15-Mar-2024 13:57 by rmk")
+                                                             (* ; "Edited  3-Mar-2024 12:28 by rmk")
                                                              (* ; "Edited 28-May-2023 00:34 by rmk")
                                                              (* ; "Edited 24-May-2023 22:46 by rmk")
 
     (* ;; "uppercasifies the selection.  This changes the :Replace THACTION to :LowerCase for REDO. That could be stored in another field, in which case undo wouldn't need to know.  Or maybe the transformation function should be stored.")
 
-    (\TEDIT.REPLACE.SELPIECES (\SELPIECES.CHARTRANSFORM (\SELPIECES.COPY (\SELPIECES SEL))
+    (\TEDIT.REPLACE.SELPIECES (\TEDIT.SELPIECES.CHARTRANSFORM (\TEDIT.SELPIECES.COPY (
+                                                                                     \TEDIT.SELPIECES
+                                                                                      SEL))
                                      (FUNCTION L-CASECODE)
                                      NIL TEXTOBJ)
            TEXTOBJ SEL)
@@ -339,13 +345,16 @@
            SEL])
 
 (\TEDIT.UCASE.SEL
-  [LAMBDA (STREAM TEXTOBJ SEL)                               (* ; "Edited  3-Mar-2024 12:56 by rmk")
+  [LAMBDA (STREAM TEXTOBJ SEL)                               (* ; "Edited 15-Mar-2024 13:57 by rmk")
+                                                             (* ; "Edited  3-Mar-2024 12:56 by rmk")
                                                              (* ; "Edited 28-May-2023 00:33 by rmk")
                                                              (* ; "Edited 24-May-2023 22:45 by rmk")
 
     (* ;; "uppercasifies the selection.  This changes the :Replace THACTION to :UpperCase for REDO. That could be stored in another field, in which case undo wouldn't need to know.")
 
-    (\TEDIT.REPLACE.SELPIECES (\SELPIECES.CHARTRANSFORM (\SELPIECES.COPY (\SELPIECES SEL))
+    (\TEDIT.REPLACE.SELPIECES (\TEDIT.SELPIECES.CHARTRANSFORM (\TEDIT.SELPIECES.COPY (
+                                                                                     \TEDIT.SELPIECES
+                                                                                      SEL))
                                      (FUNCTION U-CASECODE)
                                      NIL TEXTOBJ)
            TEXTOBJ SEL)
@@ -600,21 +609,21 @@
                                   (TEDIT.SETSYNTAX (CAR ENTRY)
                                          (CADR ENTRY]
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (5593 22336 (\TEDIT.BOLD.SEL.OFF 5603 . 5941) (\TEDIT.BOLD.SEL.ON 5943 . 6271) (
-\TEDIT.CENTER.SEL 6273 . 7789) (\TEDIT.CENTER.SEL.REV 7791 . 8087) (\TEDIT.DEFAULTS.CARET 8089 . 8582)
- (\TEDIT.DEFAULTSSEL 8584 . 9031) (\TEDIT.SETDEFAULT.FROM.SEL 9033 . 9710) (\TEDIT.KEY.FIND 9712 . 
-14442) (\TEDIT.GET.TARGET.STRING 14444 . 15308) (\TEDIT.KEY.FIND.BACKWARD 15310 . 15615) (
-\TEDIT.FINDAGAIN.BACKWARD 15617 . 16028) (\TEDIT.FINDAGAIN 16030 . 16321) (\TEDIT.ITALIC.SEL.OFF 16323
- . 16575) (\TEDIT.ITALIC.SEL.ON 16577 . 16770) (\TEDIT.LARGERSEL 16772 . 17060) (\TEDIT.LCASE.SEL 
-17062 . 17950) (\TEDIT.SHOWCARETLOOKS 17952 . 19552) (\TEDIT.SMALLERSEL 19554 . 19845) (
-\TEDIT.SUBSCRIPTSEL 19847 . 20050) (\TEDIT.SUPERSCRIPTSEL 20052 . 20256) (\TEDIT.UCASE.SEL 20258 . 
-21090) (\TEDIT.UNDERLINE.SEL.OFF 21092 . 21290) (\TEDIT.UNDERLINE.SEL.ON 21292 . 21488) (
-\TEDIT.STRIKEOUT.SEL.ON 21490 . 21686) (\TEDIT.STRIKEOUT.SEL.OFF 21688 . 21886) (\TEDIT.SELECT.ALL 
-21888 . 22111) (\TEDIT.KEY.SUBSTITUTE 22113 . 22334)) (22408 28817 (\TEDIT.BOLD.CARET.OFF 22418 . 
-22953) (\TEDIT.BOLD.CARET.ON 22955 . 23487) (\TEDIT.ITALIC.CARET.OFF 23489 . 24026) (
-\TEDIT.ITALIC.CARET.ON 24028 . 24571) (\TEDIT.LARGER.CARET 24573 . 25108) (\TEDIT.SMALLER.CARET 25110
- . 25647) (\TEDIT.SUBSCRIPT.CARET 25649 . 26190) (\TEDIT.SUPERSCRIPT.CARET 26192 . 26734) (
-\TEDIT.UNDERLINE.CARET.OFF 26736 . 27276) (\TEDIT.UNDERLINE.CARET.ON 27278 . 27816) (
-\TEDIT.STRIKEOUT.CARET.OFF 27818 . 28358) (\TEDIT.STRIKEOUT.CARET.ON 28360 . 28815)) (28886 29588 (
-\TK.DESCRIBEFONT 28896 . 29586)))))
+  (FILEMAP (NIL (5609 23249 (\TEDIT.BOLD.SEL.OFF 5619 . 5957) (\TEDIT.BOLD.SEL.ON 5959 . 6287) (
+\TEDIT.CENTER.SEL 6289 . 7805) (\TEDIT.CENTER.SEL.REV 7807 . 8103) (\TEDIT.DEFAULTS.CARET 8105 . 8598)
+ (\TEDIT.DEFAULTSSEL 8600 . 9047) (\TEDIT.SETDEFAULT.FROM.SEL 9049 . 9726) (\TEDIT.KEY.FIND 9728 . 
+14757) (\TEDIT.GET.TARGET.STRING 14759 . 15623) (\TEDIT.KEY.FIND.BACKWARD 15625 . 15930) (
+\TEDIT.FINDAGAIN.BACKWARD 15932 . 16343) (\TEDIT.FINDAGAIN 16345 . 16636) (\TEDIT.ITALIC.SEL.OFF 16638
+ . 16890) (\TEDIT.ITALIC.SEL.ON 16892 . 17085) (\TEDIT.LARGERSEL 17087 . 17375) (\TEDIT.LCASE.SEL 
+17377 . 18564) (\TEDIT.SHOWCARETLOOKS 18566 . 20166) (\TEDIT.SMALLERSEL 20168 . 20459) (
+\TEDIT.SUBSCRIPTSEL 20461 . 20664) (\TEDIT.SUPERSCRIPTSEL 20666 . 20870) (\TEDIT.UCASE.SEL 20872 . 
+22003) (\TEDIT.UNDERLINE.SEL.OFF 22005 . 22203) (\TEDIT.UNDERLINE.SEL.ON 22205 . 22401) (
+\TEDIT.STRIKEOUT.SEL.ON 22403 . 22599) (\TEDIT.STRIKEOUT.SEL.OFF 22601 . 22799) (\TEDIT.SELECT.ALL 
+22801 . 23024) (\TEDIT.KEY.SUBSTITUTE 23026 . 23247)) (23321 29730 (\TEDIT.BOLD.CARET.OFF 23331 . 
+23866) (\TEDIT.BOLD.CARET.ON 23868 . 24400) (\TEDIT.ITALIC.CARET.OFF 24402 . 24939) (
+\TEDIT.ITALIC.CARET.ON 24941 . 25484) (\TEDIT.LARGER.CARET 25486 . 26021) (\TEDIT.SMALLER.CARET 26023
+ . 26560) (\TEDIT.SUBSCRIPT.CARET 26562 . 27103) (\TEDIT.SUPERSCRIPT.CARET 27105 . 27647) (
+\TEDIT.UNDERLINE.CARET.OFF 27649 . 28189) (\TEDIT.UNDERLINE.CARET.ON 28191 . 28729) (
+\TEDIT.STRIKEOUT.CARET.OFF 28731 . 29271) (\TEDIT.STRIKEOUT.CARET.ON 29273 . 29728)) (29799 30501 (
+\TK.DESCRIBEFONT 29809 . 30499)))))
 STOP
diff --git a/library/tedit/TEDIT-FNKEYS.LCOM b/library/tedit/TEDIT-FNKEYS.LCOM
index 47db44b9..deacbf47 100644
Binary files a/library/tedit/TEDIT-FNKEYS.LCOM and b/library/tedit/TEDIT-FNKEYS.LCOM differ
diff --git a/library/tedit/TEDIT-HCPY b/library/tedit/TEDIT-HCPY
index 78a95fdc..9603b203 100644
--- a/library/tedit/TEDIT-HCPY
+++ b/library/tedit/TEDIT-HCPY
@@ -1,12 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 6-Mar-2024 23:58:11" {WMEDLEY}<library>tedit>TEDIT-HCPY.;145 33076  
+(FILECREATED "20-Mar-2024 11:05:37" {WMEDLEY}<library>tedit>TEDIT-HCPY.;152 33826  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS TEDIT.HARDCOPY)
+      :CHANGES-TO (FNS \TEDIT.HARDCOPY.DISPLAYLINE TEDIT.HARDCOPYFN)
 
-      :PREVIOUS-DATE "19-Jan-2024 23:19:53" {WMEDLEY}<library>tedit>TEDIT-HCPY.;144)
+      :PREVIOUS-DATE "17-Mar-2024 17:24:56" {WMEDLEY}<library>TEDIT>TEDIT-HCPY.;149)
 
 
 (PRETTYCOMPRINT TEDIT-HCPYCOMS)
@@ -16,7 +16,7 @@
               (* ;; "Generic interface functions and common code")
 
               (FNS TEDIT.HARDCOPY \TEDIT.PRINT.MENU TEDIT.HCPYFILE \TEDIT.HARDCOPY.DISPLAYLINE 
-                   \HARDCOPY.FORMATLINE.HEADINGS \TEDIT.HARDCOPY.MODIFYLOOKS \TEDIT.HCPYFMTSPEC 
+                   \TEDIT.HARDCOPY.FORMATLINE.HEADINGS \TEDIT.HARDCOPY.MODIFYLOOKS \TEDIT.HCPYFMTSPEC
                    \TEDIT.INTEGER.IMAGEBOX \TEDIT.DISPLAY.DIACRITIC))
         (COMS 
               (* ;; "Functions for scaling regions as needed during hardcopy.")
@@ -29,17 +29,20 @@
                                                              (* ; 
                                                              "0.75 inches from bottom, 1 from top"))
         [COMS 
-              (* ;; "Support for the window-menu's HARDCOPY button, LISTFILES, etc.")
+              (* ;; "Support for the window-menu's HARDCOPY button, LISTFILES, etc.  THIS IS SCREWY")
 
-              (FNS TEDIT.HARDCOPYFN \TEDIT.HARDCOPYFILEFN \TEDIT.HARDCOPY \TEDIT.PRESS.HARDCOPY)
+              (FNS TEDIT.HARDCOPYFN \TEDIT.HARDCOPYFILEFN \TEDIT.POSTSCRIPT.HARDCOPY 
+                   \TEDIT.PRESS.HARDCOPY)
               [P (LET [(IPVALUES (ASSOC 'CONVERSION (ASSOC 'INTERPRESS PRINTFILETYPES]
-                      (COND (IPVALUES                        (* ; 
+                      (CL:WHEN IPVALUES
+                                                             (* ; 
                                           "Only install INTERPRESS printing if INTERPRESS is loaded.")
-                                   (LISTPUT IPVALUES 'TEDIT (FUNCTION \TEDIT.HARDCOPY]
+                          (LISTPUT IPVALUES 'TEDIT (FUNCTION \TEDIT.POSTSCRIPT.HARDCOPY)))]
               (P (LET [(PRESSVALUES (ASSOC 'CONVERSION (ASSOC 'PRESS PRINTFILETYPES]
-                      (COND (PRESSVALUES                     (* ; 
+                      (CL:WHEN PRESSVALUES
+                                                             (* ; 
                                                     "Only install PRESS printing if PRESS is loaded.")
-                                   (LISTPUT PRESSVALUES 'TEDIT (FUNCTION \TEDIT.PRESS.HARDCOPY]
+                          (LISTPUT PRESSVALUES 'TEDIT (FUNCTION \TEDIT.PRESS.HARDCOPY)))]
         [COMS 
               (* ;; "vars for Japanese Line Break")
 
@@ -125,7 +128,9 @@
                 (TEDIT.FORMAT.HARDCOPY TSTREAM FILENM T BREAKPAGETITLE NIL NIL IMAGETYPE])
 
 (\TEDIT.HARDCOPY.DISPLAYLINE
-  [LAMBDA (TEXTOBJ LINE REGION PRSTREAM FORMATTINGSTATE)     (* ; "Edited 24-Dec-2023 22:07 by rmk")
+  [LAMBDA (TEXTOBJ LINE REGION PRSTREAM FORMATTINGSTATE)     (* ; "Edited 20-Mar-2024 11:04 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 19:23 by rmk")
+                                                             (* ; "Edited 24-Dec-2023 22:07 by rmk")
                                                              (* ; "Edited  2-Dec-2023 11:17 by rmk")
                                                              (* ; "Edited 28-Oct-2023 23:52 by rmk")
                                                              (* ; "Edited  6-May-2023 20:03 by rmk")
@@ -136,7 +141,7 @@
 
     (* ;; "If possible, use the information cached in THISLINE")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (\DTEST LINE 'LINEDESCRIPTOR)
 
     (* ;; "Only display the line if it appears before the end of the text!")
@@ -145,7 +150,7 @@
                       (FGETTOBJ TEXTOBJ TEXTLEN))
         [LET ((THISLINE (FGETTOBJ TEXTOBJ THISLINE)))
              (CL:UNLESS (EQ LINE (fetch DESC of THISLINE))
-                 (\FORMATLINE TEXTOBJ (FGETLD LINE LCHAR1)
+                 (\TEDIT.FORMATLINE TEXTOBJ (FGETLD LINE LCHAR1)
                         LINE REGION PRSTREAM FORMATTINGSTATE))
 
              (* ;; "Use the characters cached in THISLINE.")
@@ -266,8 +271,9 @@
                                                                  (FGETLD LINE LFMTSPEC)
                                                                  PRSTREAM LINE))])])
 
-(\HARDCOPY.FORMATLINE.HEADINGS
+(\TEDIT.HARDCOPY.FORMATLINE.HEADINGS
   [LAMBDA (TEXTOBJ TSTREAM LINE FMTSPEC CHNO IMAGESTREAM FORMATTINGSTATE)
+                                                             (* ; "Edited 17-Mar-2024 17:22 by rmk")
                                                              (* ; "Edited 19-Jan-2024 23:19 by rmk")
                                                              (* ; "Edited  3-Oct-2022 13:05 by rmk")
 
@@ -277,7 +283,7 @@
         (PAGEHEADING 
                      (* ;; "This paragraph is the content for a page heading. The pieces are stashed away in the FORMATTING STATE.")
 
-                     (TEDIT.HARDCOPY.PAGEHEADING TEXTOBJ TSTREAM LINE FMTSPEC CHNO IMAGESTREAM 
+                     (\TEDIT.HARDCOPY.PAGEHEADING TEXTOBJ TSTREAM LINE FMTSPEC CHNO IMAGESTREAM 
                             FORMATTINGSTATE)
                      T)
         (EVEN                                                (* ; "Skip an odd page.")
@@ -332,7 +338,8 @@
     (MOVETO CURX CURY PRSTREAM])
 
 (\TEDIT.HCPYFMTSPEC
-  [LAMBDA (SPEC IMAGESTREAM)                                 (* ; "Edited  7-Mar-2023 21:03 by rmk")
+  [LAMBDA (SPEC IMAGESTREAM)                                 (* ; "Edited 15-Mar-2024 19:34 by rmk")
+                                                             (* ; "Edited  7-Mar-2023 21:03 by rmk")
                                                              (* ; "Edited  6-Mar-2023 15:14 by rmk")
                                                              (* ; "Edited 20-Oct-2022 22:35 by rmk")
                                                              (* ; "Edited 29-Sep-2022 23:32 by rmk")
@@ -349,7 +356,7 @@
                                              RIGHTMAR _ (HCSCALE SCALE (fetch (FMTSPEC RIGHTMAR)
                                                                           of SPEC))
                                              QUAD _ (fetch (FMTSPEC QUAD) of SPEC)
-                                             TABSPEC _ (\FORMATLINE.SCALETABS SPEC SCALE)
+                                             TABSPEC _ (\TEDIT.FORMATLINE.SCALETABS SPEC SCALE)
                                              FMTSPECIALX _ (AND (fetch (FMTSPEC FMTSPECIALX)
                                                                    of SPEC)
                                                                 (HCSCALE SCALE
@@ -440,12 +447,13 @@
 
 
 
-(* ;; "Support for the window-menu's HARDCOPY button, LISTFILES, etc.")
+(* ;; "Support for the window-menu's HARDCOPY button, LISTFILES, etc.  THIS IS SCREWY")
 
 (DEFINEQ
 
 (TEDIT.HARDCOPYFN
-  [LAMBDA (WINDOW IMAGESTREAM)                               (* ; "Edited 25-Sep-2023 16:29 by rmk")
+  [LAMBDA (WINDOW IMAGESTREAM)                               (* ; "Edited 20-Mar-2024 10:49 by rmk")
+                                                             (* ; "Edited 25-Sep-2023 16:29 by rmk")
                                                              (* ; "Edited  4-Jul-2023 11:16 by rmk")
                                                             (* ; "Edited 21-Sep-2021 15:33 by rmk:")
 
@@ -460,7 +468,7 @@
 
          (CL:WHEN (FGETTOBJ TEXTOBJ MENUFLG)
              (SETQ WINDOW (\TEDIT.MAINW WINDOW))
-             (SETQ TEXTOBJ (WINDOWPROP WINDOW 'TEXTOBJ)))
+             (SETQ TEXTOBJ (fetch (TEXTWINDOW WTEXTOBJ) of WINDOW)))
          (RESETLST
              [RESETSAVE (\TEDIT.MARKACTIVE TEXTOBJ)
                     '(PROGN (\TEDIT.MARKINACTIVE OLDVALUE]
@@ -482,7 +490,7 @@
                     'BODY
                     (FULLNAME STRM)))])
 
-(\TEDIT.HARDCOPY
+(\TEDIT.POSTSCRIPT.HARDCOPY
   [LAMBDA (FILE PFILE)                                       (* ; "Edited  4-Oct-2022 10:40 by rmk")
                                                              (* ; "Edited  1-Oct-2022 22:08 by rmk")
                                                             (* ; "Edited 12-Jun-90 18:35 by mitani")
@@ -515,16 +523,14 @@
 )
 
 [LET [(IPVALUES (ASSOC 'CONVERSION (ASSOC 'INTERPRESS PRINTFILETYPES]
-     (COND
-        (IPVALUES                                            (* ; 
+     (CL:WHEN IPVALUES                                       (* ; 
                                           "Only install INTERPRESS printing if INTERPRESS is loaded.")
-               (LISTPUT IPVALUES 'TEDIT (FUNCTION \TEDIT.HARDCOPY]
+         (LISTPUT IPVALUES 'TEDIT (FUNCTION \TEDIT.POSTSCRIPT.HARDCOPY)))]
 
 [LET [(PRESSVALUES (ASSOC 'CONVERSION (ASSOC 'PRESS PRINTFILETYPES]
-     (COND
-        (PRESSVALUES                                         (* ; 
+     (CL:WHEN PRESSVALUES                                    (* ; 
                                                     "Only install PRESS printing if PRESS is loaded.")
-               (LISTPUT PRESSVALUES 'TEDIT (FUNCTION \TEDIT.PRESS.HARDCOPY]
+         (LISTPUT PRESSVALUES 'TEDIT (FUNCTION \TEDIT.PRESS.HARDCOPY)))]
 
 
 
@@ -561,11 +567,11 @@
          (CLOSEF DOC])
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (3328 26268 (TEDIT.HARDCOPY 3338 . 4471) (\TEDIT.PRINT.MENU 4473 . 5327) (TEDIT.HCPYFILE
- 5329 . 7269) (\TEDIT.HARDCOPY.DISPLAYLINE 7271 . 17047) (\HARDCOPY.FORMATLINE.HEADINGS 17049 . 18340)
- (\TEDIT.HARDCOPY.MODIFYLOOKS 18342 . 20576) (\TEDIT.HCPYFMTSPEC 20578 . 24597) (
-\TEDIT.INTEGER.IMAGEBOX 24599 . 25270) (\TEDIT.DISPLAY.DIACRITIC 25272 . 26266)) (26343 27173 (
-\TEDIT.SCALEREGION 26353 . 27171)) (27416 30972 (TEDIT.HARDCOPYFN 27426 . 28758) (
-\TEDIT.HARDCOPYFILEFN 28760 . 29321) (\TEDIT.HARDCOPY 29323 . 30243) (\TEDIT.PRESS.HARDCOPY 30245 . 
-30970)) (32252 33053 (TEDIT-BOOK 32262 . 33051)))))
+  (FILEMAP (NIL (3492 26880 (TEDIT.HARDCOPY 3502 . 4635) (\TEDIT.PRINT.MENU 4637 . 5491) (TEDIT.HCPYFILE
+ 5493 . 7433) (\TEDIT.HARDCOPY.DISPLAYLINE 7435 . 17428) (\TEDIT.HARDCOPY.FORMATLINE.HEADINGS 17430 . 
+18837) (\TEDIT.HARDCOPY.MODIFYLOOKS 18839 . 21073) (\TEDIT.HCPYFMTSPEC 21075 . 25209) (
+\TEDIT.INTEGER.IMAGEBOX 25211 . 25882) (\TEDIT.DISPLAY.DIACRITIC 25884 . 26878)) (26955 27785 (
+\TEDIT.SCALEREGION 26965 . 27783)) (28044 31739 (TEDIT.HARDCOPYFN 28054 . 29514) (
+\TEDIT.HARDCOPYFILEFN 29516 . 30077) (\TEDIT.POSTSCRIPT.HARDCOPY 30079 . 31010) (\TEDIT.PRESS.HARDCOPY
+ 31012 . 31737)) (33002 33803 (TEDIT-BOOK 33012 . 33801)))))
 STOP
diff --git a/library/tedit/TEDIT-HCPY.LCOM b/library/tedit/TEDIT-HCPY.LCOM
index 419e9614..9f84477b 100644
Binary files a/library/tedit/TEDIT-HCPY.LCOM and b/library/tedit/TEDIT-HCPY.LCOM differ
diff --git a/library/tedit/TEDIT-HISTORY b/library/tedit/TEDIT-HISTORY
index 16172ba5..d5d7e0a4 100644
--- a/library/tedit/TEDIT-HISTORY
+++ b/library/tedit/TEDIT-HISTORY
@@ -1,14 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 4-Mar-2024 22:50:23" {WMEDLEY}<library>tedit>TEDIT-HISTORY.;147 32593  
+(FILECREATED "20-Mar-2024 11:05:20" {WMEDLEY}<library>tedit>TEDIT-HISTORY.;154 33348  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS \TEDIT.HISTORYEVENT.DEFPRINT \TEDIT.HISTORYADD \TEDIT.CUMULATE.EVENTS 
-                       TEDIT.UNDO \TEDIT.UNDO1 TEDIT.REDO \TEDIT.UNDO.DELETION \TEDIT.UNDO.REPLACE 
-                       \TEDIT.REDO.REPLACE \TEDIT.REDO.MOVE)
+      :CHANGES-TO (FNS TEDIT.UNDO)
 
-      :PREVIOUS-DATE " 4-Mar-2024 21:33:56" {WMEDLEY}<library>tedit>TEDIT-HISTORY.;146)
+      :PREVIOUS-DATE "15-Mar-2024 13:55:42" {WMEDLEY}<library>tedit>TEDIT-HISTORY.;153)
 
 
 (PRETTYCOMPRINT TEDIT-HISTORYCOMS)
@@ -208,7 +206,8 @@
     EVENT])
 
 (\TEDIT.CUMULATE.EVENTS
-  [LAMBDA (EVENT1 EVENT2 TEXTOBJ)                            (* ; "Edited  3-Mar-2024 12:15 by rmk")
+  [LAMBDA (EVENT1 EVENT2 TEXTOBJ)                            (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited  3-Mar-2024 12:15 by rmk")
                                                              (* ; "Edited  3-Jun-2023 17:09 by rmk")
                                                              (* ; "Edited 27-May-2023 00:54 by rmk")
                                                              (* ; "Edited 25-May-2023 23:58 by rmk")
@@ -220,7 +219,7 @@
 
     (* ;; "For now, this assumes they're events of the same type.  Actually, this should be able to cumulate a delete/insert pair into a replacement, etc.")
 
-    (SETTH EVENT1 THDELETEDPIECES (\SELPIECES.CONCAT (GETTH EVENT1 THDELETEDPIECES)
+    (SETTH EVENT1 THDELETEDPIECES (\TEDIT.SELPIECES.CONCAT (GETTH EVENT1 THDELETEDPIECES)
                                          (GETTH EVENT2 THDELETEDPIECES)
                                          TEXTOBJ))
     (SETTH EVENT1 THLEN (fetch (SELPIECES SPLEN) of (GETTH EVENT1 THDELETEDPIECES)))
@@ -234,7 +233,10 @@
 (DEFINEQ
 
 (TEDIT.UNDO
-  [LAMBDA (TEXTOBJ)                                          (* ; "Edited  3-Mar-2024 20:02 by rmk")
+  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 20-Mar-2024 11:04 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited  7-Mar-2024 12:48 by rmk")
+                                                             (* ; "Edited  3-Mar-2024 20:02 by rmk")
                                                              (* ; "Edited 22-Nov-2023 18:17 by rmk")
                                                              (* ; "Edited 27-Sep-2023 00:14 by rmk")
                                                              (* ; "Edited 23-Jun-2023 00:19 by rmk")
@@ -244,7 +246,7 @@
 
     (* ;; "We push information for undoing the undo onto the TXTHISTORYUNDO list.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (CL:UNLESS (FGETTOBJ TEXTOBJ TXTREADONLY)
 
         (* ;; "Only undo things if the document is allowed to change.")
@@ -262,17 +264,12 @@
          (* ;; "We can get into trouble if there is an interrupt in the middle of undoing the full set of events for a previous action, or even in the middle of a singleton event.")
 
               (SETQ PREVEVENTS (FGETTOBJ TEXTOBJ TXTHISTORY))
-              (\SHOWSEL SEL NIL)
+              (\TEDIT.SHOWSEL SEL NIL)
               (\TEDIT.UNDO1 TEXTOBJ EVENT)
 
-         (* ;; 
-         "Gather into a single (list) event all the events that were created as part of the undo.  .")
+         (* ;; "Get the event that undid EVENT")
 
-              [SETQ UNDOEVENT (for ETAIL on (FGETTOBJ TEXTOBJ TXTHISTORY)
-                                 until (EQ ETAIL PREVEVENTS) collect (CAR ETAIL)
-                                 finally (RETURN (CL:IF (CDR $$VAL)
-                                                     $$VAL
-                                                     (CAR $$VAL))]
+              (SETQ UNDOEVENT (\TEDIT.POPEVENT TEXTOBJ))
               (FSETTOBJ TEXTOBJ TXTHISTORY PREVEVENTS)
               (CL:WHEN [OR (NULL PREVEVENTS)
                            (AND (type? TEDITHISTORYEVENT (CAR (LISTP PREVEVENTS)))
@@ -286,8 +283,8 @@
               (push (FGETTOBJ TEXTOBJ TXTHISTORYUNDONE TEXTOBJ)
                     (LIST (CAR PREVEVENTS)
                           UNDOEVENT EVENT))
-              (\FIXSEL SEL TEXTOBJ)
-              (\SHOWSEL SEL T)))])
+              (\TEDIT.FIXSEL SEL TEXTOBJ)
+              (\TEDIT.SHOWSEL SEL T)))])
 
 (\TEDIT.UNDO1
   [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited  4-Mar-2024 14:55 by rmk")
@@ -337,7 +334,8 @@
                           T])
 
 (TEDIT.REDO
-  [LAMBDA (TEXTOBJ)                                          (* ; "Edited  4-Mar-2024 21:33 by rmk")
+  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited  4-Mar-2024 21:33 by rmk")
                                                              (* ; "Edited  2-Mar-2024 09:41 by rmk")
                                                              (* ; "Edited 21-Dec-2023 11:57 by rmk")
                                                              (* ; "Edited 27-May-2023 11:19 by rmk")
@@ -358,7 +356,7 @@
 
          (* ;; "There really is something to redo and something to do it to.")
 
-              (\SHOWSEL SEL NIL)
+              (\TEDIT.SHOWSEL SEL NIL)
               (SELECTC (GETTH EVENT THACTION)
                   ((LIST :Insert :Copy :Move)                (* ; "It was an insertion")
                        (\TEDIT.REDO.INSERTION TEXTOBJ EVENT SEL))
@@ -384,16 +382,17 @@
                                                              WAITINGCURSOR))) (TEDIT.PROMPTPRINT 
                                                              TEXTOBJ "Searching..." T)
                                                              (SETQ SEL (fetch (TEXTOBJ SEL) of 
-                                                             TEXTOBJ)) (\SHOWSEL SEL NIL)
+                                                             TEXTOBJ)) (\TEDIT.SHOWSEL SEL NIL)
                                                              (SETQ CH (TEDIT.FIND TEXTOBJ
                                                              (GETTH EVENT THAUXINFO)))
                                                              (COND (CH (TEDIT.PROMPTPRINT TEXTOBJ 
                                                              "done.") (\TEDIT.UPDATE.SEL SEL CH
                                                              (NCHARS (GETTH EVENT THAUXINFO))
-                                                             (QUOTE RIGHT)) (\FIXSEL SEL TEXTOBJ)
-                                                             (TEDIT.NORMALIZECARET TEXTOBJ)
-                                                             (\SHOWSEL SEL T)) (T
-                                                             (TEDIT.PROMPTPRINT TEXTOBJ "[Not found]"))))
+                                                             (QUOTE RIGHT)) (\TEDIT.FIXSEL SEL 
+                                                             TEXTOBJ) (TEDIT.NORMALIZECARET TEXTOBJ)
+                                                             (\TEDIT.SHOWSEL SEL T))
+                                                             (T (TEDIT.PROMPTPRINT TEXTOBJ 
+                                                             "[Not found]"))))
                          )
                   (:Move                                     (* ; "He moved some text")
                          (\TEDIT.REDO.MOVE TEXTOBJ EVENT (GETTH EVENT THLEN)
@@ -405,7 +404,7 @@
                   (TEDIT.PROMPTPRINT TEXTOBJ (CONCAT "Redoing the action " (GETTH EVENT THACTION)
                                                     " isn't implemented.")
                          T))
-              (\SHOWSEL SEL T)))])
+              (\TEDIT.SHOWSEL SEL T)))])
 
 (\TEDIT.UNDO.UNDO
   [LAMBDA (TEXTOBJ)                                          (* ; "Edited  3-Mar-2024 21:27 by rmk")
@@ -458,19 +457,21 @@
                                   EVENT])
 
 (\TEDIT.UNDO.DELETION
-  [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited 30-May-2023 23:31 by rmk")
+  [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited 30-May-2023 23:31 by rmk")
                                                              (* ; "Edited 27-May-2023 23:39 by rmk")
                                                              (* ; "Edited 21-Apr-93 12:01 by jds")
 
     (* ;; "UNDO a prior deletion ")
 
-    (\TEDIT.INSERT.SELPIECES (\SELPIECES.COPY (GETTH EVENT THDELETEDPIECES)
+    (\TEDIT.INSERT.SELPIECES (\TEDIT.SELPIECES.COPY (GETTH EVENT THDELETEDPIECES)
                                     'INSERT TEXTOBJ)
            TEXTOBJ
            (GETTH EVENT THCH#])
 
 (\TEDIT.UNDO.MOVE
-  [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited  4-Mar-2024 16:08 by rmk")
+  [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited  4-Mar-2024 16:08 by rmk")
 
     (* ;; "If the deletion from TEDIT.MOVE was not in TEXTOBJ, the FOBJ must have been a separate document. If FOBJ is still in the state just after that deletion, it can be undone there. But if FOBJ is not in that state, undoing doesn't there make sense.  The deleted string would reappear in some random place.")
 
@@ -481,7 +482,7 @@
                                                              (* ; "Undo the insert in this document")
          (CL:WHEN (GETTH EVENT THDELETEDPIECES)              (* ; 
                                                              ":Move must have started as :Replace")
-             (\TEDIT.INSERT.SELPIECES (\SELPIECES.COPY (GETTH EVENT THDELETEDPIECES)
+             (\TEDIT.INSERT.SELPIECES (\TEDIT.SELPIECES.COPY (GETTH EVENT THDELETEDPIECES)
                                              'INSERT TEXTOBJ)
                     TEXTOBJ
                     (GETTH EVENT THCH#)))
@@ -497,13 +498,14 @@
          (\TEDIT.UPDATE.SEL SEL EVENT 0 'LEFT T])
 
 (\TEDIT.UNDO.REPLACE
-  [LAMBDA (TEXTOBJ EVENT ACTION)                             (* ; "Edited 30-May-2023 23:10 by rmk")
+  [LAMBDA (TEXTOBJ EVENT ACTION)                             (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited 30-May-2023 23:10 by rmk")
                                                              (* ; "Edited 27-May-2023 16:49 by rmk")
                                                              (* ; "Edited 24-May-2023 22:43 by rmk")
 
     (* ;; "This undoes the replacement, but tracks for REDO whether the action was replace, lowercase, or uppercase.")
 
-    (\TEDIT.REPLACE.SELPIECES (\SELPIECES.COPY (GETTH EVENT THDELETEDPIECES)
+    (\TEDIT.REPLACE.SELPIECES (\TEDIT.SELPIECES.COPY (GETTH EVENT THDELETEDPIECES)
                                      NIL TEXTOBJ)
            TEXTOBJ
            (\TEDIT.UPDATE.SEL (fetch (TEXTOBJ SEL) of TEXTOBJ)
@@ -514,18 +516,20 @@
 (DEFINEQ
 
 (\TEDIT.REDO.INSERTION
-  [LAMBDA (TEXTOBJ EVENT SEL)                                (* ; "Edited 31-May-2023 10:26 by rmk")
+  [LAMBDA (TEXTOBJ EVENT SEL)                                (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited 31-May-2023 10:26 by rmk")
                                                              (* ; "Edited 18-May-2023 19:24 by rmk")
                                                              (* ; "Edited 21-Apr-93 01:06 by jds")
 
     (* ;; "Copies of the pieces inserted at the previous insertion EVENT are inserted at SEL's caret.  We can extract the relevant pieces from the event's text position, because we know that either EVENT was the last event or other events after it have been undone, and the pieces are back to their original state.")
 
-    (\TEDIT.INSERT.SELPIECES (\SELPIECES.COPY (\SELPIECES EVENT NIL TEXTOBJ)
+    (\TEDIT.INSERT.SELPIECES (\TEDIT.SELPIECES.COPY (\TEDIT.SELPIECES EVENT NIL TEXTOBJ)
                                     'INSERT TEXTOBJ)
            TEXTOBJ SEL])
 
 (\TEDIT.REDO.REPLACE
-  [LAMBDA (TEXTOBJ EVENT ACTION)                             (* ; "Edited  2-Oct-2023 11:43 by rmk")
+  [LAMBDA (TEXTOBJ EVENT ACTION)                             (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited  2-Oct-2023 11:43 by rmk")
                                                              (* ; "Edited 31-May-2023 10:25 by rmk")
                                                              (* ; "Edited 27-May-2023 11:16 by rmk")
                                                              (* ; "Edited 16-May-2023 22:05 by rmk")
@@ -533,7 +537,7 @@
 
     (* ;; "We get the replacement from where EVENT just installed it in the text (assume that it is still there unchanged), and then we use it to replace what is now at the current selection.  EVENT's deleted pieces are not relevant.")
 
-    (\TEDIT.REPLACE.SELPIECES (\SELPIECES.COPY (\SELPIECES EVENT NIL TEXTOBJ)
+    (\TEDIT.REPLACE.SELPIECES (\TEDIT.SELPIECES.COPY (\TEDIT.SELPIECES EVENT NIL TEXTOBJ)
                                      NIL TEXTOBJ)
            TEXTOBJ
            (\TEDIT.UPDATE.SEL (fetch (TEXTOBJ SEL) of TEXTOBJ)
@@ -542,7 +546,8 @@
            THACTION ACTION])
 
 (\TEDIT.REDO.MOVE
-  [LAMBDA (TEXTOBJ EVENT LEN CH# FIRSTPIECE)                 (* ; "Edited 16-Feb-2024 23:36 by rmk")
+  [LAMBDA (TEXTOBJ EVENT LEN CH# FIRSTPIECE)                 (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited 16-Feb-2024 23:36 by rmk")
                                                              (* ; "Edited  7-Jun-2023 23:19 by rmk")
                                                              (* ; "Edited 27-May-2023 11:18 by rmk")
                                                              (* ; "Edited 23-May-2023 12:54 by rmk")
@@ -551,15 +556,15 @@
          (\TEDIT.UPDATE.SEL SCR2 (GETTH EVENT THCH#)
                 LEN)
          (SETSEL SCR2 SET T)
-         (\FIXSEL SCR2 TEXTOBJ)
+         (\TEDIT.FIXSEL SCR2 TEXTOBJ)
          (\TEDIT.SET.SEL.LOOKS SCR2 'MOVE)
          (TEDIT.MOVE SCR2 (FGETTOBJ TEXTOBJ SEL])
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (5054 6075 (\TEDIT.HISTORYEVENT.DEFPRINT 5064 . 6073)) (6841 12292 (\TEDIT.HISTORYADD 
-6851 . 10927) (\TEDIT.CUMULATE.EVENTS 10929 . 12290)) (12345 25970 (TEDIT.UNDO 12355 . 15592) (
-\TEDIT.UNDO1 15594 . 18659) (TEDIT.REDO 18661 . 23730) (\TEDIT.UNDO.UNDO 23732 . 25968)) (25971 29764 
-(\TEDIT.UNDO.INSERTION 25981 . 26738) (\TEDIT.UNDO.DELETION 26740 . 27312) (\TEDIT.UNDO.MOVE 27314 . 
-28974) (\TEDIT.UNDO.REPLACE 28976 . 29762)) (29765 32570 (\TEDIT.REDO.INSERTION 29775 . 30604) (
-\TEDIT.REDO.REPLACE 30606 . 31726) (\TEDIT.REDO.MOVE 31728 . 32568)))))
+  (FILEMAP (NIL (4834 5855 (\TEDIT.HISTORYEVENT.DEFPRINT 4844 . 5853)) (6621 12187 (\TEDIT.HISTORYADD 
+6631 . 10707) (\TEDIT.CUMULATE.EVENTS 10709 . 12185)) (12240 26023 (TEDIT.UNDO 12250 . 15439) (
+\TEDIT.UNDO1 15441 . 18506) (TEDIT.REDO 18508 . 23783) (\TEDIT.UNDO.UNDO 23785 . 26021)) (26024 30162 
+(\TEDIT.UNDO.INSERTION 26034 . 26791) (\TEDIT.UNDO.DELETION 26793 . 27480) (\TEDIT.UNDO.MOVE 27482 . 
+29257) (\TEDIT.UNDO.REPLACE 29259 . 30160)) (30163 33325 (\TEDIT.REDO.INSERTION 30173 . 31123) (
+\TEDIT.REDO.REPLACE 31125 . 32366) (\TEDIT.REDO.MOVE 32368 . 33323)))))
 STOP
diff --git a/library/tedit/TEDIT-HISTORY.LCOM b/library/tedit/TEDIT-HISTORY.LCOM
index 7c8ab1fd..e86bb9ad 100644
Binary files a/library/tedit/TEDIT-HISTORY.LCOM and b/library/tedit/TEDIT-HISTORY.LCOM differ
diff --git a/library/tedit/TEDIT-LOOKS b/library/tedit/TEDIT-LOOKS
index 6e7604c9..b5bcc34a 100644
--- a/library/tedit/TEDIT-LOOKS
+++ b/library/tedit/TEDIT-LOOKS
@@ -1,11 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "17-Mar-2024 23:34:23" {DSK}<home>frank>il>ncmedley>library>tedit>TEDIT-LOOKS.;5 152055 
+(FILECREATED "27-Mar-2024 13:53:47" {WMEDLEY}<library>TEDIT>TEDIT-LOOKS.;242 155521 
 
-      :CHANGES-TO (FNS TEDIT.PARALOOKS)
+      :EDIT-BY rmk
 
-      :PREVIOUS-DATE " 4-Mar-2024 22:50:23" {DSK}<home>frank>il>ncmedley>library>tedit>TEDIT-LOOKS.;3
-)
+      :CHANGES-TO (FNS TEDIT.GET.PARALOOKS)
+
+      :PREVIOUS-DATE "20-Mar-2024 11:06:29" {WMEDLEY}<library>TEDIT>TEDIT-LOOKS.;241)
 
 
 (PRETTYCOMPRINT TEDIT-LOOKSCOMS)
@@ -40,8 +41,8 @@
         (ADDVARS (FONTVARS (TEDIT.PROMPT.FONT DEFAULTFONT)
                         (TEDIT.ICON.FONT MENUFONT)))
         (COMS                                                (* ; "Character looks functions")
-              (FNS CHARLOOKS.FROM.FONT EQCLOOKS SAMECLOOKS TEDIT.CARETLOOKS TEDIT.COPY.LOOKS 
-                   \TEDIT.UNPARSE.CHARLOOKS.LIST TEDIT.MODIFYLOOKS TEDIT.NEW.FONT 
+              (FNS CHARLOOKS.FROM.FONT \TEDIT.EQCLOOKS \TEDIT.SAMECLOOKS TEDIT.CARETLOOKS 
+                   TEDIT.COPY.LOOKS \TEDIT.UNPARSE.CHARLOOKS.LIST TEDIT.MODIFYLOOKS TEDIT.NEW.FONT 
                    \TEDIT.CARETLOOKS.VERIFY \TEDIT.CARETPIECE \TEDIT.GET.INSERT.CHARLOOKS 
                    \TEDIT.GET.TERMSA.WIDTHS \TEDIT.PARSE.CHARLOOKS.LIST)
               (COMS (FNS \TEDIT.TRANSLATE.ASCIICHARS \TEDIT.CONVERT.TO.FORMATTED)
@@ -49,12 +50,12 @@
               (FNS \TEDIT.UNIQUIFY.CHARLOOKS \TEDIT.UNIQUIFY.PARALOOKS \TEDIT.UNIQUIFY.ALL 
                    \TEDIT.FLUSH.UNUSED.LOOKS)
               
-              (* ;; "For making font substitutions")
+              (* ;; "Public entries")
 
-              (FNS TEDIT.SUBLOOKS TEDIT.FINDLOOKS)
-              (FNS \TEDIT.CHANGE.LOOKS TEDIT.LOOKS \TEDIT.LOOKS \TEDIT.FONTCOPY TEDIT.GET.LOOKS))
+              (FNS TEDIT.LOOKS TEDIT.GET.LOOKS TEDIT.SUBLOOKS TEDIT.FINDLOOKS)
+              (FNS \TEDIT.CHANGE.LOOKS \TEDIT.LOOKS \TEDIT.FONTCOPY))
         (COMS                                                (* ; "Paragraph looks functions")
-              (FNS EQFMTSPEC TEDIT.GET.PARALOOKS \TEDIT.PARSE.PARALOOKS.LIST TEDIT.PARALOOKS 
+              (FNS \TEDIT.EQFMTSPEC TEDIT.GET.PARALOOKS \TEDIT.PARSE.PARALOOKS.LIST TEDIT.PARALOOKS 
                    TEDIT.COPY.PARALOOKS \TEDIT.PARABOUNDS)
               
               (* ;; "For making paragraph-looks substitutions.")
@@ -353,6 +354,15 @@
        '46)
 
 (DEFPRINT 'FMTSPEC (FUNCTION \TEDIT.FMTSPEC.DEFPRINT))
+
+(/DECLAREDATATYPE 'PENDINGTAB '(POINTER POINTER POINTER POINTER FULLXPOINTER POINTER)
+       '((PENDINGTAB 0 POINTER)
+         (PENDINGTAB 2 POINTER)
+         (PENDINGTAB 4 POINTER)
+         (PENDINGTAB 6 POINTER)
+         (PENDINGTAB 8 FULLXPOINTER)
+         (PENDINGTAB 10 POINTER))
+       '12)
 (DEFINEQ
 
 (\TEDIT.CHARLOOKS.DEFPRINT
@@ -458,7 +468,7 @@
          (freplace (CHARLOOKS CLSIZE) of LOOKS with (FONTPROP FONT 'SIZE))
          LOOKS])
 
-(EQCLOOKS
+(\TEDIT.EQCLOOKS
   [LAMBDA (CLOOK1 CLOOK2)                                    (* ; "Edited  1-Dec-2023 19:27 by rmk")
                                                              (* ; "Edited  9-Nov-2023 00:46 by rmk")
                                                              (* ; "Edited 24-Jul-2023 17:18 by rmk")
@@ -504,7 +514,7 @@
                   (EQ (ffetch (CHARLOOKS CLUSERINFO) of CLOOK1)
                       (ffetch (CHARLOOKS CLUSERINFO) of CLOOK2])
 
-(SAMECLOOKS
+(\TEDIT.SAMECLOOKS
   [LAMBDA (CLOOK1 CLOOK2 FEATURES)                           (* ; "Edited 24-Jul-2023 17:17 by rmk")
                                                              (* ; "Edited 30-May-91 21:45 by jds")
 
@@ -570,7 +580,8 @@
                 (\TEDIT.CARETLOOKS.VERIFY TEXTOBJ (\TEDIT.PARSE.CHARLOOKS.LIST LOOKS DATUM TEXTOBJ])
 
 (TEDIT.COPY.LOOKS
-  [LAMBDA (STREAM SOURCE DEST)                               (* ; "Edited  9-Feb-2024 11:42 by rmk")
+  [LAMBDA (STREAM SOURCE DEST)                               (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited  9-Feb-2024 11:42 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:53 by rmk")
                                                              (* ; "Edited 22-Oct-2022 15:27 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:14 by rmk")
@@ -582,9 +593,9 @@
            LOOKS LEN)                                        (* ; 
                                            "get the character looks of the first character of SOURCE")
           [SETQ LOOKS (PLOOKS (if (FIXP SOURCE)
-                                  then (\CHTOPC SOURCE TEXTOBJ)
+                                  then (\TEDIT.CHTOPC SOURCE TEXTOBJ)
                                 elseif (type? SELECTION SOURCE)
-                                  then (\CHTOPC (fetch (SELECTION CH#) of SOURCE)
+                                  then (\TEDIT.CHTOPC (fetch (SELECTION CH#) of SOURCE)
                                               (fetch (SELECTION SELTEXTOBJ) of SOURCE))
                                 else (\ILLEGAL.ARG SOURCE]
           (COND
@@ -698,12 +709,14 @@
                        TEXTOBJ])
 
 (\TEDIT.CARETPIECE
-  [LAMBDA (TEXTOBJ)                                          (* ; "Edited  6-Apr-2023 21:32 by rmk")
-    (\CHTOPC (TEDIT.GETPOINT TEXTOBJ)
+  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited  6-Apr-2023 21:32 by rmk")
+    (\TEDIT.CHTOPC (TEDIT.GETPOINT TEXTOBJ)
            TEXTOBJ])
 
 (\TEDIT.GET.INSERT.CHARLOOKS
-  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 16-Feb-2024 22:48 by rmk")
+  [LAMBDA (TEXTOBJ SEL)                                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 16-Feb-2024 22:48 by rmk")
                                                              (* ; "Edited 15-Dec-2023 08:40 by rmk")
                                                              (* ; "Edited  3-Aug-2023 22:39 by rmk")
                                                              (* ; "Edited  9-Oct-2022 13:57 by rmk")
@@ -712,8 +725,8 @@
 
     (* ;; "Return the looks at SEL, or defaults. Reset CLPROTECTED if need be.")
 
-    (LET ((PC (\CHTOPC (IMAX 1 (IMIN (FGETTOBJ TEXTOBJ TEXTLEN)
-                                     (TEDIT.GETPOINT TEXTOBJ SEL)))
+    (LET ((PC (\TEDIT.CHTOPC (IMAX 1 (IMIN (FGETTOBJ TEXTOBJ TEXTLEN)
+                                           (TEDIT.GETPOINT TEXTOBJ SEL)))
                      TEXTOBJ))
           LOOKS)
          (SETQ LOOKS (if PC
@@ -839,7 +852,8 @@
 (DEFINEQ
 
 (\TEDIT.TRANSLATE.ASCIICHARS
-  [LAMBDA (TEXTOBJ NOASCIIFONTS)                             (* ; "Edited  1-Dec-2023 22:28 by rmk")
+  [LAMBDA (TEXTOBJ NOASCIIFONTS)                             (* ; "Edited 17-Mar-2024 00:25 by rmk")
+                                                             (* ; "Edited  1-Dec-2023 22:28 by rmk")
                                                              (* ; "Edited 27-Nov-2023 16:13 by rmk")
                                                              (* ; "Edited 26-Nov-2023 11:19 by rmk")
                                                              (* ; "Edited 14-Nov-2023 19:21 by rmk")
@@ -864,8 +878,9 @@
                       (ASSOC (fetch (CHARLOOKS CLNAME) of CL)
                              ASCIITONSTRANSLATIONS))
         (for PC CLOOKS TRANS MAPARRAY NEWFONTNAME STRING FAT CLOOKSLIST CLNAME TARRAYLAST
-           inpieces (\FIRSTPIECE TEXTOBJ) eachtime (SETQ CLOOKS (PLOOKS PC))
-                                                (SETQ CLNAME (fetch (CHARLOOKS CLNAME) of CLOOKS))
+           inpieces (\TEDIT.FIRSTPIECE TEXTOBJ) eachtime (SETQ CLOOKS (PLOOKS PC))
+                                                      (SETQ CLNAME (fetch (CHARLOOKS CLNAME)
+                                                                      of CLOOKS))
            unless (OR (EQ OBJECT.PTYPE (PTYPE PC))
                       (EQ CLNAME 'CLASSIC)) when (SETQ TRANS (ASSOC CLNAME ASCIITONSTRANSLATIONS))
            do 
@@ -933,7 +948,7 @@
                                                                           (ELT \ASCIITOSTAR OLDCODE))
                                                                  )
                         do (CL:UNLESS START
-                               (SETQ START (\PCTOCH PC TEXTOBJ)))
+                               (SETQ START (\TEDIT.PCTOCH PC TEXTOBJ)))
                            (TEDIT.RPLCHARCODE TEXTOBJ (IPLUS START OFFSET -1)
                                   NEWCODE
                                   (FSETPC PC PLOOKS (\TEDIT.TRANSLATE.ASCII.CHARLOOKS TEXTOBJ CLOOKS
@@ -977,7 +992,10 @@
                                                        (\TEDIT.UNIQUIFY.ALL TEXTOBJ))))])
 
 (\TEDIT.CONVERT.TO.FORMATTED
-  [LAMBDA (TEXTOBJ START END)                                (* ; "Edited  6-Jan-2024 15:10 by rmk")
+  [LAMBDA (TEXTOBJ START END)                                (* ; "Edited 20-Mar-2024 11:00 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:06 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:53 by rmk")
+                                                             (* ; "Edited  6-Jan-2024 15:10 by rmk")
                                                              (* ; "Edited 11-Dec-2023 10:02 by rmk")
                                                              (* ; "Edited  9-Nov-2023 15:37 by rmk")
                                                              (* ; "Edited  5-Nov-2023 11:22 by rmk")
@@ -991,7 +1009,7 @@
 
     (* ;; "Using BIN for the main iteration is a little tricky when TEDIT.RPLCHARCODE is used to make the single-character change.  RPLCHARCODE can split the pieces and parameters in the TSTREAM that are used to drive the high-speed (BINABLE) operation.  It should perhaps figure out how to fix the stream internally, but for now the \TEXTSETFILEPTR gets things consistent again.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (CL:UNLESS (OR (FGETTOBJ TEXTOBJ FORMATTEDP)
                    (ZEROP (FGETTOBJ TEXTOBJ TEXTLEN)))
         (CL:UNLESS START (SETQ START 1))
@@ -1003,32 +1021,32 @@
                first 
                      (* ;; "CHNO is in characters, one more than stream positions")
 
-                     (\TEXTSETFILEPTR TSTREAM (SUB1 START))
+                     (\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 START))
                do (SELCHARQ (BIN TSTREAM)
                        (LF 
                            (* ;; "Linefeed not preceded by CR, replace by EOL and mark it paragraph-last.  \TEXTSETFILEPTR to make sure that the next BIN does what we want")
 
                            (TEDIT.RPLCHARCODE TEXTOBJ CHNO (CHARCODE EOL))
-                           (FSETPC (\CHTOPC CHNO TEXTOBJ)
+                           (FSETPC (\TEDIT.CHTOPC CHNO TEXTOBJ)
                                   PPARALAST T)
-                           (\TEXTSETFILEPTR TSTREAM CHNO))
+                           (\TEDIT.TEXTSETFILEPTR TSTREAM CHNO))
                        (CR 
                            (* ;; 
                     "Post-CR characters go to a separate piece, the CR piece is then paragraph-final")
 
-                           (FSETPC (PREVPIECE (\ALIGNEDPIECE (ADD1 CHNO)
+                           (FSETPC (PREVPIECE (\TEDIT.ALIGNEDPIECE (ADD1 CHNO)
                                                      TEXTOBJ))
                                   PPARALAST T)
                            (CL:WHEN (EQ (CHARCODE LF)
-                                        (\TEXTPEEKBIN TSTREAM T))
+                                        (\TEDIT.TEXTPEEKBIN TSTREAM T))
                                                              (* ; "DO WE EVER WANT TO SEE LF'S ??")
 
                                (* ;; 
                      "Linefeed following CR.  Chop it off from whatever follows, and then delete it.")
 
                                (add END -1)                  (* ; "One less char to do")
-                               (\DELETEPIECES (\SELPIECES (ADD1 CHNO)
-                                                     (ADD1 CHNO))
+                               (\TEDIT.DELETEPIECES (\TEDIT.SELPIECES (ADD1 CHNO)
+                                                           (ADD1 CHNO))
                                       TEXTOBJ)))
                        NIL) repeatuntil (IGEQ CHNO END)))    (* ; 
                                                     "Test END explicitly, because it may get reduced")
@@ -1057,7 +1075,8 @@
 (DEFINEQ
 
 (\TEDIT.UNIQUIFY.CHARLOOKS
-  [LAMBDA (NEWLOOK TEXTOBJ)                                  (* ; "Edited 15-Oct-2023 17:17 by rmk")
+  [LAMBDA (NEWLOOK TEXTOBJ)                                  (* ; "Edited 16-Mar-2024 00:32 by rmk")
+                                                             (* ; "Edited 15-Oct-2023 17:17 by rmk")
                                                              (* ; "Edited 18-Aug-2023 21:47 by rmk")
                                                              (* ; "Edited 15-Aug-2023 20:57 by rmk")
                                                              (* ; "Edited  3-Aug-2023 17:52 by rmk")
@@ -1068,7 +1087,7 @@
     (CL:WHEN NEWLOOK
         (for LOOKTAIL LOOK PREVTAIL on (FGETTOBJ TEXTOBJ TXTCHARLOOKSLIST)
            do (SETQ LOOK (CAR LOOKTAIL))
-              (CL:WHEN (EQCLOOKS NEWLOOK LOOK)
+              (CL:WHEN (\TEDIT.EQCLOOKS NEWLOOK LOOK)
                   (CL:WHEN PREVTAIL                          (* ; "Not already in first position")
                       (RPLACD PREVTAIL (CDR LOOKTAIL))
                       (push (FGETTOBJ TEXTOBJ TXTCHARLOOKSLIST)
@@ -1079,14 +1098,15 @@
                                              (RETURN NEWLOOK)))])
 
 (\TEDIT.UNIQUIFY.PARALOOKS
-  [LAMBDA (NEWLOOK TEXTOBJ)                                  (* ; "Edited 18-Aug-2023 21:48 by rmk")
+  [LAMBDA (NEWLOOK TEXTOBJ)                                  (* ; "Edited 16-Mar-2024 00:30 by rmk")
+                                                             (* ; "Edited 18-Aug-2023 21:48 by rmk")
                                                              (* ; "Edited 30-May-91 21:41 by jds")
 
     (* ;; "Assure that there is only ONE of a given PARALOOKS in the document--so that all instances of that set of looks share structure. When we get a hit, we move it to the front, hopefully more frequent looks will come earlier in the list.")
 
     (for LOOKTAIL LOOK PREVTAIL on (GETTOBJ TEXTOBJ TXTPARALOOKSLIST)
        do (SETQ LOOK (CAR LOOKTAIL))
-          (CL:WHEN (EQFMTSPEC NEWLOOK LOOK)
+          (CL:WHEN (\TEDIT.EQFMTSPEC NEWLOOK LOOK)
               (CL:WHEN PREVTAIL                              (* ; "Not already in first position")
                   (RPLACD PREVTAIL (CDR LOOKTAIL))
                   (push (GETTOBJ TEXTOBJ TXTPARALOOKSLIST)
@@ -1097,7 +1117,8 @@
                                          (RETURN NEWLOOK])
 
 (\TEDIT.UNIQUIFY.ALL
-  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 14-Nov-2023 16:20 by rmk")
+  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited 14-Nov-2023 16:20 by rmk")
                                                              (* ; "Edited 25-Aug-2023 08:57 by rmk")
                                                              (* ; "Edited 15-Aug-2023 22:04 by rmk")
                                                              (* ; "Edited  3-Aug-2023 18:44 by rmk")
@@ -1105,14 +1126,15 @@
                                                              (* ; "Edited 13-Jul-2022 22:56 by rmk")
     (SETTOBJ TEXTOBJ TXTCHARLOOKSLIST NIL)
     (SETTOBJ TEXTOBJ TXTPARALOOKSLIST NIL)
-    (for PC inpieces (\FIRSTPIECE TEXTOBJ) do 
-                                              (* ;; 
+    (for PC inpieces (\TEDIT.FIRSTPIECE TEXTOBJ) do 
+                                                    (* ;; 
                            "Assure that the CHARLOOKS and PARALOOKS of every piece are in the cache.")
 
-                                              (change (PLOOKS PC)
-                                                     (\TEDIT.UNIQUIFY.CHARLOOKS DATUM TEXTOBJ))
-                                              (change (PPARALOOKS PC)
-                                                     (\TEDIT.UNIQUIFY.PARALOOKS DATUM TEXTOBJ)))
+                                                    (change (PLOOKS PC)
+                                                           (\TEDIT.UNIQUIFY.CHARLOOKS DATUM TEXTOBJ))
+                                                    (change (PPARALOOKS PC)
+                                                           (\TEDIT.UNIQUIFY.PARALOOKS DATUM TEXTOBJ))
+         )
     (CL:WHEN (GETTOBJ TEXTOBJ DEFAULTCHARLOOKS)
         (change (GETTOBJ TEXTOBJ DEFAULTCHARLOOKS)
                (\TEDIT.UNIQUIFY.CHARLOOKS DATUM TEXTOBJ)))
@@ -1122,7 +1144,8 @@
            (\TEDIT.UNIQUIFY.PARALOOKS DATUM TEXTOBJ])
 
 (\TEDIT.FLUSH.UNUSED.LOOKS
-  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 25-Aug-2023 08:03 by rmk")
+  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited 25-Aug-2023 08:03 by rmk")
                                                              (* ; "Edited 15-Aug-2023 22:11 by rmk")
                                                              (* ; "Edited 30-May-91 21:47 by jds")
 
@@ -1138,10 +1161,10 @@
 
          (* ;; "Run thru the pieces in the document, marking the looks that are really in use.")
 
-         (for PC inpieces (\FIRSTPIECE TEXTOBJ) do (replace (CHARLOOKS CLMARK) of (PLOOKS PC)
-                                                      with T)
-                                                   (replace (FMTSPEC FMTMARK) of (PPARALOOKS PC)
-                                                      with T))
+         (for PC inpieces (\TEDIT.FIRSTPIECE TEXTOBJ) do (replace (CHARLOOKS CLMARK)
+                                                            of (PLOOKS PC) with T)
+                                                         (replace (FMTSPEC FMTMARK)
+                                                            of (PPARALOOKS PC) with T))
 
          (* ;; "Keep only those char and para looks that ARE being used.")
 
@@ -1159,12 +1182,72 @@
 
 
 
-(* ;; "For making font substitutions")
+(* ;; "Public entries")
 
 (DEFINEQ
 
+(TEDIT.LOOKS
+  [LAMBDA (TSTREAM NEWLOOKS SELORCH# LEN)                    (* ; "Edited  9-Feb-2024 11:40 by rmk")
+                                                             (* ; "Edited 23-Dec-2023 14:12 by rmk")
+                                                             (* ; "Edited 28-May-2023 13:56 by rmk")
+                                                             (* ; "Edited 24-May-2023 23:12 by rmk")
+                                                             (* ; "Edited 30-May-91 21:41 by jds")
+
+    (* ;; "Programmatic interface for character looks in TEdit.  Applies to the LEN characters starting at SELORCH#, or the characters selected by SELORCH# if it is a selection.  Nothing to do if the selection isn't set.  POINT is used only to set the caret looks.")
+
+    (LET ((TEXTOBJ (TEXTOBJ TSTREAM))
+          SEL)
+         (CL:UNLESS (\TEDIT.READONLY TEXTOBJ)
+
+             (* ;; "Ignores LEN if SELORCH# is a selection")
+
+             [SETQ SEL (COND
+                          ((type? SELECTION SELORCH#)
+                           SELORCH#)
+                          (SELORCH# (TEDIT.SETSEL TSTREAM SELORCH# LEN 'LEFT))
+                          (T (FGETTOBJ TEXTOBJ SEL]
+             (CL:WHEN (GETSEL SEL SET)
+                 (if (AND (IGREATERP (GETSEL SEL DCH)
+                                 0)
+                          (ILEQ (GETSEL SEL CH#)
+                                (TEXTLEN TEXTOBJ)))
+                     then (\TEDIT.CHANGE.LOOKS TSTREAM NEWLOOKS SEL)
+                   else 
+                        (* ;; "Out of bounds or maybe a point selection, no text to change. Punt out after setting the caret looks.  Old code did not set the history, should we?")
+
+                        (TEDIT.CARETLOOKS TSTREAM NEWLOOKS))))])
+
+(TEDIT.GET.LOOKS
+  [LAMBDA (TEXTOBJ CH#ORCHARLOOKS)                           (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 14-Dec-2023 21:00 by rmk")
+                                                             (* ; "Edited 21-Jun-2023 11:10 by rmk")
+                                                             (* ; "Edited 22-Aug-2022 13:14 by rmk")
+                                                             (* ; "Edited 30-May-91 21:44 by jds")
+
+    (* ;; "Returns as a property list the looks denoted by CH#ORCHARLOOKS.")
+
+    (SETQ TEXTOBJ (TEXTOBJ TEXTOBJ))
+    (\TEDIT.UNPARSE.CHARLOOKS.LIST (if (type? CHARLOOKS CH#ORCHARLOOKS)
+                                       then                  (* ; "Unparse the given looks.")
+                                            CH#ORCHARLOOKS
+                                     elseif (ZEROP (TEXTLEN TEXTOBJ))
+                                       then                  (* ; 
+                                                            "Empty document, use extant caret looks.")
+                                            (FGETTOBJ TEXTOBJ CARETLOOKS)
+                                     else (PLOOKS (\TEDIT.CHTOPC
+                                                   (OR (FIXP CH#ORCHARLOOKS)
+                                                       (GETSEL (if (type? SELECTION CH#ORCHARLOOKS)
+                                                                   then CH#ORCHARLOOKS
+                                                                 elseif (NULL CH#ORCHARLOOKS)
+                                                                   then (TEXTSEL TEXTOBJ)
+                                                                 else (\ILLEGAL.ARG CH#ORCHARLOOKS))
+                                                              CH#))
+                                                   TEXTOBJ])
+
 (TEDIT.SUBLOOKS
-  [LAMBDA (TEXTSTREAM OLDLOOKSLIST NEWLOOKSLIST)             (* ; "Edited 13-Nov-2023 00:26 by rmk")
+  [LAMBDA (TEXTSTREAM OLDLOOKSLIST NEWLOOKSLIST)             (* ; "Edited 17-Mar-2024 17:17 by rmk")
+                                                             (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited 13-Nov-2023 00:26 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:53 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:06 by rmk")
                                                              (* ; "Edited 26-Apr-93 14:53 by jds")
@@ -1177,34 +1260,37 @@
                                                        ))
                   (NEWLOOKS _ (\TEDIT.PARSE.CHARLOOKS.LIST NEWLOOKSLIST NIL TEXTOBJ))
                   (FEATURELIST _ (for A on OLDLOOKSLIST by (CDDR A) collect (CAR A)))
-                  (CH# _ 1) inpieces (\FIRSTPIECE TEXTOBJ) as CH# from 1 by (PLEN PC)
-                when (SAMECLOOKS OLDLOOKS (PLOOKS PC)
-                            FEATURELIST) do (CL:UNLESS CHANGEMADE
-                                                (SETQ CHANGEMADE T)
-                                                (SETQ SEL (FGETTOBJ TEXTOBJ SEL))
-                                                (\SHOWSEL SEL NIL)
-                                                (FSETTOBJ TEXTOBJ \DIRTY T)) 
+                  (CH# _ 1) inpieces (\TEDIT.FIRSTPIECE TEXTOBJ) as CH# from 1
+                by (PLEN PC) when (\TEDIT.SAMECLOOKS OLDLOOKS (PLOOKS PC)
+                                         FEATURELIST) do (CL:UNLESS CHANGEMADE
+                                                             (SETQ CHANGEMADE T)
+                                                             (SETQ SEL (FGETTOBJ TEXTOBJ SEL))
+                                                             (\TEDIT.SHOWSEL SEL NIL)
+                                                             (FSETTOBJ TEXTOBJ \DIRTY T)) 
 
-                                            (* ;; 
+                                                   (* ;; 
   "Note that we may be creating new looks each time, depending on what is there and what is changed.")
 
-                                            (FSETPC PC PLOOKS (\TEDIT.UNIQUIFY.CHARLOOKS
-                                                               (\TEDIT.PARSE.CHARLOOKS.LIST
-                                                                NEWLOOKSLIST
-                                                                (PLOOKS PC)
-                                                                TEXTOBJ)
-                                                               TEXTOBJ))
-                                            (\TEDIT.MARK.LINES.DIRTY TEXTOBJ CH# (+ CH# (PLEN PC)))
+                                                         (FSETPC PC PLOOKS (\TEDIT.UNIQUIFY.CHARLOOKS
+                                                                            (
+                                                                          \TEDIT.PARSE.CHARLOOKS.LIST
+                                                                             NEWLOOKSLIST
+                                                                             (PLOOKS PC)
+                                                                             TEXTOBJ)
+                                                                            TEXTOBJ))
+                                                         (\TEDIT.MARK.LINES.DIRTY TEXTOBJ CH#
+                                                                (+ CH# (PLEN PC)))
                 finally (CL:WHEN (FGETTOBJ TEXTOBJ \WINDOW)
-                            (TEDIT.UPDATE.SCREEN TEXTOBJ)    (* ; "Update the screen image")
-                            (\FIXSEL SEL TEXTOBJ)
-                            (\SHOWSEL SEL T))
+                            (\TEDIT.UPDATE.SCREEN TEXTOBJ)   (* ; "Update the screen image")
+                            (\TEDIT.FIXSEL SEL TEXTOBJ)
+                            (\TEDIT.SHOWSEL SEL T))
                       (RETURN (CL:IF CHANGEMADE
                                   'Done
                                   'NoChangesMade)])])
 
 (TEDIT.FINDLOOKS
-  [LAMBDA (TEXTSTREAM OLDLOOKSLIST CH#)                      (* ; "Edited  3-Dec-2023 00:09 by rmk")
+  [LAMBDA (TEXTSTREAM OLDLOOKSLIST CH#)                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited  3-Dec-2023 00:09 by rmk")
                                                              (* ; "Edited 13-Nov-2023 00:26 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:53 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:06 by rmk")
@@ -1222,29 +1308,32 @@
              then (SETQ CH# (TEDIT.GETPOINT TEXTOBJ (FGETTOBJ TEXTOBJ SEL)))
            else (\ILLEGAL.ARG CH#))
          (CL:UNLESS (ZEROP (FGETTOBJ TEXTOBJ TEXTLEN))
-             (for PC PCLAST FOUNDCH# (OLDLOOKS _ (\TEDIT.PARSE.CHARLOOKS.LIST OLDLOOKSLIST NIL 
+             [for PC PCLAST FOUNDCH# (OLDLOOKS _ (\TEDIT.PARSE.CHARLOOKS.LIST OLDLOOKSLIST NIL 
                                                         TEXTOBJ))
                   (FEATURELIST _ (for A on OLDLOOKSLIST by (CDDR A) collect (CAR A)))
-                inpieces (\CHTOPC CH# TEXTOBJ) when (SAMECLOOKS OLDLOOKS (PLOOKS PC)
-                                                           FEATURELIST)
+                inpieces (\TEDIT.CHTOPC CH# TEXTOBJ) when (\TEDIT.SAMECLOOKS OLDLOOKS (PLOOKS PC)
+                                                                 FEATURELIST)
                 do [SETQ PCLAST (find PC1 inpieces (NEXTPIECE PC)
-                                   suchthat (NOT (SAMECLOOKS OLDLOOKS (PLOOKS PC1)
+                                   suchthat (NOT (\TEDIT.SAMECLOOKS OLDLOOKS (PLOOKS PC1)
                                                         FEATURELIST]
                    (SETQ PCLAST (CL:IF PCLAST
                                     (PREVPIECE PCLAST)
                                     PC))
-                   (SETQ FOUNDCH# (\PCTOCH PC TEXTOBJ))
-                   (TEDIT.SETSEL TEXTOBJ FOUNDCH# (IDIFFERENCE (IPLUS (\PCTOCH PCLAST)
+                   (SETQ FOUNDCH# (\TEDIT.PCTOCH PC TEXTOBJ))
+                   (TEDIT.SETSEL TEXTOBJ FOUNDCH# (IDIFFERENCE (IPLUS (\TEDIT.PCTOCH PCLAST)
                                                                       (PLEN PCLAST))
                                                          FOUNDCH#)
                           'RIGHT)
                    (TEDIT.NORMALIZECARET TEXTOBJ)
-                   (RETURN (FGETTOBJ TEXTOBJ SEL))))])
+                   (RETURN (\TEDIT.COPYSEL (FGETTOBJ TEXTOBJ SEL])])
 )
 (DEFINEQ
 
 (\TEDIT.CHANGE.LOOKS
-  [LAMBDA (TSTREAM NEWLOOKS SEL)                             (* ; "Edited 24-Feb-2024 12:33 by rmk")
+  [LAMBDA (TSTREAM NEWLOOKS SEL)                             (* ; "Edited 15-Mar-2024 14:23 by rmk")
+                                                             (* ; "Edited 11-Mar-2024 00:37 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:36 by rmk")
+                                                             (* ; "Edited 24-Feb-2024 12:33 by rmk")
                                                              (* ; "Edited 22-Feb-2024 23:01 by rmk")
                                                              (* ; "Edited 23-Dec-2023 15:24 by rmk")
                                                              (* ; "Edited 31-Oct-2023 19:40 by rmk")
@@ -1320,7 +1409,7 @@
                      then (push FONTSPEC 'SIZE 'BOGUSSIZE))
                  (SETQ NEWLOOKS NIL))
           (FSETTOBJ TEXTOBJ \DIRTY T)                        (* ; "Mark the document changed.")
-          (SETQ SELPIECES (\SELPIECES SEL))
+          (SETQ SELPIECES (\TEDIT.SELPIECES SEL))
           (for PC NEWPCLOOKS OLDLOOKSLIST OLDPCLOOKS (CARETPC _ (\TEDIT.CARETPIECE TEXTOBJ))
              inselpieces SELPIECES
              do (SETQ OLDPCLOOKS (PLOOKS PC))
@@ -1402,7 +1491,7 @@
                                                        THOLDINFO _ OLDLOOKSLIST))
                    (CL:WHEN (FGETTOBJ TEXTOBJ \WINDOW)
                        (\TEDIT.MARK.LINES.DIRTY TEXTOBJ SEL)
-                       (\SHOWSEL (FGETTOBJ TEXTOBJ SEL)
+                       (\TEDIT.SHOWSEL (FGETTOBJ TEXTOBJ SEL)
                               NIL)
                        (SELECTQ INVISIBLE
                            (ON 
@@ -1420,44 +1509,14 @@
                                        (GETSEL SEL DCH)
                                        'RIGHT NIL T))
                            NIL)
-                       (TEDIT.RESET.EXTEND.PENDING.DELETE (FGETTOBJ TEXTOBJ SEL))
-                       (TEDIT.UPDATE.SCREEN TEXTOBJ)         (* ; "Update the screen image")
-                       (\FIXSEL (FGETTOBJ TEXTOBJ SEL)
+                       (\TEDIT.RESET.EXTEND.PENDING.DELETE (FGETTOBJ TEXTOBJ SEL)
                               TEXTOBJ)
-                       (\SHOWSEL (FGETTOBJ TEXTOBJ SEL)
+                       (\TEDIT.UPDATE.SCREEN TEXTOBJ)        (* ; "Update the screen image")
+                       (\TEDIT.FIXSEL (FGETTOBJ TEXTOBJ SEL)
+                              TEXTOBJ)
+                       (\TEDIT.SHOWSEL (FGETTOBJ TEXTOBJ SEL)
                               T))])
 
-(TEDIT.LOOKS
-  [LAMBDA (TSTREAM NEWLOOKS SELORCH# LEN)                    (* ; "Edited  9-Feb-2024 11:40 by rmk")
-                                                             (* ; "Edited 23-Dec-2023 14:12 by rmk")
-                                                             (* ; "Edited 28-May-2023 13:56 by rmk")
-                                                             (* ; "Edited 24-May-2023 23:12 by rmk")
-                                                             (* ; "Edited 30-May-91 21:41 by jds")
-
-    (* ;; "Programmatic interface for character looks in TEdit.  Applies to the LEN characters starting at SELORCH#, or the characters selected by SELORCH# if it is a selection.  Nothing to do if the selection isn't set.  POINT is used only to set the caret looks.")
-
-    (LET ((TEXTOBJ (TEXTOBJ TSTREAM))
-          SEL)
-         (CL:UNLESS (\TEDIT.READONLY TEXTOBJ)
-
-             (* ;; "Ignores LEN if SELORCH# is a selection")
-
-             [SETQ SEL (COND
-                          ((type? SELECTION SELORCH#)
-                           SELORCH#)
-                          (SELORCH# (TEDIT.SETSEL TSTREAM SELORCH# LEN 'LEFT))
-                          (T (FGETTOBJ TEXTOBJ SEL]
-             (CL:WHEN (GETSEL SEL SET)
-                 (if (AND (IGREATERP (GETSEL SEL DCH)
-                                 0)
-                          (ILEQ (GETSEL SEL CH#)
-                                (TEXTLEN TEXTOBJ)))
-                     then (\TEDIT.CHANGE.LOOKS TSTREAM NEWLOOKS SEL)
-                   else 
-                        (* ;; "Out of bounds or maybe a point selection, no text to change. Punt out after setting the caret looks.  Old code did not set the history, should we?")
-
-                        (TEDIT.CARETLOOKS TSTREAM NEWLOOKS))))])
-
 (\TEDIT.LOOKS
   [LAMBDA (TEXTOBJ)                                          (* ; "Edited  8-May-2023 21:21 by rmk")
                                                              (* ; "Edited 30-May-91 21:41 by jds")
@@ -1523,33 +1582,6 @@
                                                 (FONTPROP FONT 'FACE]
                  T)
           NIL])
-
-(TEDIT.GET.LOOKS
-  [LAMBDA (TEXTOBJ CH#ORCHARLOOKS)                           (* ; "Edited 14-Dec-2023 21:00 by rmk")
-                                                             (* ; "Edited 21-Jun-2023 11:10 by rmk")
-                                                             (* ; "Edited 22-Aug-2022 13:14 by rmk")
-                                                             (* ; "Edited 30-May-91 21:44 by jds")
-
-    (* ;; "Returns as a property list the looks denoted by CH#ORCHARLOOKS.")
-
-    (SETQ TEXTOBJ (TEXTOBJ TEXTOBJ))
-    (\TEDIT.UNPARSE.CHARLOOKS.LIST (if (type? CHARLOOKS CH#ORCHARLOOKS)
-                                       then                  (* ; "Unparse the given looks.")
-                                            CH#ORCHARLOOKS
-                                     elseif (ZEROP (TEXTLEN TEXTOBJ))
-                                       then                  (* ; 
-                                                            "Empty document, use extant caret looks.")
-                                            (FGETTOBJ TEXTOBJ CARETLOOKS)
-                                     else (PLOOKS (\CHTOPC (OR (FIXP CH#ORCHARLOOKS)
-                                                               (GETSEL (if (type? SELECTION 
-                                                                                  CH#ORCHARLOOKS)
-                                                                           then CH#ORCHARLOOKS
-                                                                         elseif (NULL CH#ORCHARLOOKS)
-                                                                           then (TEXTSEL TEXTOBJ)
-                                                                         else (\ILLEGAL.ARG 
-                                                                                     CH#ORCHARLOOKS))
-                                                                      CH#))
-                                                         TEXTOBJ])
 )
 
 
@@ -1558,7 +1590,7 @@
 
 (DEFINEQ
 
-(EQFMTSPEC
+(\TEDIT.EQFMTSPEC
   [LAMBDA (PARALOOK1 PARALOOK2)                              (* ; 
                                                         "Edited  2-Jul-93 21:32 by sybalskY:MV:ENVOS")
 
@@ -1613,7 +1645,8 @@
                     (ffetch (FMTSPEC TABSPEC) of PARALOOK2])
 
 (TEDIT.GET.PARALOOKS
-  [LAMBDA (TSTREAM SELORCH#)                                 (* ; "Edited 11-Dec-2023 10:12 by rmk")
+  [LAMBDA (TSTREAM SELORCH#)                                 (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 11-Dec-2023 10:12 by rmk")
                                                              (* ; "Edited 22-Jun-2023 00:02 by rmk")
                                                              (* ; "Edited 11-Feb-2023 14:55 by rmk")
                                                              (* ; "Edited 30-May-91 21:44 by jds")
@@ -1626,13 +1659,13 @@
                         (* ;; "An internal call, if we already have the piece.")
 
                         SELORCH#
-                 else (\CHTOPC (OR (FIXP SELORCH#)
-                                   (GETSEL (if (type? SELECTION SELORCH#)
-                                               then SELORCH#
-                                             elseif (NULL SELORCH#)
-                                               then (TEXTSEL TEXTOBJ)
-                                             else (\ILLEGAL.ARG SELORCH#))
-                                          CH#))
+                 else (\TEDIT.CHTOPC (OR (FIXP SELORCH#)
+                                         (GETSEL (if (type? SELECTION SELORCH#)
+                                                     then SELORCH#
+                                                   elseif (NULL SELORCH#)
+                                                     then (TEXTSEL TEXTOBJ)
+                                                   else (\ILLEGAL.ARG SELORCH#))
+                                                CH#))
                              TEXTOBJ)))
            (FMTSPEC (CL:IF PC
                         (PPARALOOKS PC)
@@ -1777,7 +1810,10 @@ CONS pair of default width and LIST of TAB record instances")
                 NEWLOOKS])
 
 (TEDIT.PARALOOKS
-  [LAMBDA (TEXTOBJ NEWLOOKS SEL LEN)                         (* ; "Edited 24-Feb-2024 12:33 by rmk")
+  [LAMBDA (TSTREAM NEWLOOKS SEL LEN)                         (* ; "Edited 16-Mar-2024 21:53 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:23 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:35 by rmk")
+                                                             (* ; "Edited 24-Feb-2024 12:33 by rmk")
                                                              (* ; "Edited  9-Feb-2024 11:41 by rmk")
                                                              (* ; "Edited 19-Jan-2024 14:35 by rmk")
                                                              (* ; "Edited 29-Dec-2023 15:29 by rmk")
@@ -1789,172 +1825,170 @@ CONS pair of default width and LIST of TAB record instances")
 
     (* ;; "Apply a given format spec to the paragraphs which are included in this guy. This assumes that paragraph boundaries are aligned with piece boundaries, so no splitting is needed. If we are given a FMTSPEC we replace the FMTSPEC of all pieces in all selected paragraphs.  Otherwise, we just override particular values in the selected-paragraph looks.")
 
-    (SETQ TEXTOBJ (TEXTOBJ TEXTOBJ))
-    (CL:UNLESS (type? SELECTION SEL)
-        (SETQ SEL (CL:IF (FIXP SEL)
-                      (TEDIT.SETSEL TEXTOBJ SEL LEN 'RIGHT)
-                      (FGETTOBJ TEXTOBJ SEL))))
-    (CL:WHEN (AND (FGETSEL SEL SET)
-                  (NOT (\TEDIT.READONLY TEXTOBJ)))
-        (LET (PARAPIECES REPLACEALLFIELDS 1STLEFT LEFT RIGHT LEADB LEADA BLEAD BLEADSET LLEAD 
-                    TABSPECC QUADD OLDLOOKSLIST TYPE SUBTYPE TYPESET SUBTYPESET SPECIALX SPECIALY 
-                    NEWBEFORESET NEWBEFORE NEWAFTERSET NEWAFTER KEEP KEEPSET HEADINGKEEP BASETOBASE 
-                    BASESET HCPYMODE HCPYSET USERINFO USERSET REVISED REVISEDSET COLUMN COLUMNSET 
-                    STYLE STYLESET CHARSTYLES CHARSTYLESSET)
-             [COND
-                ((type? FMTSPEC NEWLOOKS)                    (* ; 
+    (CL:WHEN
+     (PROG ((TEXTOBJ (TEXTOBJ TSTREAM))
+            PARAPIECES REPLACEALLFIELDS 1STLEFT LEFT RIGHT LEADB LEADA BLEAD BLEADSET LLEAD TABSPECC
+            QUADD OLDLOOKSLIST TYPE SUBTYPE TYPESET SUBTYPESET SPECIALX SPECIALY NEWBEFORESET 
+            NEWBEFORE NEWAFTERSET NEWAFTER KEEP KEEPSET HEADINGKEEP BASETOBASE BASESET HCPYMODE 
+            HCPYSET USERINFO USERSET REVISED REVISEDSET COLUMN COLUMNSET STYLE STYLESET CHARSTYLES 
+            CHARSTYLESSET)
+           (CL:UNLESS (type? SELECTION SEL)
+               (SETQ SEL (CL:IF (FIXP SEL)
+                             (TEDIT.SETSEL TEXTOBJ SEL LEN 'RIGHT)
+                             (FGETTOBJ TEXTOBJ SEL))))
+           (CL:UNLESS (AND (FGETSEL SEL SET)
+                           (NOT (\TEDIT.READONLY TEXTOBJ)))
+                  (RETURN NIL))
+           [COND
+              ((type? FMTSPEC NEWLOOKS)                      (* ; 
                                                              "In case it wasn't already uniquified")
-                 (SETQ NEWLOOKS (\TEDIT.UNIQUIFY.PARALOOKS NEWLOOKS TEXTOBJ)))
-                (T                                           (* ; "create an FMTSPEC from the Plist")
-                   (SETQ 1STLEFT (LISTGET NEWLOOKS '1STLEFTMARGIN))
-                   (SETQ LEFT (LISTGET NEWLOOKS 'LEFTMARGIN))
-                   (SETQ RIGHT (LISTGET NEWLOOKS 'RIGHTMARGIN))
-                   (SETQ LEADB (LISTGET NEWLOOKS 'PARALEADING))
-                   (SETQ LEADA (LISTGET NEWLOOKS 'POSTPARALEADING))
-                   (SETQ LLEAD (LISTGET NEWLOOKS 'LINELEADING))
-                   (SETQ BLEAD (LISTGET NEWLOOKS 'BASETOBASE))
-                   (SETQ BLEADSET (FMEMB 'BASETOBASE NEWLOOKS))
-                   (SETQ QUADD (LISTGET NEWLOOKS 'QUAD))
-                   (SETQ TYPESET (FMEMB 'TYPE NEWLOOKS))
-                   (SETQ TYPE (LISTGET NEWLOOKS 'TYPE))
-                   (SETQ SUBTYPESET (FMEMB 'SUBTYPE NEWLOOKS))
-                   (SETQ SUBTYPE (LISTGET NEWLOOKS 'SUBTYPE))
-                   (SETQ SPECIALX (LISTGET NEWLOOKS 'SPECIALX))
-                   (SETQ SPECIALY (LISTGET NEWLOOKS 'SPECIALY))
-                   (SETQ NEWBEFORESET (FMEMB 'NEWPAGEBEFORE NEWLOOKS))
-                   (SETQ NEWBEFORE (LISTGET NEWLOOKS 'NEWPAGEBEFORE))
-                   (SETQ NEWAFTERSET (FMEMB 'NEWPAGEAFTER NEWLOOKS))
-                   (SETQ NEWAFTER (LISTGET NEWLOOKS 'NEWPAGEAFTER))
-                   (SETQ HEADINGKEEP (LISTGET NEWLOOKS 'HEADINGKEEP))
-                   (SETQ KEEP (LISTGET NEWLOOKS 'KEEP))      (* ; 
+               (SETQ NEWLOOKS (\TEDIT.UNIQUIFY.PARALOOKS NEWLOOKS TEXTOBJ)))
+              (T                                             (* ; "create an FMTSPEC from the Plist")
+                 (SETQ 1STLEFT (LISTGET NEWLOOKS '1STLEFTMARGIN))
+                 (SETQ LEFT (LISTGET NEWLOOKS 'LEFTMARGIN))
+                 (SETQ RIGHT (LISTGET NEWLOOKS 'RIGHTMARGIN))
+                 (SETQ LEADB (LISTGET NEWLOOKS 'PARALEADING))
+                 (SETQ LEADA (LISTGET NEWLOOKS 'POSTPARALEADING))
+                 (SETQ LLEAD (LISTGET NEWLOOKS 'LINELEADING))
+                 (SETQ BLEAD (LISTGET NEWLOOKS 'BASETOBASE))
+                 (SETQ BLEADSET (FMEMB 'BASETOBASE NEWLOOKS))
+                 (SETQ QUADD (LISTGET NEWLOOKS 'QUAD))
+                 (SETQ TYPESET (FMEMB 'TYPE NEWLOOKS))
+                 (SETQ TYPE (LISTGET NEWLOOKS 'TYPE))
+                 (SETQ SUBTYPESET (FMEMB 'SUBTYPE NEWLOOKS))
+                 (SETQ SUBTYPE (LISTGET NEWLOOKS 'SUBTYPE))
+                 (SETQ SPECIALX (LISTGET NEWLOOKS 'SPECIALX))
+                 (SETQ SPECIALY (LISTGET NEWLOOKS 'SPECIALY))
+                 (SETQ NEWBEFORESET (FMEMB 'NEWPAGEBEFORE NEWLOOKS))
+                 (SETQ NEWBEFORE (LISTGET NEWLOOKS 'NEWPAGEBEFORE))
+                 (SETQ NEWAFTERSET (FMEMB 'NEWPAGEAFTER NEWLOOKS))
+                 (SETQ NEWAFTER (LISTGET NEWLOOKS 'NEWPAGEAFTER))
+                 (SETQ HEADINGKEEP (LISTGET NEWLOOKS 'HEADINGKEEP))
+                 (SETQ KEEP (LISTGET NEWLOOKS 'KEEP))        (* ; 
                                        "More general 'Keep-together' spec -- undefined as of 5/22/85")
-                   (SETQ KEEPSET (FMEMB 'KEEP NEWLOOKS))
-                   (SETQ BASETOBASE (LISTGET NEWLOOKS 'BASETOBASE))
-                   (SETQ BASESET (FMEMB 'BASETOBASE NEWLOOKS))
-                   (SETQ HCPYMODE (LISTGET NEWLOOKS 'HARDCOPY))
-                   (SETQ HCPYSET (FMEMB 'HARDCOPY NEWLOOKS))
-                   (SETQ USERINFO (LISTGET NEWLOOKS 'USERINFO))
-                   (SETQ USERSET (FMEMB 'USERINFO NEWLOOKS))
-                   (SETQ REVISED (LISTGET NEWLOOKS 'REVISED))
-                   (SETQ REVISEDSET (FMEMB 'REVISED NEWLOOKS))
-                   (SETQ TABSPECC (LISTGET NEWLOOKS 'TABS))
-                   (SETQ STYLE (LISTGET NEWLOOKS 'STYLE))
-                   (SETQ STYLESET (FMEMB 'STYLE NEWLOOKS))
-                   (SETQ CHARSTYLES (LISTGET NEWLOOKS 'CHARSTYLES))
-                   (SETQ CHARSTYLESSET (FMEMB 'CHARSTYLES NEWLOOKS))
-                   (SETQ COLUMN (LISTGET NEWLOOKS 'COLUMN))
-                   (SETQ COLUMNSET (FMEMB 'COLUMN NEWLOOKS))
-                   (SETQ STYLE (LISTGET NEWLOOKS 'STYLE))
-                   (SETQ STYLESET (FMEMB 'STYLE NEWLOOKS]
+                 (SETQ KEEPSET (FMEMB 'KEEP NEWLOOKS))
+                 (SETQ BASETOBASE (LISTGET NEWLOOKS 'BASETOBASE))
+                 (SETQ BASESET (FMEMB 'BASETOBASE NEWLOOKS))
+                 (SETQ HCPYMODE (LISTGET NEWLOOKS 'HARDCOPY))
+                 (SETQ HCPYSET (FMEMB 'HARDCOPY NEWLOOKS))
+                 (SETQ USERINFO (LISTGET NEWLOOKS 'USERINFO))
+                 (SETQ USERSET (FMEMB 'USERINFO NEWLOOKS))
+                 (SETQ REVISED (LISTGET NEWLOOKS 'REVISED))
+                 (SETQ REVISEDSET (FMEMB 'REVISED NEWLOOKS))
+                 (SETQ TABSPECC (LISTGET NEWLOOKS 'TABS))
+                 (SETQ STYLE (LISTGET NEWLOOKS 'STYLE))
+                 (SETQ STYLESET (FMEMB 'STYLE NEWLOOKS))
+                 (SETQ CHARSTYLES (LISTGET NEWLOOKS 'CHARSTYLES))
+                 (SETQ CHARSTYLESSET (FMEMB 'CHARSTYLES NEWLOOKS))
+                 (SETQ COLUMN (LISTGET NEWLOOKS 'COLUMN))
+                 (SETQ COLUMNSET (FMEMB 'COLUMN NEWLOOKS))
+                 (SETQ STYLE (LISTGET NEWLOOKS 'STYLE))
+                 (SETQ STYLESET (FMEMB 'STYLE NEWLOOKS]
 
-             (* ;; "The  new format specification has been decoded into the different variables. ")
+      (* ;; "The  new format specification has been decoded into the different variables. ")
 
-             (* ;; "Apply it to the piece that begins the paragraph containing the first selected character, the piece that ends the paragraph containing the last piece of the selection, and all pieces in between.")
+      (* ;; "Apply it to the piece that begins the paragraph containing the first selected character, the piece that ends the paragraph containing the last piece of the selection, and all pieces in between.")
 
-             (SETQ PARAPIECES (\TEDIT.PARAPIECES SEL NIL TEXTOBJ))
+           (SETQ PARAPIECES (\TEDIT.PARAPIECES SEL NIL TEXTOBJ))
 
-             (* ;; "Presumably all the pieces within a paragraph have the same looks, and maybe a sequence of paragraphs will have the same looks.  Testing LASTFMTSPEC will typically avoid repeated calculation of the same NEWFMTSPEC")
+      (* ;; "Presumably all the pieces within a paragraph have the same looks, and maybe a sequence of paragraphs will have the same looks.  Testing LASTFMTSPEC will typically avoid repeated calculation of the same NEWFMTSPEC")
 
-             (for PC LASTFMTSPEC NEWFMTSPEC inselpieces PARAPIECES
-                do (push OLDLOOKSLIST (PPARALOOKS PC))       (* ; 
+           (for PC LASTFMTSPEC NEWFMTSPEC inselpieces PARAPIECES
+              do (push OLDLOOKSLIST (PPARALOOKS PC))         (* ; 
                                                       "Save the old looks of each piece for undoing.")
-                   (if (type? FMTSPEC NEWLOOKS)
-                       then (FSETPC PC PPARALOOKS NEWLOOKS)
-                     else (CL:UNLESS (EQ (PPARALOOKS PC)
-                                         LASTFMTSPEC)
+                 (if (type? FMTSPEC NEWLOOKS)
+                     then (FSETPC PC PPARALOOKS NEWLOOKS)
+                   else (CL:UNLESS (EQ (PPARALOOKS PC)
+                                       LASTFMTSPEC)
 
-                              (* ;; "We need to instantiate new looks for this piece.")
+                            (* ;; "We need to instantiate new looks for this piece.")
 
-                              (SETQ LASTFMTSPEC (PPARALOOKS PC))
-                              (SETQ NEWFMTSPEC (create FMTSPEC using LASTFMTSPEC))
-                              (AND 1STLEFT (freplace (FMTSPEC 1STLEFTMAR) of NEWFMTSPEC with 1STLEFT)
-                                   )
-                              (AND LEFT (freplace (FMTSPEC LEFTMAR) of NEWFMTSPEC with LEFT))
-                              (AND RIGHT (freplace (FMTSPEC RIGHTMAR) of NEWFMTSPEC with RIGHT))
-                              (AND LEADB (freplace (FMTSPEC LEADBEFORE) of NEWFMTSPEC with LEADB))
-                              (AND LEADA (freplace (FMTSPEC LEADAFTER) of NEWFMTSPEC with LEADA))
-                              (AND BLEADSET (freplace (FMTSPEC FMTBASETOBASE) of NEWFMTSPEC
-                                               with BLEAD))
-                              (AND LLEAD (freplace (FMTSPEC LINELEAD) of NEWFMTSPEC with LLEAD))
-                              (CL:WHEN TABSPECC
+                            (SETQ LASTFMTSPEC (PPARALOOKS PC))
+                            (SETQ NEWFMTSPEC (create FMTSPEC using LASTFMTSPEC))
+                            (AND 1STLEFT (freplace (FMTSPEC 1STLEFTMAR) of NEWFMTSPEC with 1STLEFT))
+                            (AND LEFT (freplace (FMTSPEC LEFTMAR) of NEWFMTSPEC with LEFT))
+                            (AND RIGHT (freplace (FMTSPEC RIGHTMAR) of NEWFMTSPEC with RIGHT))
+                            (AND LEADB (freplace (FMTSPEC LEADBEFORE) of NEWFMTSPEC with LEADB))
+                            (AND LEADA (freplace (FMTSPEC LEADAFTER) of NEWFMTSPEC with LEADA))
+                            (AND BLEADSET (freplace (FMTSPEC FMTBASETOBASE) of NEWFMTSPEC
+                                             with BLEAD))
+                            (AND LLEAD (freplace (FMTSPEC LINELEAD) of NEWFMTSPEC with LLEAD))
+                            (CL:WHEN TABSPECC
 
-                                  (* ;; "change from the users list to the real tabspec --- CONS pair of default width and LIST of TAB record instances")
+                                (* ;; "change from the users list to the real tabspec --- CONS pair of default width and LIST of TAB record instances")
 
-                                  [SETQ TABSPECC (CONS [OR (COND
-                                                              ((AND (CAR TABSPECC)
-                                                                    (ZEROP (CAR TABSPECC)))
-                                                               1)
-                                                              (T (CAR TABSPECC)))
-                                                           (CAR (fetch (FMTSPEC TABSPEC)
-                                                                   of (PPARALOOKS PC]
-                                                       (for SPEC in (CDR TABSPECC)
-                                                          collect (create TAB
-                                                                         TABKIND _ (CDR SPEC)
-                                                                         TABX _ (CAR SPEC]
-                                  (freplace (FMTSPEC TABSPEC) of NEWFMTSPEC with TABSPECC))
-                              (AND QUADD (freplace (FMTSPEC QUAD) of NEWFMTSPEC with QUADD))
-                              (AND TYPESET (freplace (FMTSPEC FMTPARATYPE) of NEWFMTSPEC with TYPE))
-                              (AND SUBTYPESET (freplace (FMTSPEC FMTPARASUBTYPE) of NEWFMTSPEC
-                                                 with SUBTYPE))
-                              (AND SPECIALX (freplace (FMTSPEC FMTSPECIALX) of NEWFMTSPEC
-                                               with SPECIALX))
-                              (AND SPECIALY (freplace (FMTSPEC FMTSPECIALY) of NEWFMTSPEC
-                                               with SPECIALY))
-                              (AND NEWBEFORESET (freplace (FMTSPEC FMTNEWPAGEBEFORE) of NEWFMTSPEC
-                                                   with NEWBEFORE))
-                              (AND NEWAFTERSET (freplace (FMTSPEC FMTNEWPAGEAFTER) of NEWFMTSPEC
-                                                  with NEWAFTER))
-                              [AND HEADINGKEEP (freplace (FMTSPEC FMTHEADINGKEEP) of NEWFMTSPEC
-                                                  with (EQ HEADINGKEEP 'ON]
-                              (AND KEEPSET (freplace (FMTSPEC FMTKEEP) of NEWFMTSPEC with KEEP))
-                              (AND BASESET (freplace (FMTSPEC FMTBASETOBASE) of NEWFMTSPEC
-                                              with BASETOBASE))
-                              (AND HCPYSET (freplace (FMTSPEC FMTHARDCOPY) of NEWFMTSPEC with 
-                                                                                             HCPYMODE
-                                                  ))
-                              (AND USERSET (freplace (FMTSPEC FMTUSERINFO) of NEWFMTSPEC with 
-                                                                                             USERINFO
-                                                  ))
-                              (AND REVISEDSET (freplace (FMTSPEC FMTREVISED) of NEWFMTSPEC
-                                                 with REVISED))
-                              (AND STYLESET (freplace (FMTSPEC FMTSTYLE) of NEWFMTSPEC with STYLE))
-                              (AND CHARSTYLESSET (freplace (FMTSPEC FMTCHARSTYLES) of NEWFMTSPEC
-                                                    with CHARSTYLES))
-                              (AND COLUMNSET (freplace (FMTSPEC FMTCOLUMN) of NEWFMTSPEC with COLUMN)
-                                   )
-                              (AND STYLESET (replace (FMTSPEC FMTSTYLE) of NEWFMTSPEC with STYLE)))
-                          (SETQ NEWFMTSPEC (\TEDIT.UNIQUIFY.PARALOOKS NEWFMTSPEC TEXTOBJ))
-                          (FSETPC PC PPARALOOKS NEWFMTSPEC)))
-             (\TEDIT.HISTORYADD TEXTOBJ (create TEDITHISTORYEVENT
-                                               THACTION _ :ParaLooks
-                                               THLEN _ (fetch (SELPIECES SPLEN) of PARAPIECES)
-                                               THCH# _ (fetch (SELPIECES SPFIRSTCHAR) of PARAPIECES)
-                                               THFIRSTPIECE _ (fetch (SELPIECES SPFIRST) of 
-                                                                                           PARAPIECES
-                                                                     )
-                                               THOLDINFO _ (DREVERSE OLDLOOKSLIST)))
+                                [SETQ TABSPECC (CONS [OR (COND
+                                                            ((AND (CAR TABSPECC)
+                                                                  (ZEROP (CAR TABSPECC)))
+                                                             1)
+                                                            (T (CAR TABSPECC)))
+                                                         (CAR (fetch (FMTSPEC TABSPEC)
+                                                                 of (PPARALOOKS PC]
+                                                     (for SPEC in (CDR TABSPECC)
+                                                        collect (create TAB
+                                                                       TABKIND _ (CDR SPEC)
+                                                                       TABX _ (CAR SPEC]
+                                (freplace (FMTSPEC TABSPEC) of NEWFMTSPEC with TABSPECC))
+                            (AND QUADD (freplace (FMTSPEC QUAD) of NEWFMTSPEC with QUADD))
+                            (AND TYPESET (freplace (FMTSPEC FMTPARATYPE) of NEWFMTSPEC with TYPE))
+                            (AND SUBTYPESET (freplace (FMTSPEC FMTPARASUBTYPE) of NEWFMTSPEC
+                                               with SUBTYPE))
+                            (AND SPECIALX (freplace (FMTSPEC FMTSPECIALX) of NEWFMTSPEC with SPECIALX
+                                                 ))
+                            (AND SPECIALY (freplace (FMTSPEC FMTSPECIALY) of NEWFMTSPEC with SPECIALY
+                                                 ))
+                            (AND NEWBEFORESET (freplace (FMTSPEC FMTNEWPAGEBEFORE) of NEWFMTSPEC
+                                                 with NEWBEFORE))
+                            (AND NEWAFTERSET (freplace (FMTSPEC FMTNEWPAGEAFTER) of NEWFMTSPEC
+                                                with NEWAFTER))
+                            [AND HEADINGKEEP (freplace (FMTSPEC FMTHEADINGKEEP) of NEWFMTSPEC
+                                                with (EQ HEADINGKEEP 'ON]
+                            (AND KEEPSET (freplace (FMTSPEC FMTKEEP) of NEWFMTSPEC with KEEP))
+                            (AND BASESET (freplace (FMTSPEC FMTBASETOBASE) of NEWFMTSPEC with 
+                                                                                           BASETOBASE
+                                                ))
+                            (AND HCPYSET (freplace (FMTSPEC FMTHARDCOPY) of NEWFMTSPEC with HCPYMODE)
+                                 )
+                            (AND USERSET (freplace (FMTSPEC FMTUSERINFO) of NEWFMTSPEC with USERINFO)
+                                 )
+                            (AND REVISEDSET (freplace (FMTSPEC FMTREVISED) of NEWFMTSPEC with REVISED
+                                                   ))
+                            (AND STYLESET (freplace (FMTSPEC FMTSTYLE) of NEWFMTSPEC with STYLE))
+                            (AND CHARSTYLESSET (freplace (FMTSPEC FMTCHARSTYLES) of NEWFMTSPEC
+                                                  with CHARSTYLES))
+                            (AND COLUMNSET (freplace (FMTSPEC FMTCOLUMN) of NEWFMTSPEC with COLUMN))
+                            (AND STYLESET (replace (FMTSPEC FMTSTYLE) of NEWFMTSPEC with STYLE)))
+                        (SETQ NEWFMTSPEC (\TEDIT.UNIQUIFY.PARALOOKS NEWFMTSPEC TEXTOBJ))
+                        (FSETPC PC PPARALOOKS NEWFMTSPEC)))
+           (\TEDIT.HISTORYADD TEXTOBJ (create TEDITHISTORYEVENT
+                                             THACTION _ :ParaLooks
+                                             THLEN _ (fetch (SELPIECES SPLEN) of PARAPIECES)
+                                             THCH# _ (fetch (SELPIECES SPFIRSTCHAR) of PARAPIECES)
+                                             THFIRSTPIECE _ (fetch (SELPIECES SPFIRST) of PARAPIECES)
+                                             THOLDINFO _ (DREVERSE OLDLOOKSLIST)))
 
-             (* ;; "Pieces have been updated.  Now update any visible lines.")
+      (* ;; "Pieces have been updated.  Now update any visible lines.")
 
-             (CL:WHEN (FGETTOBJ TEXTOBJ \WINDOW)
-                 (\SHOWSEL SEL NIL)                          (* ; 
+           (CL:WHEN (FGETTOBJ TEXTOBJ \WINDOW)
+               (\TEDIT.SHOWSEL SEL NIL)                      (* ; 
                                                         "Turn off the sel before updating the screen")
-                 (\TEDIT.MARK.LINES.DIRTY TEXTOBJ PARAPIECES)
-                 (CL:UNLESS (AND (LISTP NEWLOOKS)
-                                 (EQ 'HARDCOPY (CAR NEWLOOKS))
-                                 (NULL (CDDR NEWLOOKS)))
+               (\TEDIT.MARK.LINES.DIRTY TEXTOBJ PARAPIECES)
+               (CL:UNLESS (AND (LISTP NEWLOOKS)
+                               (EQ 'HARDCOPY (CAR NEWLOOKS))
+                               (NULL (CDDR NEWLOOKS)))
 
-                     (* ;; "The document is %"dirty%" for the titlebar and saving only if something other than hardcopy-display mode was changed")
+                   (* ;; "The document is %"dirty%" for the titlebar and saving only if something other than hardcopy-display mode was changed")
 
-                     (FSETTOBJ TEXTOBJ \DIRTY T))            (* ; "Save this action for undo/redo")
-                 (TEDIT.RESET.EXTEND.PENDING.DELETE SEL)
-                 (TEDIT.UPDATE.SCREEN TEXTOBJ)               (* ; 
+                   (FSETTOBJ TEXTOBJ \DIRTY T))              (* ; "Save this action for undo/redo")
+               (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ)
+               (\TEDIT.UPDATE.SCREEN TEXTOBJ)                (* ; 
                                             "Update the screen image, showing the original selection")
-                 (\FIXSEL SEL TEXTOBJ)
-                 (\SHOWSEL SEL T))))])
+               (\TEDIT.FIXSEL SEL TEXTOBJ)
+               (\TEDIT.SHOWSEL SEL T))])
 
 (TEDIT.COPY.PARALOOKS
-  [LAMBDA (TSTREAM SOURCE DEST)                              (* ; "Edited  9-Feb-2024 11:39 by rmk")
+  [LAMBDA (TSTREAM SOURCE DEST)                              (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited  9-Feb-2024 11:39 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:53 by rmk")
                                                              (* ; "Edited 22-Oct-2022 15:29 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:15 by rmk")
@@ -1966,9 +2000,9 @@ CONS pair of default width and LIST of TAB record instances")
            LOOKS LEN)                                        (* ; 
                                            "get the paragraph looks of the first character of SOURCE")
           [SETQ LOOKS (PPARALOOKS (if (FIXP SOURCE)
-                                      then (\CHTOPC SOURCE TEXTOBJ)
+                                      then (\TEDIT.CHTOPC SOURCE TEXTOBJ)
                                     elseif (type? SELECTION SOURCE)
-                                      then (\CHTOPC (fetch (SELECTION CH#) of SOURCE)
+                                      then (\TEDIT.CHTOPC (fetch (SELECTION CH#) of SOURCE)
                                                   (fetch (SELECTION SELTEXTOBJ) of SOURCE))
                                     else (\ILLEGAL.ARG SOURCE]
           (COND
@@ -1982,7 +2016,8 @@ CONS pair of default width and LIST of TAB record instances")
           (TEDIT.PARALOOKS TEXTOBJ LOOKS DEST LEN])
 
 (\TEDIT.PARABOUNDS
-  [LAMBDA (TEXTOBJ CH#)                                      (* ; "Edited 26-Mar-2023 12:54 by rmk")
+  [LAMBDA (TEXTOBJ CH#)                                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 26-Mar-2023 12:54 by rmk")
                                                              (* ; "Edited 20-Feb-2023 13:55 by rmk")
                                                              (* ; "Edited 25-Oct-2022 14:50 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:17 by rmk")
@@ -1995,7 +2030,7 @@ CONS pair of default width and LIST of TAB record instances")
              (CONS 0 0)
       else (LET (CHPIECE START-OF-PIECE START END)
                 (DECLARE (SPECVARS START-OF-PIECE))
-                (SETQ CHPIECE (\CHTOPC (IMIN CH# (TEXTLEN TEXTOBJ))
+                (SETQ CHPIECE (\TEDIT.CHTOPC (IMIN CH# (TEXTLEN TEXTOBJ))
                                      TEXTOBJ T))
                 (SETQ START START-OF-PIECE)                  (* ; "Find the paragraph's first char")
                 [for PC backpieces (PREVPIECE CHPIECE) until (PPARALAST PC)
@@ -2012,7 +2047,9 @@ CONS pair of default width and LIST of TAB record instances")
 (DEFINEQ
 
 (TEDIT.SUBPARALOOKS
-  [LAMBDA (TEXTSTREAM OLDLOOKSLIST NEWLOOKSLIST)             (* ; "Edited 18-Apr-2023 23:54 by rmk")
+  [LAMBDA (TEXTSTREAM OLDLOOKSLIST NEWLOOKSLIST)             (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:23 by rmk")
+                                                             (* ; "Edited 18-Apr-2023 23:54 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:13 by rmk")
                                                              (* ; "Edited 26-Apr-93 15:13 by jds")
 
@@ -2022,10 +2059,10 @@ CONS pair of default width and LIST of TAB record instances")
            (NEWLOOKS (\TEDIT.PARSE.PARALOOKS.LIST NEWLOOKSLIST))
            (TEXTOBJ (TEXTOBJ TEXTSTREAM))
            (SEL (fetch (TEXTOBJ SEL) of TEXTOBJ))
-           (FIRSTPC (\CHTOPC 1 TEXTOBJ))
+           (FIRSTPC (\TEDIT.CHTOPC 1 TEXTOBJ))
            (FEATURELIST (for A on OLDLOOKSLIST by (CDDR A) collect (CAR A)))
            CHANGEMADE)
-          (\SHOWSEL SEL NIL)                                 (* ; "Turn off the selection, first.")
+          (\TEDIT.SHOWSEL SEL NIL)                           (* ; "Turn off the selection, first.")
           [OR (ZEROP (fetch (TEXTOBJ TEXTLEN) of TEXTOBJ))
               (bind (CH# _ 1) for (PC _ FIRSTPC) while PC by (fetch (PIECE NEXTPIECE) of PC)
                  do (COND
@@ -2043,9 +2080,9 @@ CONS pair of default width and LIST of TAB record instances")
                     (add CH# (fetch (PIECE PLEN) of PC]
           (COND
              ((fetch (TEXTOBJ \WINDOW) of TEXTOBJ)
-              (TEDIT.UPDATE.SCREEN TEXTOBJ)                  (* ; "Update the screen image")
-              (\FIXSEL SEL TEXTOBJ)
-              (\SHOWSEL SEL T)))
+              (\TEDIT.UPDATE.SCREEN TEXTOBJ)                 (* ; "Update the screen image")
+              (\TEDIT.FIXSEL SEL TEXTOBJ)
+              (\TEDIT.SHOWSEL SEL T)))
           (COND
              (CHANGEMADE 'Done)
              (T 'NoChangesMade])
@@ -2097,7 +2134,8 @@ CONS pair of default width and LIST of TAB record instances")
 (DEFINEQ
 
 (\TEDIT.UNDO.LOOKS
-  [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited 19-Feb-2024 11:32 by rmk")
+  [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited 15-Mar-2024 14:23 by rmk")
+                                                             (* ; "Edited 19-Feb-2024 11:32 by rmk")
                                                              (* ; "Edited 14-Dec-2023 21:01 by rmk")
                                                              (* ; "Edited 30-May-2023 22:56 by rmk")
                                                              (* ; "Edited 28-May-2023 00:31 by rmk")
@@ -2120,14 +2158,15 @@ CONS pair of default width and LIST of TAB record instances")
                                                  "Remember the other looks in case we UNDO the UNDO.")
              (\TEDIT.MARK.LINES.DIRTY TEXTOBJ (GETTH EVENT THCH#)
                     (SUB1 (GETTH EVENT THCHLIM)))
-             (TEDIT.UPDATE.SCREEN TEXTOBJ)
+             (\TEDIT.UPDATE.SCREEN TEXTOBJ)
              (\TEDIT.SET.SEL.LOOKS SEL 'NORMAL)
-             (\FIXSEL SEL TEXTOBJ)
-             (\SHOWSEL SEL T))
+             (\TEDIT.FIXSEL SEL TEXTOBJ)
+             (\TEDIT.SHOWSEL SEL T))
     (\TEDIT.HISTORYADD TEXTOBJ EVENT])
 
 (\TEDIT.UNDO.PARALOOKS
-  [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited 19-Feb-2024 11:32 by rmk")
+  [LAMBDA (TEXTOBJ EVENT)                                    (* ; "Edited 15-Mar-2024 14:23 by rmk")
+                                                             (* ; "Edited 19-Feb-2024 11:32 by rmk")
                                                              (* ; "Edited 11-Dec-2023 11:10 by rmk")
                                                              (* ; "Edited 21-Sep-2023 23:51 by rmk")
                                                              (* ; "Edited 30-May-2023 22:55 by rmk")
@@ -2149,10 +2188,10 @@ CONS pair of default width and LIST of TAB record instances")
                     (IPLUS (fetch THCH# of EVENT)
                            (fetch THLEN of EVENT)
                            -1))
-             (TEDIT.UPDATE.SCREEN TEXTOBJ)
+             (\TEDIT.UPDATE.SCREEN TEXTOBJ)
              (\TEDIT.SET.SEL.LOOKS SEL 'NORMAL)
-             (\FIXSEL SEL TEXTOBJ)
-             (\SHOWSEL SEL T))
+             (\TEDIT.FIXSEL SEL TEXTOBJ)
+             (\TEDIT.SHOWSEL SEL T))
     (\TEDIT.HISTORYADD TEXTOBJ EVENT])
 )
 
@@ -2401,25 +2440,25 @@ CONS pair of default width and LIST of TAB record instances")
 (GLOBALVARS *TEDIT-PARASTYLE-CACHE* *TEDIT-CURRENTPARA-CACHE* *TEDIT-STYLESHEET-SAVE-LIST*)
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (20694 22455 (\TEDIT.CHARLOOKS.DEFPRINT 20704 . 21835) (\TEDIT.FMTSPEC.DEFPRINT 21837 . 
-22453)) (23565 49900 (CHARLOOKS.FROM.FONT 23575 . 24943) (EQCLOOKS 24945 . 27996) (SAMECLOOKS 27998 . 
-32150) (TEDIT.CARETLOOKS 32152 . 33194) (TEDIT.COPY.LOOKS 33196 . 35181) (
-\TEDIT.UNPARSE.CHARLOOKS.LIST 35183 . 37786) (TEDIT.MODIFYLOOKS 37788 . 39781) (TEDIT.NEW.FONT 39783
- . 40203) (\TEDIT.CARETLOOKS.VERIFY 40205 . 41042) (\TEDIT.CARETPIECE 41044 . 41234) (
-\TEDIT.GET.INSERT.CHARLOOKS 41236 . 42748) (\TEDIT.GET.TERMSA.WIDTHS 42750 . 43166) (
-\TEDIT.PARSE.CHARLOOKS.LIST 43168 . 49898)) (49901 64075 (\TEDIT.TRANSLATE.ASCIICHARS 49911 . 59922) (
-\TEDIT.CONVERT.TO.FORMATTED 59924 . 64073)) (65265 71980 (\TEDIT.UNIQUIFY.CHARLOOKS 65275 . 66819) (
-\TEDIT.UNIQUIFY.PARALOOKS 66821 . 67972) (\TEDIT.UNIQUIFY.ALL 67974 . 69676) (
-\TEDIT.FLUSH.UNUSED.LOOKS 69678 . 71978)) (72028 77417 (TEDIT.SUBLOOKS 72038 . 74942) (TEDIT.FINDLOOKS
- 74944 . 77415)) (77418 98291 (\TEDIT.CHANGE.LOOKS 77428 . 90252) (TEDIT.LOOKS 90254 . 92101) (
-\TEDIT.LOOKS 92103 . 95001) (\TEDIT.FONTCOPY 95003 . 96201) (TEDIT.GET.LOOKS 96203 . 98289)) (98334 
-130248 (EQFMTSPEC 98344 . 101845) (TEDIT.GET.PARALOOKS 101847 . 105476) (\TEDIT.PARSE.PARALOOKS.LIST 
-105478 . 113396) (TEDIT.PARALOOKS 113398 . 126737) (TEDIT.COPY.PARALOOKS 126739 . 128697) (
-\TEDIT.PARABOUNDS 128699 . 130246)) (130308 136351 (TEDIT.SUBPARALOOKS 130318 . 132952) (SAMEPARALOOKS
- 132954 . 136349)) (136394 140305 (\TEDIT.UNDO.LOOKS 136404 . 138566) (\TEDIT.UNDO.PARALOOKS 138568 . 
-140303)) (140344 140922 (\TEDIT.MARK.REVISION 140354 . 140920)) (140984 141809 (
-\CREATE.TEDIT.DEFAULT.FMTSPEC 140994 . 141431) (\CREATE.TEDIT.FACE.MENU 141433 . 141605) (
-\CREATE.TEDIT.SIZE.MENU 141607 . 141807)) (141846 150751 (\TEDIT.APPLY.STYLES 141856 . 145421) (
-\TEDIT.APPLY.PARASTYLES 145423 . 147625) (TEDIT.STYLESHEET 147627 . 148694) (TEDIT.POP.STYLESHEET 
-148696 . 149364) (TEDIT.PUSH.STYLESHEET 149366 . 150106) (TEDIT.ADD.STYLESHEET 150108 . 150749)))))
+  (FILEMAP (NIL (20987 22748 (\TEDIT.CHARLOOKS.DEFPRINT 20997 . 22128) (\TEDIT.FMTSPEC.DEFPRINT 22130 . 
+22746)) (23858 50564 (CHARLOOKS.FROM.FONT 23868 . 25236) (\TEDIT.EQCLOOKS 25238 . 28296) (
+\TEDIT.SAMECLOOKS 28298 . 32457) (TEDIT.CARETLOOKS 32459 . 33501) (TEDIT.COPY.LOOKS 33503 . 35609) (
+\TEDIT.UNPARSE.CHARLOOKS.LIST 35611 . 38214) (TEDIT.MODIFYLOOKS 38216 . 40209) (TEDIT.NEW.FONT 40211
+ . 40631) (\TEDIT.CARETLOOKS.VERIFY 40633 . 41470) (\TEDIT.CARETPIECE 41472 . 41777) (
+\TEDIT.GET.INSERT.CHARLOOKS 41779 . 43412) (\TEDIT.GET.TERMSA.WIDTHS 43414 . 43830) (
+\TEDIT.PARSE.CHARLOOKS.LIST 43832 . 50562)) (50565 65304 (\TEDIT.TRANSLATE.ASCIICHARS 50575 . 60783) (
+\TEDIT.CONVERT.TO.FORMATTED 60785 . 65302)) (66494 73729 (\TEDIT.UNIQUIFY.CHARLOOKS 66504 . 68164) (
+\TEDIT.UNIQUIFY.PARALOOKS 68166 . 69433) (\TEDIT.UNIQUIFY.ALL 69435 . 71292) (
+\TEDIT.FLUSH.UNUSED.LOOKS 71294 . 73727)) (73762 83747 (TEDIT.LOOKS 73772 . 75619) (TEDIT.GET.LOOKS 
+75621 . 77650) (TEDIT.SUBLOOKS 77652 . 81111) (TEDIT.FINDLOOKS 81113 . 83745)) (83748 101074 (
+\TEDIT.CHANGE.LOOKS 83758 . 96972) (\TEDIT.LOOKS 96974 . 99872) (\TEDIT.FONTCOPY 99874 . 101072)) (
+101117 133234 (\TEDIT.EQFMTSPEC 101127 . 104635) (TEDIT.GET.PARALOOKS 104637 . 108417) (
+\TEDIT.PARSE.PARALOOKS.LIST 108419 . 116337) (TEDIT.PARALOOKS 116339 . 129487) (TEDIT.COPY.PARALOOKS 
+129489 . 131568) (\TEDIT.PARABOUNDS 131570 . 133232)) (133294 139573 (TEDIT.SUBPARALOOKS 133304 . 
+136174) (SAMEPARALOOKS 136176 . 139571)) (139616 143771 (\TEDIT.UNDO.LOOKS 139626 . 141910) (
+\TEDIT.UNDO.PARALOOKS 141912 . 143769)) (143810 144388 (\TEDIT.MARK.REVISION 143820 . 144386)) (144450
+ 145275 (\CREATE.TEDIT.DEFAULT.FMTSPEC 144460 . 144897) (\CREATE.TEDIT.FACE.MENU 144899 . 145071) (
+\CREATE.TEDIT.SIZE.MENU 145073 . 145273)) (145312 154217 (\TEDIT.APPLY.STYLES 145322 . 148887) (
+\TEDIT.APPLY.PARASTYLES 148889 . 151091) (TEDIT.STYLESHEET 151093 . 152160) (TEDIT.POP.STYLESHEET 
+152162 . 152830) (TEDIT.PUSH.STYLESHEET 152832 . 153572) (TEDIT.ADD.STYLESHEET 153574 . 154215)))))
 STOP
diff --git a/library/tedit/TEDIT-LOOKS.LCOM b/library/tedit/TEDIT-LOOKS.LCOM
index 59163a20..2c096329 100644
Binary files a/library/tedit/TEDIT-LOOKS.LCOM and b/library/tedit/TEDIT-LOOKS.LCOM differ
diff --git a/library/tedit/TEDIT-MENU b/library/tedit/TEDIT-MENU
index afe378b6..355a34eb 100644
--- a/library/tedit/TEDIT-MENU
+++ b/library/tedit/TEDIT-MENU
@@ -1,12 +1,14 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 1-Mar-2024 20:35:49" {WMEDLEY}<library>tedit>TEDIT-MENU.;150 263731 
+(FILECREATED "27-Mar-2024 15:21:00" {WMEDLEY}<library>tedit>TEDIT-MENU.;167 268556 
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS \TEDIT.APPLY.PARALOOKS)
+      :CHANGES-TO (FNS \TEDIT.SHOW.PAGEFORMATTING \TEDIT.APPLY.PAGEFORMATTING \TEDIT.APPLY.CHARLOOKS
+                       \TEDIT.SHOW.CHARLOOKS MB.SELFN \TEDIT.SHOW.PARALOOKS MB.WHENOPERATEDFN 
+                       MB.SHOWSELFN)
 
-      :PREVIOUS-DATE "27-Feb-2024 08:13:25" {WMEDLEY}<library>tedit>TEDIT-MENU.;149)
+      :PREVIOUS-DATE "20-Mar-2024 11:06:06" {WMEDLEY}<library>TEDIT>TEDIT-MENU.;163)
 
 
 (PRETTYCOMPRINT TEDIT-MENUCOMS)
@@ -171,7 +173,7 @@
                                                   (PROGN (SETTOBJ TEXTOBJ TXTDON'TUPDATE T) . BODY)
                                                   (\TEDIT.MARK.LINES.DIRTY TEXTOBJ 1 -1)
                                                   (SETTOBJ TEXTOBJ TXTDON'TUPDATE OLD-DON'TUPDATE)
-                                                  (TEDIT.UPDATE.SCREEN TEXTOBJ))])
+                                                  (\TEDIT.UPDATE.SCREEN TEXTOBJ))])
 )
 )
 
@@ -261,7 +263,8 @@
           (RETURN OBJ])
 
 (MB.SELFN
-  [LAMBDA (OBJ SEL W FN)                                     (* ; "Edited 16-Feb-2024 20:48 by rmk")
+  [LAMBDA (OBJ SEL W FN)                                     (* ; "Edited 15-Mar-2024 13:38 by rmk")
+                                                             (* ; "Edited 16-Feb-2024 20:48 by rmk")
                                                              (* ; "Edited 24-Jan-2024 10:48 by rmk")
                                                              (* ; "Edited  6-Jun-2023 15:31 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:58 by rmk")
@@ -271,7 +274,7 @@
     (* ;; 
     "Calls a menu-button's associated function, then turns off the highlighting of the menu button.")
 
-    (LET [(TSEL (\COPYSEL SEL))
+    (LET [(TSEL (\TEDIT.COPYSEL SEL))
           (BUTTONFN (OR FN (IMAGEOBJPROP OBJ 'MBFN]          (* ; 
                                                  "Save the selection that points to the menu button.")
          (SETSEL SEL SELKIND 'CHAR)
@@ -279,9 +282,9 @@
          (CL:UNLESS (EQ (AND BUTTONFN (APPLY* BUTTONFN OBJ SEL W))
                         'DON'T)                              (* ; 
                                                          "If the button fn left the selection alone,")
-             (\FIXSEL TSEL)                                  (* ; 
+             (\TEDIT.FIXSEL TSEL)                            (* ; 
      "Turn off the button hilite. Perhaps the function changed something that changed the selection?")
-             (\SHOWSEL TSEL NIL))
+             (\TEDIT.SHOWSEL TSEL NIL))
          (SETSEL SEL SET NIL])
 
 (MB.SIZEFN
@@ -303,11 +306,12 @@
          BOX])
 
 (MB.WHENOPERATEDFN
-  [LAMBDA (OBJ DS OPERATION SEL)                             (* jds " 7-Feb-84 14:20")
+  [LAMBDA (OBJ W OPERATION SEL)                              (* ; "Edited 27-Mar-2024 13:49 by rmk")
+                                                             (* jds " 7-Feb-84 14:20")
     (SELECTQ OPERATION
-        (HIGHLIGHTED (MB.SHOWSELFN OBJ SEL T DS))
-        (UNHIGHLIGHTED (MB.SHOWSELFN OBJ SEL NIL DS))
-        (SELECTED (MB.SELFN OBJ SEL DS))
+        (HIGHLIGHTED (MB.SHOWSELFN OBJ SEL T W))
+        (UNHIGHLIGHTED (MB.SHOWSELFN OBJ SEL NIL W))
+        (SELECTED (MB.SELFN OBJ SEL W))
         (DESELECTED)
         NIL])
 
@@ -350,19 +354,20 @@
           (for ATTR in (FONTPROP FONT 'FACE) do (\ATMOUT FILE ATTR])
 
 (MB.SHOWSELFN
-  [LAMBDA (OBJ SEL ON DS)                                    (* ; "Edited 20-Nov-2023 20:16 by rmk")
+  [LAMBDA (OBJ SEL ON W)                                     (* ; "Edited 27-Mar-2024 13:47 by rmk")
+                                                             (* ; "Edited 20-Nov-2023 20:16 by rmk")
                                                              (* ; "Edited 11-Jan-89 16:35 by jds")
     (LET [(OBJBOX (IMAGEOBJPROP OBJ 'BOUNDBOX]
          (OR (IMAGEOBJPROP OBJ 'BITCACHE)
              (MB.DISPLAY OBJ))                               (* ; "MAKE SURE THE DISPLAY FORM EXISTS")
          (BITBLT (IMAGEOBJPROP OBJ 'BITCACHE)
-                0 0 DS 0 0 (fetch (IMAGEBOX XSIZE) of OBJBOX)
+                0 0 W 0 0 (fetch (IMAGEBOX XSIZE) of OBJBOX)
                 (fetch (IMAGEBOX YSIZE) of OBJBOX)
                 'INPUT
                 'REPLACE)
          (CL:WHEN (OR ON (EQ (IMAGEOBJPROP OBJ 'STATE)
                              'ON))
-             (BLTSHADE BLACKSHADE DS 0 0 (fetch (IMAGEBOX XSIZE) of OBJBOX)
+             (BLTSHADE BLACKSHADE W 0 0 (fetch (IMAGEBOX XSIZE) of OBJBOX)
                     (fetch (IMAGEBOX YSIZE) of OBJBOX)
                     'INVERT))])
 
@@ -399,14 +404,15 @@
           (TEDIT.OBJECT.CHANGED TEXTOBJ OBJ])
 
 (MBUTTON.FIND.BUTTON
-  [LAMBDA (LABEL TEXTSTREAM CH#)                             (* ; "Edited 16-Sep-2022 21:20 by rmk")
+  [LAMBDA (LABEL TEXTSTREAM CH#)                             (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 16-Sep-2022 21:20 by rmk")
                                                              (* ; "Edited 22-Aug-2022 15:29 by rmk")
                                                              (* ; "Edited 22-Apr-93 15:40 by jds")
                                                              (* ; "'27-Sep-84 00:52' gbn")
 
     (* ;; "Returns the piece containing the imageobj with MBTEXT prop LABEL")
 
-    (for (PC _ (\CHTOPC (OR CH# 1)
+    (for (PC _ (\TEDIT.CHTOPC (OR CH# 1)
                       (TEXTOBJ TEXTSTREAM)))
          OBJ
          (LABELATOM _ (MKATOM LABEL)) by (NEXTPIECE PC) while PC
@@ -416,7 +422,8 @@
                  (RETURN PC])
 
 (MBUTTON.FIND.NEXT.BUTTON
-  [LAMBDA (TEXTOBJ CH#)                                      (* ; "Edited 21-Oct-2023 08:54 by rmk")
+  [LAMBDA (TEXTOBJ CH#)                                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 21-Oct-2023 08:54 by rmk")
                                                              (* ; "Edited  5-Sep-2022 15:39 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:19 by rmk")
                                                              (* ; "Edited  6-Aug-2022 17:36 by rmk")
@@ -424,16 +431,17 @@
 
     (* ;; "Finds the next instance of an OBJECT which looks like a menu button, 3-state button, or menuobj.  If none is found, return NIL")
 
-    (for (PC _ (\CHTOPC CH# TEXTOBJ))
+    (for (PC _ (\TEDIT.CHTOPC CH# TEXTOBJ))
          OBJ by (NEXTPIECE PC) while PC when (AND (EQ OBJECT.PTYPE (PTYPE PC))
                                                   (SETQ OBJ (PCONTENTS PC))
                                                   (OR (type? MBUTTON OBJ)
                                                       (type? MARGINBAR OBJ)
                                                       (type? NWAYBUTTON OBJ)))
-       do (RETURN (CONS OBJ (\PCTOCH PC TEXTOBJ])
+       do (RETURN (CONS OBJ (\TEDIT.PCTOCH PC TEXTOBJ])
 
 (MBUTTON.FIND.NEXT.FIELD
-  [LAMBDA (TEXTOBJ CH# DONTFIX)                              (* ; "Edited 25-Feb-2024 23:17 by rmk")
+  [LAMBDA (TEXTOBJ CH# DONTFIX)                              (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 25-Feb-2024 23:17 by rmk")
                                                              (* ; "Edited  9-May-2023 12:43 by rmk")
                                                              (* ; "Edited 20-Mar-2023 17:33 by rmk")
                                                              (* ; "Edited 11-Feb-2023 11:23 by rmk")
@@ -453,8 +461,8 @@
      (* ;; 
      "Find the start of the field.  CLSELHERE is set for the prefix {, since the field may be empty")
 
-          (for old PC inpieces (\CHTOPC CH# TEXTOBJ T) until (fetch (CHARLOOKS CLSELHERE)
-                                                                of (PLOOKS PC))
+          (for old PC inpieces (\TEDIT.CHTOPC CH# TEXTOBJ T) until (fetch (CHARLOOKS CLSELHERE)
+                                                                      of (PLOOKS PC))
              do (add START-OF-PIECE (PLEN PC)))
           (CL:UNLESS PC                                      (* ; 
                                                    "Ran off the text without finding a fill-in field")
@@ -527,7 +535,9 @@
              (MKATOM STR))])
 
 (MBUTTON.SET.FIELD
-  [LAMBDA (TEXTSTREAM FIELD VALUE)                           (* ; "Edited 21-Oct-2023 08:55 by rmk")
+  [LAMBDA (TEXTSTREAM FIELD VALUE)                           (* ; "Edited 17-Mar-2024 00:25 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited 21-Oct-2023 08:55 by rmk")
                                                              (* ; "Edited 13-Sep-2022 12:24 by rmk")
                                                              (* ; "Edited  6-Aug-2022 17:45 by rmk")
                                                              (* ; "Edited 22-Apr-93 10:56 by jds")
@@ -538,12 +548,12 @@
           OBJ SAVED.SEL FIELD.SEL PC NEW-STRING)
          (SETQ PC (MBUTTON.FIND.BUTTON FIELD TEXTSTREAM))
          (CL:WHEN (SETQ PC (MBUTTON.FIND.BUTTON FIELD TEXTSTREAM))
-             (SETQ FIELD.SEL (MBUTTON.FIND.NEXT.FIELD TEXTOBJ (\PCTOCH PC TEXTOBJ)))
+             (SETQ FIELD.SEL (MBUTTON.FIND.NEXT.FIELD TEXTOBJ (\TEDIT.PCTOCH PC TEXTOBJ)))
                                                              (* ; 
                                                             "select the field following this button.")
              (CL:WHEN FIELD.SEL                              (* ; 
                                                           "there are contents to set for this button")
-                 (\FIXSEL FIELD.SEL TEXTOBJ)
+                 (\TEDIT.FIXSEL FIELD.SEL TEXTOBJ)
                  (TEDIT.SETSEL TEXTSTREAM (fetch (SELECTION CH#) of FIELD.SEL)
                         (fetch (SELECTION DCH) of FIELD.SEL)
                         (fetch (SELECTION POINT) of FIELD.SEL)
@@ -557,7 +567,8 @@
                        (TEDIT.INSERT TEXTSTREAM (MKSTRING VALUE]))])
 
 (MBUTTON.SET.NEXT.FIELD
-  [LAMBDA (TEXTOBJ CH# NEWVALUE DONTUPDATESCREEN)            (* ; "Edited 22-May-2023 10:50 by rmk")
+  [LAMBDA (TEXTOBJ CH# NEWVALUE DONTUPDATESCREEN)            (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited 22-May-2023 10:50 by rmk")
                                                              (* ; "Edited 20-Mar-2023 12:40 by rmk")
                                                              (* ; "Edited 18-Mar-2023 23:18 by rmk")
                                                              (* ; "Edited 11-Feb-2023 09:33 by rmk")
@@ -567,7 +578,7 @@
 
     (LET (FIELDSEL)
          (CL:WHEN (SETQ FIELDSEL (MBUTTON.FIND.NEXT.FIELD TEXTOBJ CH#))
-             (\FIXSEL FIELDSEL TEXTOBJ)                      (* ; 
+             (\TEDIT.FIXSEL FIELDSEL TEXTOBJ)                (* ; 
      "Fix up the SELECTION that describes its contents, so we've got the right screen coordinates &c")
              (CL:UNLESS (ZEROP (fetch (SELECTION DCH) of FIELDSEL))
                     (\TEDIT.DELETE TEXTOBJ FIELDSEL))        (* ; "Delete existing text")
@@ -1904,7 +1915,8 @@
                                                           (SETQ OLDX X])
 
 (\TEDIT.TABTYPE.SET
-  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 21-Oct-2022 18:46 by rmk")
+  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 21-Oct-2022 18:46 by rmk")
                                                              (* ; "Edited  3-Oct-2022 22:16 by rmk")
                                                              (* ; "Edited  9-Sep-2022 15:47 by rmk")
                                                              (* ; "Edited  6-Aug-2022 17:16 by rmk")
@@ -1928,7 +1940,7 @@
          (CL:WHEN (EQ (IMAGEOBJPROP DOTTEDBUTTON 'STATE)
                       'ON)                                   (* ; "Yes.  Make this a DOTTEDxxx tab.")
              (SETQ STATE (PACK* 'DOTTED STATE)))
-         (for (PC _ (\CHTOPC (ADD1 (fetch (SELECTION CH#) of SEL))
+         (for (PC _ (\TEDIT.CHTOPC (ADD1 (fetch (SELECTION CH#) of SEL))
                            TEXTOBJ)) by (NEXTPIECE PC) while PC when (type? MARGINBAR (PCONTENTS
                                                                                        PC))
             do (replace MARTABTYPE of (IMAGEOBJPROP (PCONTENTS PC)
@@ -2241,30 +2253,29 @@
              (\TEXTMENU.SET.TOGGLE "Unformatted" 'ON CHARMENUTEXTSTREAM])
 
 (MB.DEFAULTBUTTON.FN
-  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 22-Feb-2024 23:26 by rmk")
+  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 20-Mar-2024 11:03 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:43 by rmk")
+                                                             (* ; "Edited 22-Feb-2024 23:26 by rmk")
                                                              (* ; "Edited  7-Feb-2024 23:07 by rmk")
                                                              (* ; "Edited 29-Jan-2024 17:22 by rmk")
                                                              (* ; "Edited 21-Oct-2022 18:46 by rmk")
                                                              (* ; "Edited 30-Mar-94 15:46 by jds")
                                                              (* ; 
                                                           "MBFN for TEdit default menu item buttons.")
-    (PROG* ((TEXTOBJ (\DTEST (GETSEL SEL SELTEXTOBJ)
-                            'TEXTOBJ))
-            (MAINTEXT (\DTEST (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
-                                     'TEXTOBJ)
-                             'TEXTOBJ))
-            (MAINSEL (FGETTOBJ MAINTEXT SEL))
+    (PROG* ((TEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW WTEXTOBJ) of W)))
+            [MAINTEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW WTEXTOBJ) of (WINDOWPROP W 'MAINWINDOW]
+            (MAINSEL (FGETTOBJ MAINTEXTOBJ SEL))
             PROC)
            [COND
-              ((EQ (FGETTOBJ MAINTEXT EDITOPACTIVE)
+              ((EQ (FGETTOBJ MAINTEXTOBJ EDITOPACTIVE)
                    T)
-               (TEDIT.PROMPTPRINT MAINTEXT "Edit operation in progress; please wait." T)
+               (TEDIT.PROMPTPRINT MAINTEXTOBJ "Edit operation in progress; please wait." T)
                (RETURN))
-              ((FGETTOBJ MAINTEXT EDITOPACTIVE)
-               (TEDIT.PROMPTPRINT MAINTEXT (CONCAT (FGETTOBJ MAINTEXT EDITOPACTIVE)
-                                                  " operation in progress; please wait.")
+              ((FGETTOBJ MAINTEXTOBJ EDITOPACTIVE)
+               (TEDIT.PROMPTPRINT MAINTEXTOBJ (CONCAT (FGETTOBJ MAINTEXTOBJ EDITOPACTIVE)
+                                                     " operation in progress; please wait.")
                       T)
-               (CL:UNLESS (EQ (FGETTOBJ MAINTEXT EDITOPACTIVE)
+               (CL:UNLESS (EQ (FGETTOBJ MAINTEXTOBJ EDITOPACTIVE)
                               (IMAGEOBJPROP OBJ 'MBTEXT))
                       (RETURN]
            [COND
@@ -2272,14 +2283,15 @@
                                       'PROCESS))
                     (PROCESSP PROC))                         (* ; 
                     "THE MAIN window has a live process behind it;  go evaluate the button fn there.")
-               (PROCESS.EVAL PROC (LIST 'MB.DEFAULTBUTTON.ACTIONFN OBJ SEL W TEXTOBJ MAINTEXT MAINSEL
-                                        )))
+               (PROCESS.EVAL PROC (LIST (FUNCTION MB.DEFAULTBUTTON.ACTIONFN)
+                                        OBJ SEL W TEXTOBJ MAINTEXTOBJ MAINSEL)))
               ((AND (SETQ PROC (WINDOWPROP W 'PROCESS))
                     (PROCESSP PROC))                         (* ; 
                         "This window has a live process behind it;  go evaluate the button fn there.")
-               (PROCESS.EVAL PROC (LIST 'MB.DEFAULTBUTTON.ACTIONFN OBJ SEL W TEXTOBJ MAINTEXT MAINSEL
-                                        )))
-              (T (ADD.PROCESS (LIST 'MB.DEFAULTBUTTON.ACTIONFN OBJ SEL W TEXTOBJ MAINTEXT MAINSEL]
+               (PROCESS.EVAL PROC (LIST (FUNCTION MB.DEFAULTBUTTON.ACTIONFN)
+                                        OBJ SEL W TEXTOBJ MAINTEXTOBJ MAINSEL)))
+              (T (ADD.PROCESS (LIST (FUNCTION MB.DEFAULTBUTTON.ACTIONFN)
+                                    OBJ SEL W TEXTOBJ MAINTEXTOBJ MAINSEL]
            (CL:WHEN (FGETTOBJ TEXTOBJ EDITFINISHEDFLG)
                (GIVE.TTY.PROCESS W)
                (DISMISS 20))
@@ -2301,7 +2313,9 @@
            (EQ NEWSTATE 'ON])
 
 (MB.DEFAULTBUTTON.ACTIONFN
-  [LAMBDA (OBJ SEL W TEXTOBJ MAINTEXT MAINSEL)               (* ; "Edited 27-Feb-2024 07:54 by rmk")
+  [LAMBDA (OBJ SEL W TEXTOBJ MAINTEXTOBJ MAINSEL)            (* ; "Edited 15-Mar-2024 13:53 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:33 by rmk")
+                                                             (* ; "Edited 27-Feb-2024 07:54 by rmk")
                                                              (* ; "Edited 14-Dec-2023 21:03 by rmk")
                                                              (* ; "Edited 22-Sep-2023 20:09 by rmk")
                                                              (* ; "Edited 20-Sep-2023 23:14 by rmk")
@@ -2313,15 +2327,16 @@
                                                           "MBFN for TEdit default menu item buttons.")
     (PROG (OFILE CH %#COPIES PRINTHOST PRINTOPTIONS %#SIDES MSG)
           [ERSETQ (RESETLST
-                      [RESETSAVE (\TEDIT.MARKACTIVE MAINTEXT)
+                      [RESETSAVE (\TEDIT.MARKACTIVE MAINTEXTOBJ)
                              '(AND (\TEDIT.MARKINACTIVE OLDVALUE]
                       [RESETSAVE (\TEDIT.MARKACTIVE TEXTOBJ)
                              '(AND (\TEDIT.MARKINACTIVE OLDVALUE]
                       [RESETSAVE (PROG1 OBJ
                                      (IMAGEOBJPROP OBJ 'MENUBUTTON.SELECTED T))
                              '(AND (IMAGEOBJPROP OLDVALUE 'MENUBUTTON.SELECTED NIL]
-                      (SETTOBJ MAINTEXT EDITOPACTIVE (OR (IMAGEOBJPROP OBJ 'MBTEXT)
-                                                         T)) (* ; 
+                      (SETTOBJ MAINTEXTOBJ EDITOPACTIVE (OR (IMAGEOBJPROP OBJ 'MBTEXT)
+                                                            T))
+                                                             (* ; 
                                                           "So we can tell the guy WHAT op is active.")
                       (SELECTQ (IMAGEOBJPROP OBJ 'MBTEXT)
                           (Put [SETQ OFILE (\TEDIT.MAKEFILENAME (MBUTTON.NEXT.FIELD.AS.TEXT
@@ -2330,33 +2345,34 @@
                                [COND
                                   (OFILE                     (* ; 
                                                        "Only try this if he really typed a file name")
-                                         (TEDIT.PUT MAINTEXT OFILE NIL (GETTEXTPROP TEXTOBJ
-                                                                              'UNFORMATTEDPUT/GET])
+                                         (TEDIT.PUT MAINTEXTOBJ OFILE NIL (GETTEXTPROP TEXTOBJ
+                                                                                 'UNFORMATTEDPUT/GET])
                           (Get [SETQ OFILE (\TEDIT.MAKEFILENAME (MBUTTON.NEXT.FIELD.AS.TEXT
                                                                  TEXTOBJ
                                                                  (GETSEL SEL CH#]
                                [COND
                                   (OFILE                     (* ; 
                                                        "Only try this if he really typed a file name")
-                                         (TEDIT.GET MAINTEXT OFILE (GETTEXTPROP TEXTOBJ 
-                                                                          'UNFORMATTEDPUT/GET])
+                                         (TEDIT.GET MAINTEXTOBJ OFILE (GETTEXTPROP TEXTOBJ
+                                                                             'UNFORMATTEDPUT/GET])
                           (Include [SETQ OFILE (\TEDIT.MAKEFILENAME (MBUTTON.NEXT.FIELD.AS.TEXT
                                                                      TEXTOBJ
                                                                      (GETSEL SEL CH#]
                                    (COND
-                                      (OFILE (TEDIT.INCLUDE MAINTEXT OFILE))))
+                                      (OFILE (TEDIT.INCLUDE MAINTEXTOBJ OFILE))))
                           (Find (SETQ OFILE (MBUTTON.NEXT.FIELD.AS.TEXT TEXTOBJ (GETSEL SEL CH#)))
                                 [COND
                                    ((ZEROP (NCHARS OFILE))   (* ; "NOTHING--HE HIT DEL.")
                                     NIL)
                                    (OFILE                    (* ; 
                                                              "There's something to do.  Go do it.")
-                                          (TEDIT.PROMPTPRINT MAINTEXT "Searching..." T)
-                                          [SETQ CH (CAR (ERSETQ (TEDIT.FIND MAINTEXT OFILE NIL NIL T]
+                                          (TEDIT.PROMPTPRINT MAINTEXTOBJ "Searching..." T)
+                                          [SETQ CH (CAR (ERSETQ (TEDIT.FIND MAINTEXTOBJ OFILE NIL NIL
+                                                                       T]
                                           (COND
                                              (CH             (* ; "We found the target text.")
-                                                 (TEDIT.PROMPTPRINT MAINTEXT "Done.")
-                                                 (\SHOWSEL MAINSEL NIL)
+                                                 (TEDIT.PROMPTPRINT MAINTEXTOBJ "Done.")
+                                                 (\TEDIT.SHOWSEL MAINSEL NIL)
                                                  (SETSEL MAINSEL CH# (CAR CH))
                                                              (* ; 
                                                              "Set up SELECTION to be the found text")
@@ -2364,17 +2380,19 @@
                                                  [SETSEL MAINSEL DCH (ADD1 (IDIFFERENCE (CADR CH)
                                                                                   (CAR CH]
                                                  (SETSEL MAINSEL POINT 'RIGHT)
-                                                 (FSETTOBJ MAINTEXT CARETLOOKS (
+                                                 (FSETTOBJ MAINTEXTOBJ CARETLOOKS (
                                                                           \TEDIT.GET.INSERT.CHARLOOKS
-                                                                                MAINTEXT MAINSEL))
+                                                                                   MAINTEXTOBJ 
+                                                                                   MAINSEL))
                                                              (* ; 
                                             "Set the caret looks to match those of the new selection")
-                                                 (TEDIT.RESET.EXTEND.PENDING.DELETE MAINSEL)
+                                                 (\TEDIT.RESET.EXTEND.PENDING.DELETE MAINSEL 
+                                                        MAINTEXTOBJ)
                                                              (* ; "And never pending a deletion.")
-                                                 (\FIXSEL MAINSEL MAINTEXT)
-                                                 (TEDIT.NORMALIZECARET MAINTEXT MAINSEL)
-                                                 (\SHOWSEL MAINSEL T))
-                                             (T (TEDIT.PROMPTPRINT MAINTEXT "(Not found)"])
+                                                 (\TEDIT.FIXSEL MAINSEL MAINTEXTOBJ)
+                                                 (TEDIT.NORMALIZECARET MAINTEXTOBJ MAINSEL)
+                                                 (\TEDIT.SHOWSEL MAINSEL T))
+                                             (T (TEDIT.PROMPTPRINT MAINTEXTOBJ "(Not found)"])
                           (Substitute [PROG* ((SAVECH# (GETSEL SEL CH#))
                                               (REPLACEMENT (MBUTTON.NEXT.FIELD.AS.TEXT TEXTOBJ
                                                                   (GETSEL SEL CH#)))
@@ -2409,46 +2427,49 @@
                                     "Get the replacement out of the menu to copy into the main text.")
 
                                                            (SETQ REPLACEMENT
-                                                            (\SELPIECES (fetch (TEXTOBJ SCRATCHSEL)
-                                                                           of TEXTOBJ))))
+                                                            (\TEDIT.SELPIECES (fetch (TEXTOBJ 
+                                                                                           SCRATCHSEL
+                                                                                            )
+                                                                                 of TEXTOBJ))))
                                                        (RESETLST
                                                            (RESETSAVE (CURSOR WAITINGCURSOR))
-                                                           (TEDIT.SUBSTITUTE MAINTEXT PATTERN 
+                                                           (TEDIT.SUBSTITUTE MAINTEXTOBJ PATTERN 
                                                                   REPLACEMENT CONFIRM?))])
                           (Quit                              (* ; "He wants to QUIT the edit.")
                                 (COND
-                                   ((\TEDIT.QUIT (\TEDIT.PRIMARYW MAINTEXT)
+                                   ((\TEDIT.QUIT (\TEDIT.PRIMARYW MAINTEXTOBJ)
                                            T)
                                     (replace (TEXTOBJ EDITFINISHEDFLG) of TEXTOBJ with T))))
                           (Page% Layout                      (* ; "Page layout menu")
                                         (\TEDIT.MENU.START (COPYTEXTSTREAM TEDIT.EXPANDED.PAGEMENU T)
-                                               (\TEDIT.PRIMARYW MAINTEXT)
+                                               (\TEDIT.PRIMARYW MAINTEXTOBJ)
                                                "Page Layout Menu"
                                                (HEIGHTIFWINDOW 135 5)
                                                'PAGE))
                           (Para% Looks                       (* ; "Page layout menu")
-                                       (\TEDIT.EXPANDEDPARA.MENU MAINTEXT))
+                                       (\TEDIT.EXPANDEDPARA.MENU MAINTEXTOBJ))
                           (Char% Looks                       (* ; "Page layout menu")
-                                       (\TEDIT.EXPANDEDCHARLOOKS.MENU MAINTEXT))
+                                       (\TEDIT.EXPANDEDCHARLOOKS.MENU MAINTEXTOBJ))
                           (All                               (* ; "Select the entire document.")
                                (COND
-                                  ((NOT (ZEROP (TEXTLEN MAINTEXT)))
-                                   (\SHOWSEL MAINSEL NIL)
-                                   (TEDIT.RESET.EXTEND.PENDING.DELETE MAINSEL)
+                                  ((NOT (ZEROP (TEXTLEN MAINTEXTOBJ)))
+                                   (\TEDIT.SHOWSEL MAINSEL NIL)
+                                   (\TEDIT.RESET.EXTEND.PENDING.DELETE MAINSEL MAINTEXTOBJ)
                                    (SETSEL MAINSEL CH# 1)
-                                   (SETSEL MAINSEL CHLIM (ADD1 (TEXTLEN MAINTEXT)))
-                                   (SETSEL MAINSEL DCH (TEXTLEN MAINTEXT))
+                                   (SETSEL MAINSEL CHLIM (ADD1 (TEXTLEN MAINTEXTOBJ)))
+                                   (SETSEL MAINSEL DCH (TEXTLEN MAINTEXTOBJ))
                                    (SETSEL MAINSEL POINT 'LEFT)
                                    (SETSEL MAINSEL SET T)
-                                   (\FIXSEL MAINSEL MAINTEXT)
-                                   (\SHOWSEL MAINSEL T))))
+                                   (\TEDIT.FIXSEL MAINSEL MAINTEXTOBJ)
+                                   (\TEDIT.SHOWSEL MAINSEL T))))
                           (Hardcopy [SETQ PRINTHOST (\TEDIT.MAKEFILENAME (MBUTTON.NEXT.FIELD.AS.TEXT
                                                                           TEXTOBJ
                                                                           (GETSEL SEL CH#]
                                     (COND
                                        ((NOT PRINTHOST)      (* ; 
                                      "If he didn't specify a particular host, defer to his defaults.")
-                                        (TEDIT.PROMPTPRINT MAINTEXT "Using default print server.")))
+                                        (TEDIT.PROMPTPRINT MAINTEXTOBJ "Using default print server.")
+                                        ))
                                     (SETQ %#COPIES (MBUTTON.NEXT.FIELD.AS.NUMBER
                                                     TEXTOBJ
                                                     (GETSEL (fetch (TEXTOBJ SCRATCHSEL) of TEXTOBJ)
@@ -2479,12 +2500,12 @@
                                     [COND
                                        (MSG (push PRINTOPTIONS MSG)
                                             (push PRINTOPTIONS 'MESSAGE]
-                                    (TEDIT.HARDCOPY MAINTEXT NIL NIL NIL PRINTHOST PRINTOPTIONS))
+                                    (TEDIT.HARDCOPY MAINTEXTOBJ NIL NIL NIL PRINTHOST PRINTOPTIONS))
                           (ERROR)))]
           (SETSEL SEL SET T)                                 (* ; 
                                                          "Now turn the menu button highlighting off.")
           (SETSEL SEL ONFLG T)
-          (\SHOWSEL SEL NIL)                                 (* ; 
+          (\TEDIT.SHOWSEL SEL NIL)                           (* ; 
                                                              "And forget that anything is selected.")
           (SETSEL SEL SET NIL])
 )
@@ -2539,7 +2560,9 @@
         NEWLOOKS])
 
 (\TEDIT.APPLY.CHARLOOKS
-  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 16-Feb-2024 21:21 by rmk")
+  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 27-Mar-2024 15:12 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited 16-Feb-2024 21:21 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:55 by rmk")
                                                              (* ; "Edited 21-Oct-2022 18:47 by rmk")
                                                              (* ; "Edited 30-May-91 22:17 by jds")
@@ -2547,11 +2570,11 @@
     (* ;; "MBFN for TEdit default menu item buttons.")
 
     (LET ((TEXTOBJ (GETSEL SEL SELTEXTOBJ))
-          (MAINTEXT (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
-                           'TEXTOBJ))
+          [MAINTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of (fetch (TEXTWINDOW WTEXTSTREAM)
+                                                         of (WINDOWPROP W 'MAINWINDOW]
           (CH# (ADD1 (FGETSEL SEL CH#)))
           NEWLOOKS)
-         (\SHOWSEL SEL NIL)                                  (* ; "Turn off the APPLY button.")
+         (\TEDIT.SHOWSEL SEL NIL)                            (* ; "Turn off the APPLY button.")
          [SETQ CH# (ADD1 (CDR (MBUTTON.FIND.NEXT.BUTTON TEXTOBJ CH#]
                                                              (* ; "Skip over the SHOW button")
          [SETQ CH# (ADD1 (CDR (MBUTTON.FIND.NEXT.BUTTON TEXTOBJ CH#]
@@ -2559,7 +2582,7 @@
          (SETQ NEWLOOKS (\TEDIT.PARSE.CHARLOOKS.MENU TEXTOBJ CH#))
                                                              (* ; 
                                                        "Now Parse the menu, to give us a looks spec.")
-         (TEDIT.LOOKS MAINTEXT NEWLOOKS)                     (* ; "Make the change in looks")
+         (TEDIT.LOOKS MAINTEXTOBJ NEWLOOKS)                  (* ; "Make the change in looks")
                                                              (* ; 
                                                              "Leave him typing in the real document")
          (TTY.PROCESS (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
@@ -2581,7 +2604,11 @@
         NEWLOOKS])
 
 (\TEDIT.SHOW.CHARLOOKS
-  [LAMBDA (OBJ SEL MENUSTREAM)                               (* ; "Edited 25-Feb-2024 23:27 by rmk")
+  [LAMBDA (OBJ SEL MENUSTREAM)                               (* ; "Edited 27-Mar-2024 15:11 by rmk")
+                                                             (* ; "Edited 20-Mar-2024 11:03 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited 25-Feb-2024 23:27 by rmk")
                                                              (* ; "Edited 20-Jul-2023 17:00 by rmk")
                                                              (* ; "Edited  3-May-2023 10:40 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:17 by rmk")
@@ -2593,31 +2620,31 @@
 
     (* ;; "Set the CHARLOOKS menu from the looks of the currently selected character.")
 
-    (LET* ((TEXTOBJ (\DTEST (GETSEL SEL SELTEXTOBJ)
-                           'TEXTOBJ))
-           (MAINTEXT (WINDOWPROP (WINDOWPROP MENUSTREAM 'MAINWINDOW)
-                            'TEXTOBJ))
-           (MAINCH# (GETSEL (GETTOBJ MAINTEXT SEL)
+    (LET* ((TEXTOBJ (TEXTOBJ! (GETSEL SEL SELTEXTOBJ)))
+           [MAINTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of (fetch (TEXTWINDOW WTEXTSTREAM)
+                                                          of (WINDOWPROP MENUSTREAM 'MAINWINDOW]
+           (MAINCH# (GETSEL (GETTOBJ MAINTEXTOBJ SEL)
                            CH#))
            (CH# (ADD1 (GETSEL SEL CH#)))
-           PC OFILE CH NEWLOOKS NEXTB BUTTON TEXT OFFSET)
-          (CL:WHEN (ILEQ MAINCH# (TEXTLEN MAINTEXT))
+           PC NEWLOOKS)
+          (CL:WHEN (ILEQ MAINCH# (TEXTLEN MAINTEXTOBJ))
               [SETQ CH# (ADD1 (CDR (MBUTTON.FIND.NEXT.BUTTON TEXTOBJ CH#]
                                                              (* ; "Skip over the NEUTRAL button.")
-              (\SHOWSEL SEL NIL)
+              (\TEDIT.SHOWSEL SEL NIL)
               (SETSEL SEL SET NIL)
-              (SETQ PC (\CHTOPC MAINCH# MAINTEXT))           (* ; 
+              (SETQ PC (\TEDIT.CHTOPC MAINCH# MAINTEXTOBJ))  (* ; 
                                                           "The PIECE containing the text to describe")
               (SETQ NEWLOOKS (PLOOKS PC))                    (* ; 
                                                              "Get the looks for those characters.")
                                                              (* ; 
                                                              "Fill in the menu blanks with that info")
               (TEDIT.DEFERRED-UPDATES TEXTOBJ (\TEDIT.FILL.IN.CHARLOOKS.MENU TEXTOBJ CH# NEWLOOKS))
-              (TTY.PROCESS (WINDOWPROP (\TEDIT.PRIMARYW MAINTEXT)
+              (TTY.PROCESS (WINDOWPROP (\TEDIT.PRIMARYW MAINTEXTOBJ)
                                   'PROCESS)))])
 
 (\TEDIT.NEUTRALIZE.CHARLOOKS
-  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 25-Feb-2024 23:30 by rmk")
+  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 15-Mar-2024 14:23 by rmk")
+                                                             (* ; "Edited 25-Feb-2024 23:30 by rmk")
                                                              (* ; "Edited 19-Dec-2023 13:40 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:55 by rmk")
                                                              (* ; "Edited 21-Oct-2022 18:50 by rmk")
@@ -2627,23 +2654,25 @@
 
     (LET [(TEXTOBJ (GETSEL SEL SELTEXTOBJ))
           (CH# (ADD1 (FGETSEL SEL CH#]
-         (\SHOWSEL SEL NIL)
+         (\TEDIT.SHOWSEL SEL NIL)
          (FSETSEL SEL SET NIL)
          (\TEDIT.NEUTRALIZE.CHARLOOKS.MENU TEXTOBJ CH#)      (* ; 
                           "Fill in the menu blanks with that info and update the menu's screen image")
-         (TEDIT.UPDATE.SCREEN TEXTOBJ)
+         (\TEDIT.UPDATE.SCREEN TEXTOBJ)
          (TTY.PROCESS (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
                              'PROCESS])
 
 (\TEDIT.FILL.IN.CHARLOOKS.MENU
-  [LAMBDA (TEXTOBJ CH# NEWLOOKS)                             (* ; "Edited 13-Nov-2023 09:55 by rmk")
+  [LAMBDA (TEXTOBJ CH# NEWLOOKS)                             (* ; "Edited 20-Mar-2024 11:03 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited 13-Nov-2023 09:55 by rmk")
                                                              (* ; "Edited 24-Jul-2023 21:09 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:55 by rmk")
                                                              (* ; "Edited 30-May-91 22:28 by jds")
 
     (* ;; "Given a TEXTOBJ describing a charlooks menu, the CH# of the start of the charlooks menu, and a set of looks, fill in the menu fields.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (LET (PC OFILE CH NEXTB BUTTON TEXT OFFSET (SCRATCHSEL (FGETTOBJ TEXTOBJ SCRATCHSEL)))
          (SETQ NEWLOOKS (\TEDIT.PARSE.CHARLOOKS.LIST NEWLOOKS NIL TEXTOBJ))
 
@@ -2733,7 +2762,7 @@
          (MBUTTON.SET.NEXT.FIELD TEXTOBJ (ADD1 (CDR NEXTB))
                 (AND OFFSET (IABS OFFSET)))                  (* ; 
                                                   "Now move up to the offset distance fill-in field.")
-         (\SHOWSEL SCRATCHSEL NIL)
+         (\TEDIT.SHOWSEL SCRATCHSEL NIL)
          (SETSEL SCRATCHSEL SET NIL)
          (\TEDIT.MARK.LINES.DIRTY TEXTOBJ CH# (ADD1 (GETSEL SCRATCHSEL CH#])
 
@@ -2940,7 +2969,10 @@
            'PARALOOKS])
 
 (\TEDIT.APPLY.PARALOOKS
-  [LAMBDA (OBJ SEL W)                                        (* ; "Edited  1-Mar-2024 20:33 by rmk")
+  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 20-Mar-2024 11:04 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:54 by rmk")
+                                                             (* ; "Edited  1-Mar-2024 20:33 by rmk")
                                                              (* ; "Edited 26-Feb-2024 11:41 by rmk")
                                                              (* ; "Edited 17-Dec-2023 17:04 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:55 by rmk")
@@ -2954,9 +2986,8 @@
 
     (* ;; "Handler for the Paragraph Menu's APPLY button.  Collects the specs from the paragraph menu and calls TEDIT.PARALOOKS to effect the change.")
 
-    (LET ((TEXTOBJ (GETSEL SEL SELTEXTOBJ))
-          (MAINTEXT (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
-                           'TEXTOBJ))
+    (LET ((TEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW WTEXTOBJ) of W)))
+          [MAINTEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW WTEXTOBJ) of (WINDOWPROP W 'MAINWINDOW]
           (CH# (ADD1 (FGETSEL SEL CH#)))
           SCRATCHSEL QUAD OFILE CH NEWLOOKS SIZE SUPER SUB LINELEAD PARALEAD DEFTAB BUTTON MARUNIT 
           NEXTB BUTTONDATA L1 LN R PARATYPE SPECIALX SPECIALY)
@@ -3083,16 +3114,18 @@
                                                      (FUNCTION (LAMBDA (A B)
                                                                  (ILEQ (CAR A)
                                                                        (CAR B])
-         (TEDIT.PARALOOKS MAINTEXT NEWLOOKS (GETSEL (FGETTOBJ MAINTEXT SEL)
-                                                   CH#)
-                (GETSEL (FGETTOBJ MAINTEXT SEL)
+         (TEDIT.PARALOOKS MAINTEXTOBJ NEWLOOKS (GETSEL (FGETTOBJ MAINTEXTOBJ SEL)
+                                                      CH#)
+                (GETSEL (FGETTOBJ MAINTEXTOBJ SEL)
                        DCH))
-         (\SHOWSEL SEL NIL)
+         (\TEDIT.SHOWSEL SEL NIL)
          (TTY.PROCESS (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
                              'PROCESS])
 
 (\TEDIT.SHOW.PARALOOKS
-  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 25-Feb-2024 23:33 by rmk")
+  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 27-Mar-2024 13:52 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited 25-Feb-2024 23:33 by rmk")
                                                              (* ; "Edited 20-Jul-2023 17:00 by rmk")
                                                              (* ; "Edited  6-Jun-2023 15:10 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:59 by rmk")
@@ -3109,9 +3142,9 @@
     (LET ((TEXTOBJ (GETSEL SEL SELTEXTOBJ))
           (CH# (ADD1 (GETSEL SEL CH#)))
           BUTTON NEXTB BUTTONDATA PARALOOKS MARUNIT)
-         (CL:WHEN [SETQ PARALOOKS (TEDIT.GET.PARALOOKS (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
-                                                              'TEXTOBJ]
-             (\SHOWSEL SEL NIL)
+         (CL:WHEN [SETQ PARALOOKS (TEDIT.GET.PARALOOKS (fetch (TEXTWINDOW WTEXTSTREAM)
+                                                          of (WINDOWPROP W 'MAINWINDOW]
+             (\TEDIT.SHOWSEL SEL NIL)
              (SETSEL SEL SET NIL)
              [TEDIT.DEFERRED-UPDATES
               TEXTOBJ                                        (* ; 
@@ -3305,7 +3338,9 @@
 (DEFINEQ
 
 (\TEDIT.SHOW.PAGEFORMATTING
-  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 18-Jan-2024 08:33 by rmk")
+  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 27-Mar-2024 15:15 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited 18-Jan-2024 08:33 by rmk")
                                                              (* ; "Edited 12-Nov-2023 23:40 by rmk")
                                                              (* ; "Edited  6-Nov-2023 22:33 by rmk")
                                                              (* ; "Edited 20-Jul-2023 17:00 by rmk")
@@ -3317,15 +3352,15 @@
 (* ;;; "Take a document's page formatting, and display it in the menu.")
 
     (LET* ((TEXTOBJ (GETSEL SEL SELTEXTOBJ))
-           (MAINTEXT (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
-                            'TEXTOBJ))
+           [MAINTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of (fetch (TEXTWINDOW WTEXTSTREAM)
+                                                          of (WINDOWPROP W 'MAINWINDOW]
            (CH# (ADD1 (GETSEL SEL CH#)))
            FOLIOINFO NEWLOOKS NEXTB BUTTON PAGEID OPAGEFRAMES FIRST REST PFONT HEADING HEADINGS 
            PAGEPROPS STARTINGPAGE# PAPERSIZE)
 
           (* ;; "Start by turning off the selection--and leaving it off afterward.")
 
-          (\SHOWSEL SEL NIL)
+          (\TEDIT.SHOWSEL SEL NIL)
           (SETSEL SEL SET NIL)
 
           (* ;; "What kind of page are we looking at the specs for?")
@@ -3338,7 +3373,7 @@
                                 'FIRST)
                            (Other% Left 'LEFT)
                            (Other% Right 'RIGHT)
-                           (PROGN (TEDIT.PROMPTPRINT MAINTEXT 
+                           (PROGN (TEDIT.PROMPTPRINT MAINTEXTOBJ 
                                          "First specify which kind of page you want to see." T)
                                   NIL)))
 
@@ -3349,7 +3384,7 @@
 
                      (* ;; "Now replace the button values, fill-in fields, etc.")
 
-                     (SETQ OPAGEFRAMES (OR (fetch (TEXTOBJ TXTPAGEFRAMES) of MAINTEXT)
+                     (SETQ OPAGEFRAMES (OR (fetch (TEXTOBJ TXTPAGEFRAMES) of MAINTEXTOBJ)
                                            TEDIT.PAGE.FRAMES))
 
                      (* ;; " LISTP is already just a list of first-recto-verso frames")
@@ -3370,7 +3405,7 @@
                             (T (SETQ OPAGEFRAMES NIL))))
                      (CL:UNLESS OPAGEFRAMES                  (* ; 
                           "If the formatting isn't in our simplified 3-way format, punt out of this.")
-                         (TEDIT.PROMPTPRINT MAINTEXT "Format too complex to edit." T)
+                         (TEDIT.PROMPTPRINT MAINTEXTOBJ "Format too complex to edit." T)
                          (SETQ PAGEID NIL))
                      (SELECTQ PAGEID
                          (FIRST (SETQ NEWLOOKS (CAR OPAGEFRAMES)))
@@ -3508,7 +3543,8 @@
                                                                TEDIT.CHARLOOKSMENU.SPEC])
 
 (\TEDIT.APPLY.PAGEFORMATTING
-  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 21-Dec-2023 12:31 by rmk")
+  [LAMBDA (OBJ SEL W)                                        (* ; "Edited 27-Mar-2024 15:20 by rmk")
+                                                             (* ; "Edited 21-Dec-2023 12:31 by rmk")
                                                              (* ; "Edited  8-Aug-2023 00:02 by rmk")
                                                              (* ; "Edited 21-Oct-2022 18:51 by rmk")
                                                              (* ; 
@@ -3517,8 +3553,8 @@
 (* ;;; "Change the page formatting for this document")
 
     (PROG ((TEXTOBJ (fetch (SELECTION SELTEXTOBJ) of SEL))
-           (MAINTEXT (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
-                            'TEXTOBJ))
+           [MAINTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of (fetch (TEXTWINDOW WTEXTSTREAM)
+                                                          of (WINDOWPROP W 'MAINWINDOW]
            (CH# (ADD1 (fetch (SELECTION CH#) of SEL)))
            SCRATCHSEL NEXTB BUTTON OPAGEFRAMES PAGEID PX PY LEFT BOTTOM TOP RIGHT ALIGNMENT PAGENOS 
            COLS COLWIDTH INTERCOL PFONT NPAGEFORMAT HEADINGTYPE HEADINGX HEADINGY HEADINGS 
@@ -3535,7 +3571,7 @@
                    (SETQ PAGEID 'FIRST))
               (Other% Left (SETQ PAGEID 'LEFT))
               (Other% Right (SETQ PAGEID 'RIGHT))
-              (PROGN (TEDIT.PROMPTPRINT MAINTEXT "Set KIND OF PAGE before APPLYing." T)
+              (PROGN (TEDIT.PROMPTPRINT MAINTEXTOBJ "Set KIND OF PAGE before APPLYing." T)
                      (RETURN)))                              (* ; "Find which page, for later.")
           (SETQ STARTINGPAGE# (AND (EQ PAGEID 'FIRST)
                                    (MBUTTON.NEXT.FIELD.AS.NUMBER TEXTOBJ CH#)))
@@ -3565,10 +3601,10 @@
                                      "If he wants page numbers, make sure he said WHERE to put them.")
                     (COND
                        ((AND PX PY))
-                       (T (TEDIT.PROMPTPRINT MAINTEXT 
+                       (T (TEDIT.PROMPTPRINT MAINTEXTOBJ 
                                  "Please set the X and Y location for page numbers before APPLYing."
                                  T)
-                          (TEDIT.PROMPTFLASH MAINTEXT)
+                          (TEDIT.PROMPTFLASH MAINTEXTOBJ)
                           (RETURN]
           [SETQ NEXTB (MBUTTON.FIND.NEXT.BUTTON TEXTOBJ (ADD1 (fetch (SELECTION CH#) of SCRATCHSEL]
                                                              (* ; 
@@ -3606,8 +3642,8 @@
                                                                       of SCRATCHSEL]
           (CL:UNLESS [SETQ COLS (MBUTTON.NEXT.FIELD.AS.NUMBER TEXTOBJ (ADD1 (fetch (SELECTION CH#)
                                                                                of SCRATCHSEL]
-              (TEDIT.PROMPTPRINT MAINTEXT "Please specify how many columns there should be." T)
-              (TEDIT.PROMPTFLASH MAINTEXT))
+              (TEDIT.PROMPTPRINT MAINTEXTOBJ "Please specify how many columns there should be." T)
+              (TEDIT.PROMPTFLASH MAINTEXTOBJ))
           [SETQ COLWIDTH (MBUTTON.NEXT.FIELD.AS.NUMBER TEXTOBJ (ADD1 (fetch (SELECTION CH#)
                                                                         of SCRATCHSEL]
           [SETQ INTERCOL (MBUTTON.NEXT.FIELD.AS.NUMBER TEXTOBJ (ADD1 (fetch (SELECTION CH#)
@@ -3625,11 +3661,12 @@
                                                      TEXTOBJ
                                                      (ADD1 (fetch (SELECTION CH#) of SCRATCHSEL])
                             collect (CL:UNLESS (AND HEADINGX HEADINGY)
-                                        (TEDIT.PROMPTPRINT MAINTEXT (CONCAT "You need to say WHERE "
-                                                                           HEADINGTYPE 
-                                                                           " headings go.")
+                                        (TEDIT.PROMPTPRINT MAINTEXTOBJ (CONCAT 
+                                                                             "You need to say WHERE "
+                                                                              HEADINGTYPE 
+                                                                              " headings go.")
                                                T)
-                                        (TEDIT.PROMPTFLASH MAINTEXT)
+                                        (TEDIT.PROMPTFLASH MAINTEXTOBJ)
                                         (SETQ HEADINGINVALID T))
                                   (LIST HEADINGTYPE HEADINGX HEADINGY)))
           (CL:WHEN HEADINGINVALID                            (* ; "Headings invalid.")
@@ -3650,7 +3687,7 @@
                                                                               ALIGNMENT)
                                    LEFT RIGHT TOP BOTTOM COLS COLWIDTH INTERCOL HEADINGS 'PICAS 
                                    PAGEOPTIONS PAPERSIZE))
-          (SETQ OPAGEFRAMES (fetch (TEXTOBJ TXTPAGEFRAMES) of MAINTEXT))
+          (SETQ OPAGEFRAMES (fetch (TEXTOBJ TXTPAGEFRAMES) of MAINTEXTOBJ))
           (CL:UNLESS (LISTP OPAGEFRAMES)
               [COND
                  ((EQ PAGEID 'FIRST)                         (* ; 
@@ -3674,7 +3711,7 @@
               (RIGHT (RPLACA (CDDR OPAGEFRAMES)
                             NPAGEFORMAT))
               NIL)
-          (TEDIT.PAGEFORMAT MAINTEXT OPAGEFRAMES)
+          (TEDIT.PAGEFORMAT MAINTEXTOBJ OPAGEFRAMES)
           (TTY.PROCESS (WINDOWPROP (WINDOWPROP W 'MAINWINDOW)
                               'PROCESS])
 
@@ -4276,41 +4313,41 @@ Tab Type:  "
 (ADDTOVAR LAMA )
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (10426 33961 (MB.BUTTONEVENTINFN 10436 . 11658) (MB.DISPLAY 11660 . 13617) (MB.SETIMAGE 
-13619 . 14573) (MB.SELFN 14575 . 16197) (MB.SIZEFN 16199 . 17177) (MB.WHENOPERATEDFN 17179 . 17507) (
-MB.COPYFN 17509 . 17967) (MB.GETFN 17969 . 18707) (MB.PUTFN 18709 . 19586) (MB.SHOWSELFN 19588 . 20514
-) (MBUTTON.CREATE 20516 . 21748) (MBUTTON.CHANGENAME 21750 . 22129) (MBUTTON.FIND.BUTTON 22131 . 23039
-) (MBUTTON.FIND.NEXT.BUTTON 23041 . 24263) (MBUTTON.FIND.NEXT.FIELD 24265 . 26678) (MBUTTON.INIT 26680
- . 27596) (MBUTTON.NEXT.FIELD.AS.NUMBER 27598 . 28530) (MBUTTON.NEXT.FIELD.AS.TEXT 28532 . 28958) (
-MBUTTON.NEXT.FIELD.AS.ATOM 28960 . 29761) (MBUTTON.SET.FIELD 29763 . 31739) (MBUTTON.SET.NEXT.FIELD 
-31741 . 33023) (MBUTTON.SET.NEXT.BUTTON.STATE 33025 . 33505) (TEDITMENU.STREAM 33507 . 33959)) (34265 
-44801 (MB.CREATE.THREESTATEBUTTON 34275 . 35442) (MB.THREESTATE.DISPLAY 35444 . 38150) (
-MB.THREESTATE.SHOWSELFN 38152 . 41075) (MB.THREESTATE.WHENOPERATEDFN 41077 . 42418) (
-MB.THREESTATEBUTTON.FN 42420 . 43739) (THREESTATE.INIT 43741 . 44799)) (44902 64684 (
-MB.CREATE.NWAYBUTTON 44912 . 48981) (MB.NB.DISPLAYFN 48983 . 51251) (MB.NB.WHENOPERATEDFN 51253 . 
-52401) (MB.NB.SIZEFN 52403 . 56031) (MB.NWAYBUTTON.SELFN 56033 . 58141) (MB.NWAYMENU.NEWBUTTON 58143
- . 58730) (NWAYBUTTON.INIT 58732 . 59581) (MB.NB.PACKITEMS 59583 . 61562) (MB.NWAYBUTTON.ADDITEM 61564
- . 64682)) (64938 73856 (\TEXTMENU.TOGGLE.CREATE 64948 . 66438) (\TEXTMENU.TOGGLE.DISPLAY 66440 . 
-68873) (\TEXTMENU.TOGGLE.SHOWSELFN 68875 . 69475) (\TEXTMENU.TOGGLE.WHENOPERATEDFN 69477 . 70827) (
-\TEXTMENU.TOGGLEFN 70829 . 72028) (\TEXTMENU.TOGGLE.INIT 72030 . 72861) (\TEXTMENU.SET.TOGGLE 72863 . 
-73854)) (74108 110302 (DRAWMARGINSCALE 74118 . 77577) (MARGINBAR 77579 . 84440) (MARGINBAR.CREATE 
-84442 . 87314) (MB.MARGINBAR.SELFN 87316 . 99332) (MB.MARGINBAR.SIZEFN 99334 . 99692) (
-MB.MARGINBAR.DISPLAYFN 99694 . 102496) (MDESCALE 102498 . 103038) (MSCALE 103040 . 103370) (
-MB.MARGINBAR.SHOWTAB 103372 . 105695) (MB.MARGINBAR.TABTRACK 105697 . 107082) (\TEDIT.TABTYPE.SET 
-107084 . 109415) (MARGINBAR.INIT 109417 . 110300)) (111319 126430 (\TEDIT.MENU.START 111329 . 116449) 
-(\TEDIT.MENU.BUTTONEVENTFN 116451 . 116935) (\TEXTMENU.DOC.CREATE 116937 . 126428)) (126740 146446 (
-\TEDITMENU.CREATE 126750 . 127046) (\TEDIT.EXPANDED.MENU 127048 . 128129) (MB.DEFAULTBUTTON.FN 128131
- . 131352) (\TEDITMENU.RECORD.UNFORMATTED 131354 . 131687) (MB.DEFAULTBUTTON.ACTIONFN 131689 . 146444)
-) (146447 174728 (\TEDIT.CHARLOOKSMENU.CREATE 146457 . 148671) (\TEDIT.EXPANDEDCHARLOOKS.MENU 148673
- . 149383) (\TEDIT.APPLY.BOLDNESS 149385 . 149666) (\TEDIT.APPLY.CHARLOOKS 149668 . 151464) (
-\TEDIT.APPLY.OLINE 151466 . 151743) (\TEDIT.APPLY.UNBREAKABLE 151745 . 152143) (\TEDIT.SHOW.CHARLOOKS 
-152145 . 154454) (\TEDIT.NEUTRALIZE.CHARLOOKS 154456 . 155604) (\TEDIT.FILL.IN.CHARLOOKS.MENU 155606
- . 163010) (\TEDIT.NEUTRALIZE.CHARLOOKS.MENU 163012 . 165585) (\TEDIT.PARSE.CHARLOOKS.MENU 165587 . 
-173879) (\TEDIT.APPLY.SLOPE 173881 . 174160) (\TEDIT.APPLY.STRIKEOUT 174162 . 174445) (
-\TEDIT.APPLY.ULINE 174447 . 174726)) (174729 200589 (\TEDITPARAMENU.CREATE 174739 . 175115) (
-\TEDIT.EXPANDEDPARA.MENU 175117 . 175679) (\TEDIT.APPLY.PARALOOKS 175681 . 186019) (
-\TEDIT.SHOW.PARALOOKS 186021 . 193628) (\TEDIT.NEUTRALIZE.PARALOOKS.MENU 193630 . 199276) (
-\TEDIT.RECORD.TABLEADERS 199278 . 200587)) (200590 235299 (\TEDIT.SHOW.PAGEFORMATTING 200600 . 213890)
- (\TEDITPAGEMENU.CREATE 213892 . 214931) (\TEDIT.APPLY.PAGEFORMATTING 214933 . 226704) (
-TEDIT.UNPARSE.PAGEFORMAT 226706 . 235297)) (235604 263398 (\TEDIT.MENU.INIT 235614 . 263396)))))
+  (FILEMAP (NIL (10613 35178 (MB.BUTTONEVENTINFN 10623 . 11845) (MB.DISPLAY 11847 . 13804) (MB.SETIMAGE 
+13806 . 14760) (MB.SELFN 14762 . 16505) (MB.SIZEFN 16507 . 17485) (MB.WHENOPERATEDFN 17487 . 17921) (
+MB.COPYFN 17923 . 18381) (MB.GETFN 18383 . 19121) (MB.PUTFN 19123 . 20000) (MB.SHOWSELFN 20002 . 21035
+) (MBUTTON.CREATE 21037 . 22269) (MBUTTON.CHANGENAME 22271 . 22650) (MBUTTON.FIND.BUTTON 22652 . 23675
+) (MBUTTON.FIND.NEXT.BUTTON 23677 . 25020) (MBUTTON.FIND.NEXT.FIELD 25022 . 27556) (MBUTTON.INIT 27558
+ . 28474) (MBUTTON.NEXT.FIELD.AS.NUMBER 28476 . 29408) (MBUTTON.NEXT.FIELD.AS.TEXT 29410 . 29836) (
+MBUTTON.NEXT.FIELD.AS.ATOM 29838 . 30639) (MBUTTON.SET.FIELD 30641 . 32847) (MBUTTON.SET.NEXT.FIELD 
+32849 . 34240) (MBUTTON.SET.NEXT.BUTTON.STATE 34242 . 34722) (TEDITMENU.STREAM 34724 . 35176)) (35482 
+46018 (MB.CREATE.THREESTATEBUTTON 35492 . 36659) (MB.THREESTATE.DISPLAY 36661 . 39367) (
+MB.THREESTATE.SHOWSELFN 39369 . 42292) (MB.THREESTATE.WHENOPERATEDFN 42294 . 43635) (
+MB.THREESTATEBUTTON.FN 43637 . 44956) (THREESTATE.INIT 44958 . 46016)) (46119 65901 (
+MB.CREATE.NWAYBUTTON 46129 . 50198) (MB.NB.DISPLAYFN 50200 . 52468) (MB.NB.WHENOPERATEDFN 52470 . 
+53618) (MB.NB.SIZEFN 53620 . 57248) (MB.NWAYBUTTON.SELFN 57250 . 59358) (MB.NWAYMENU.NEWBUTTON 59360
+ . 59947) (NWAYBUTTON.INIT 59949 . 60798) (MB.NB.PACKITEMS 60800 . 62779) (MB.NWAYBUTTON.ADDITEM 62781
+ . 65899)) (66155 75073 (\TEXTMENU.TOGGLE.CREATE 66165 . 67655) (\TEXTMENU.TOGGLE.DISPLAY 67657 . 
+70090) (\TEXTMENU.TOGGLE.SHOWSELFN 70092 . 70692) (\TEXTMENU.TOGGLE.WHENOPERATEDFN 70694 . 72044) (
+\TEXTMENU.TOGGLEFN 72046 . 73245) (\TEXTMENU.TOGGLE.INIT 73247 . 74078) (\TEXTMENU.SET.TOGGLE 74080 . 
+75071)) (75325 111634 (DRAWMARGINSCALE 75335 . 78794) (MARGINBAR 78796 . 85657) (MARGINBAR.CREATE 
+85659 . 88531) (MB.MARGINBAR.SELFN 88533 . 100549) (MB.MARGINBAR.SIZEFN 100551 . 100909) (
+MB.MARGINBAR.DISPLAYFN 100911 . 103713) (MDESCALE 103715 . 104255) (MSCALE 104257 . 104587) (
+MB.MARGINBAR.SHOWTAB 104589 . 106912) (MB.MARGINBAR.TABTRACK 106914 . 108299) (\TEDIT.TABTYPE.SET 
+108301 . 110747) (MARGINBAR.INIT 110749 . 111632)) (112651 127762 (\TEDIT.MENU.START 112661 . 117781) 
+(\TEDIT.MENU.BUTTONEVENTFN 117783 . 118267) (\TEXTMENU.DOC.CREATE 118269 . 127760)) (128072 148897 (
+\TEDITMENU.CREATE 128082 . 128378) (\TEDIT.EXPANDED.MENU 128380 . 129461) (MB.DEFAULTBUTTON.FN 129463
+ . 132929) (\TEDITMENU.RECORD.UNFORMATTED 132931 . 133264) (MB.DEFAULTBUTTON.ACTIONFN 133266 . 148895)
+) (148898 178297 (\TEDIT.CHARLOOKSMENU.CREATE 148908 . 151122) (\TEDIT.EXPANDEDCHARLOOKS.MENU 151124
+ . 151834) (\TEDIT.APPLY.BOLDNESS 151836 . 152117) (\TEDIT.APPLY.CHARLOOKS 152119 . 154225) (
+\TEDIT.APPLY.OLINE 154227 . 154504) (\TEDIT.APPLY.UNBREAKABLE 154506 . 154904) (\TEDIT.SHOW.CHARLOOKS 
+154906 . 157690) (\TEDIT.NEUTRALIZE.CHARLOOKS 157692 . 158956) (\TEDIT.FILL.IN.CHARLOOKS.MENU 158958
+ . 166579) (\TEDIT.NEUTRALIZE.CHARLOOKS.MENU 166581 . 169154) (\TEDIT.PARSE.CHARLOOKS.MENU 169156 . 
+177448) (\TEDIT.APPLY.SLOPE 177450 . 177729) (\TEDIT.APPLY.STRIKEOUT 177731 . 178014) (
+\TEDIT.APPLY.ULINE 178016 . 178295)) (178298 204777 (\TEDITPARAMENU.CREATE 178308 . 178684) (
+\TEDIT.EXPANDEDPARA.MENU 178686 . 179248) (\TEDIT.APPLY.PARALOOKS 179250 . 189966) (
+\TEDIT.SHOW.PARALOOKS 189968 . 197816) (\TEDIT.NEUTRALIZE.PARALOOKS.MENU 197818 . 203464) (
+\TEDIT.RECORD.TABLEADERS 203466 . 204775)) (204778 240124 (\TEDIT.SHOW.PAGEFORMATTING 204788 . 218403)
+ (\TEDITPAGEMENU.CREATE 218405 . 219444) (\TEDIT.APPLY.PAGEFORMATTING 219446 . 231529) (
+TEDIT.UNPARSE.PAGEFORMAT 231531 . 240122)) (240429 268223 (\TEDIT.MENU.INIT 240439 . 268221)))))
 STOP
diff --git a/library/tedit/TEDIT-MENU.LCOM b/library/tedit/TEDIT-MENU.LCOM
index ce2ae15a..15708748 100644
Binary files a/library/tedit/TEDIT-MENU.LCOM and b/library/tedit/TEDIT-MENU.LCOM differ
diff --git a/library/tedit/TEDIT-OLDFILE b/library/tedit/TEDIT-OLDFILE
index 082050fe..63ec547d 100644
--- a/library/tedit/TEDIT-OLDFILE
+++ b/library/tedit/TEDIT-OLDFILE
@@ -1,13 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "21-Jan-2024 10:27:59" {WMEDLEY}<library>TEDIT>TEDIT-OLDFILE.;6 72571  
+(FILECREATED "20-Mar-2024 11:06:42" {WMEDLEY}<library>tedit>TEDIT-OLDFILE.;11 73247  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS TEDIT.GET.PCTB0 \TEDIT.GET.PCTB2 \TEDIT.GET.CHARLOOKS2 \TEDIT.GET.PCTB1 
-                       \TEDIT.GET.CHARLOOKS1 TEDIT.GET.CHARLOOKS0)
+      :CHANGES-TO (FNS \TEDIT.GET.PCTB2 \TEDIT.GET.PCTB1)
 
-      :PREVIOUS-DATE "16-Jan-2024 23:03:47" {WMEDLEY}<library>TEDIT>TEDIT-OLDFILE.;4)
+      :PREVIOUS-DATE "17-Mar-2024 18:15:40" {WMEDLEY}<library>tedit>TEDIT-OLDFILE.;10)
 
 
 (PRETTYCOMPRINT TEDIT-OLDFILECOMS)
@@ -33,7 +32,7 @@
         (COMS 
               (* ;; "VERSION 0 Compatibility reading functions")
 
-              (FNS TEDIT.GET.PCTB0 TEDIT.GET.CHARLOOKS0 TEDIT.GET.OBJECT0 TEDIT.GET.PARALOOKS0))))
+              (FNS \TEDIT.GET.PCTB0 \TEDIT.GET.CHARLOOKS0 \TEDIT.GET.OBJECT0 \TEDIT.GET.PARALOOKS0))))
 
 
 
@@ -47,7 +46,10 @@
 (DEFINEQ
 
 (\TEDIT.GET.PCTB2
-  [LAMBDA (TEXT TEXTOBJ PCCOUNT START END)                   (* ; "Edited 21-Jan-2024 10:21 by rmk")
+  [LAMBDA (TEXT TEXTOBJ PCCOUNT START END)                   (* ; "Edited 20-Mar-2024 11:00 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:41 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:37 by rmk")
+                                                             (* ; "Edited 21-Jan-2024 10:21 by rmk")
                                                              (* ; "Edited 13-Jan-2024 12:09 by rmk")
                                                              (* ; "Edited 19-Dec-2023 10:13 by rmk")
                                                              (* ; "Edited 25-Nov-2023 23:18 by rmk")
@@ -63,7 +65,7 @@
 
     (* ;; "END = use this as eofptr of file.  For use in reading files within files.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (LET (PIECEINFOCH# (CURFILECH# (OR START 0))
                 LOOKSHASH PARAHASH)
          (SETFILEPTR TEXT (IDIFFERENCE (OR END (GETEOFPTR TEXT))
@@ -165,7 +167,7 @@
                                 PPARALOOKS _ OLDPARALOOKS
                                 PTYPE _ OBJECT.PTYPE
                                 PBYTESPERCHAR _ PCLEN))
-                        (TEDIT.GET.OBJECT (FGETTOBJ TEXTOBJ STREAMHINT)
+                        (\TEDIT.GET.OBJECT (FGETTOBJ TEXTOBJ STREAMHINT)
                                PC TEXT CURFILECH# PCLEN)
                         (add CURFILECH# PCLEN)
                         (FSETPC PC PLOOKS (if (ZEROP (BIN TEXT))
@@ -183,7 +185,7 @@
                    (SHOULDNT "Impossible piece-type code in BUILD.PCTB"))
                (CL:WHEN PC                                   (* ; 
                                                        "If we created a piece, save it in the table.")
-                   (\INSERTPIECE PC NIL TEXTOBJ)
+                   (\TEDIT.INSERTPIECE PC NIL TEXTOBJ)
                    (SETQ OLDPC PC)) finally (\TEDIT.UNIQUIFY.ALL TEXTOBJ])
 
 (\TEDIT.GET.PARALOOKS2
@@ -598,7 +600,9 @@
 (DEFINEQ
 
 (\TEDIT.GET.PCTB1
-  [LAMBDA (TEXT TEXTOBJ PCCOUNT START END)                   (* ; "Edited 21-Jan-2024 10:23 by rmk")
+  [LAMBDA (TEXT TEXTOBJ PCCOUNT START END)                   (* ; "Edited 20-Mar-2024 11:00 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:41 by rmk")
+                                                             (* ; "Edited 21-Jan-2024 10:23 by rmk")
                                                              (* ; "Edited 19-Dec-2023 10:13 by rmk")
                                                              (* ; "Edited  8-Nov-2023 13:48 by rmk")
                                                              (* ; "Edited  7-Nov-2023 13:17 by rmk")
@@ -615,7 +619,7 @@
 
     (* ;; "END = use this as eofptr of file.  For use in reading files within files.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (LET (PIECEINFOCH# TSTREAM (CURFILECH# (OR START 0)))
          (SETFILEPTR TEXT (IDIFFERENCE (OR END (GETEOFPTR TEXT))
                                  8))
@@ -687,7 +691,7 @@
                                                     DEFAULTCHARLOOKS])
                    (SHOULDNT "Impossible piece-type code"))
                (CL:WHEN PC
-                   (\INSERTPIECE PC NIL TEXTOBJ)
+                   (\TEDIT.INSERTPIECE PC NIL TEXTOBJ)
                    (SETQ OLDPC PC)) finally (\TEDIT.UNIQUIFY.ALL TEXTOBJ])
 
 (\TEDIT.GET.PAGEFRAMES1
@@ -898,8 +902,10 @@
 
 (DEFINEQ
 
-(TEDIT.GET.PCTB0
-  [LAMBDA (TEXT TEXTOBJ PCCOUNT START END)                   (* ; "Edited 21-Jan-2024 10:27 by rmk")
+(\TEDIT.GET.PCTB0
+  [LAMBDA (TEXT TEXTOBJ PCCOUNT START END)                   (* ; "Edited 17-Mar-2024 12:41 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:47 by rmk")
+                                                             (* ; "Edited 21-Jan-2024 10:27 by rmk")
                                                              (* ; "Edited 19-Dec-2023 10:13 by rmk")
                                                              (* ; "Edited 27-Oct-2023 13:47 by rmk")
                                                              (* ; "Edited  3-Aug-2023 22:09 by rmk")
@@ -934,29 +940,29 @@
                (SETQ TYPECODE (\WIN TEXT))
                (SELECTC TYPECODE
                    (\PieceDescriptorLOOKS 
-                        (TEDIT.GET.CHARLOOKS0 PC TEXT)
+                        (\TEDIT.GET.CHARLOOKS0 PC TEXT)
                         (add CURFILECH# (PLEN PC)))
                    (\PieceDescriptorOBJECT 
-                        (TEDIT.GET.OBJECT0 (AND TEXTOBJ (FGETTOBJ TEXTOBJ STREAMHINT))
+                        (\TEDIT.GET.OBJECT0 (AND TEXTOBJ (FGETTOBJ TEXTOBJ STREAMHINT))
                                PC TEXT CURFILECH#)
                         (add CURFILECH# (PLEN PC))           (* ; 
                                             "Only object--can't be followed by either of the others.")
                         (FSETPC PC PLEN 1))
                    (\PieceDescriptorPARA 
                         (AND OLDPC (FSETPC OLDPC PPARALAST T))
-                        (TEDIT.GET.PARALOOKS0 PC TEXT)
+                        (\TEDIT.GET.PARALOOKS0 PC TEXT)
                         (FSETPC PC PLEN (\DWIN TEXT))        (* ; 
                                                   "Set this piece's length from the character looks.")
                         (\WIN TEXT)                          (* ; 
                                                 "Skip the piece-type code, since we know what's next")
-                        (TEDIT.GET.CHARLOOKS0 PC TEXT)       (* ; "This document is 'formatted' .")
+                        (\TEDIT.GET.CHARLOOKS0 PC TEXT)      (* ; "This document is 'formatted' .")
                         (add CURFILECH# (PLEN PC))
                         (AND TEXTOBJ (FSETTOBJ TEXTOBJ FORMATTEDP T)))
                    (SHOULDNT "Impossible piece-type code in BUILD.PCTB"))
                (SETQ OLDPC PC)
-               (\INSERTPIECE PC NIL TEXTOBJ) finally (\TEDIT.UNIQUIFY.ALL TEXTOBJ])
+               (\TEDIT.INSERTPIECE PC NIL TEXTOBJ) finally (\TEDIT.UNIQUIFY.ALL TEXTOBJ])
 
-(TEDIT.GET.CHARLOOKS0
+(\TEDIT.GET.CHARLOOKS0
   [LAMBDA (PC FILE)                                          (* ; "Edited 16-Jan-2024 23:03 by rmk")
                                                              (* ; "Edited 19-Dec-2023 10:13 by rmk")
                                                              (* ; "Edited  1-Aug-2022 12:04 by rmk")
@@ -1020,7 +1026,7 @@
                                                                        of LOOKS)
                                                                     'ITALIC])
 
-(TEDIT.GET.OBJECT0
+(\TEDIT.GET.OBJECT0
   [LAMBDA (STREAM PIECE FILE CURCH#)                         (* ; "Edited  6-Aug-2022 15:57 by rmk")
                                                             (* ; "Edited 12-Jun-90 18:17 by mitani")
 
@@ -1050,7 +1056,7 @@
                                                                 TEXTOBJ]
          OBJ])
 
-(TEDIT.GET.PARALOOKS0
+(\TEDIT.GET.PARALOOKS0
   [LAMBDA (PC FILE)                                          (* ; "Edited 16-Jan-2024 22:57 by rmk")
                                                              (* ; "Edited 19-Dec-2023 10:13 by rmk")
                                                              (* ; "Edited  3-Mar-2023 23:14 by rmk")
@@ -1102,14 +1108,14 @@
               (RPLACD TABSPEC TABS])
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (1765 38438 (\TEDIT.GET.PCTB2 1775 . 11514) (\TEDIT.GET.PARALOOKS2 11516 . 12105) (
-\TEDIT.GET.CHARLOOKS2 12107 . 13438) (\TEDIT.PARSE.PAGEFRAMES2 13440 . 16179) (
-\TEDIT.GET.CHARLOOKS.LIST2 16181 . 16688) (\TEDIT.GET.SINGLE.CHARLOOKS2 16690 . 20407) (
-\TEDIT.PUT.SINGLE.PARALOOKS2 20409 . 25160) (\TEDIT.PUT.SINGLE.CHARLOOKS2 25162 . 29636) (
-\TEDIT.GET.PARALOOKS.LIST2 29638 . 30145) (\TEDIT.GET.SINGLE.PARALOOKS2 30147 . 35156) (
-\TEDIT.PUT.CHARLOOKS.LIST2 35158 . 37237) (\TEDIT.PUT.PARALOOKS.LIST2 37239 . 38436)) (38515 58558 (
-\TEDIT.GET.PCTB1 38525 . 44772) (\TEDIT.GET.PAGEFRAMES1 44774 . 45226) (\TEDIT.PARSE.PAGEFRAMES1 45228
- . 47604) (\TEDIT.GET.CHARLOOKS1 47606 . 51978) (\TEDIT.GET.PARALOOKS1 51980 . 57012) (
-TEDIT.GET.OBJECT1 57014 . 58556)) (58618 72548 (TEDIT.GET.PCTB0 58628 . 62135) (TEDIT.GET.CHARLOOKS0 
-62137 . 66723) (TEDIT.GET.OBJECT0 66725 . 68674) (TEDIT.GET.PARALOOKS0 68676 . 72546)))))
+  (FILEMAP (NIL (1666 38666 (\TEDIT.GET.PCTB2 1676 . 11742) (\TEDIT.GET.PARALOOKS2 11744 . 12333) (
+\TEDIT.GET.CHARLOOKS2 12335 . 13666) (\TEDIT.PARSE.PAGEFRAMES2 13668 . 16407) (
+\TEDIT.GET.CHARLOOKS.LIST2 16409 . 16916) (\TEDIT.GET.SINGLE.CHARLOOKS2 16918 . 20635) (
+\TEDIT.PUT.SINGLE.PARALOOKS2 20637 . 25388) (\TEDIT.PUT.SINGLE.CHARLOOKS2 25390 . 29864) (
+\TEDIT.GET.PARALOOKS.LIST2 29866 . 30373) (\TEDIT.GET.SINGLE.PARALOOKS2 30375 . 35384) (
+\TEDIT.PUT.CHARLOOKS.LIST2 35386 . 37465) (\TEDIT.PUT.PARALOOKS.LIST2 37467 . 38664)) (38743 59003 (
+\TEDIT.GET.PCTB1 38753 . 45217) (\TEDIT.GET.PAGEFRAMES1 45219 . 45671) (\TEDIT.PARSE.PAGEFRAMES1 45673
+ . 48049) (\TEDIT.GET.CHARLOOKS1 48051 . 52423) (\TEDIT.GET.PARALOOKS1 52425 . 57457) (
+TEDIT.GET.OBJECT1 57459 . 59001)) (59063 73224 (\TEDIT.GET.PCTB0 59073 . 62808) (\TEDIT.GET.CHARLOOKS0
+ 62810 . 67397) (\TEDIT.GET.OBJECT0 67399 . 69349) (\TEDIT.GET.PARALOOKS0 69351 . 73222)))))
 STOP
diff --git a/library/tedit/TEDIT-OLDFILE.LCOM b/library/tedit/TEDIT-OLDFILE.LCOM
index 07e82948..aad6b313 100644
Binary files a/library/tedit/TEDIT-OLDFILE.LCOM and b/library/tedit/TEDIT-OLDFILE.LCOM differ
diff --git a/library/tedit/TEDIT-PAGE b/library/tedit/TEDIT-PAGE
index e99f067d..ecd308db 100644
--- a/library/tedit/TEDIT-PAGE
+++ b/library/tedit/TEDIT-PAGE
@@ -1,14 +1,15 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "13-Mar-2024 17:12:34" {WMEDLEY}<library>TEDIT>TEDIT-PAGE.;163 112427 
+(FILECREATED "17-Mar-2024 18:15:40" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-PAGE.;173 113461 
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS TEDIT.FORMATBOX \TEDIT.FORMAT.FOOTNOTE)
-                  (RECORDS PAGEFORMATTINGSTATE PAGEREGION)
-                  (MACROS GETPFS SETPFS)
+      :CHANGES-TO (FNS TEDIT.FORMAT.HARDCOPY TEDIT.SKIP.SPECIALCOND \TEDIT.FORMATBOX 
+                       \TEDIT.FORMATHEADING \TEDIT.FORMATFOLIO)
 
-      :PREVIOUS-DATE "13-Mar-2024 10:28:14" {WMEDLEY}<library>tedit>TEDIT-PAGE.;157)
+      :PREVIOUS-DATE "17-Mar-2024 00:27:48" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-PAGE.;172)
 
 
 (PRETTYCOMPRINT TEDIT-PAGECOMS)
@@ -50,12 +51,12 @@
               (* ;; "Public functions for setting up page layouts")
 
               (FNS TEDIT.SINGLE.PAGEFORMAT TEDIT.COMPOUND.PAGEFORMAT TEDIT.PAGEFORMAT))
+        (FNS TEDIT.FORMAT.HARDCOPY TEDIT.SKIP.SPECIALCOND)
         (COMS 
               (* ;; "Perform page layout, based on a regular expression of typed regions.")
 
-              (FNS TEDIT.FORMAT.HARDCOPY TEDIT.FORMATBOX TEDIT.FORMATHEADING TEDIT.FORMATPAGE 
-                   TEDIT.FORMATTEXTBOX TEDIT.FORMATFOLIO \TEDIT.FORMAT.FOUNDBOX? 
-                   TEDIT.SKIP.SPECIALCOND)
+              (FNS \TEDIT.FORMATBOX \TEDIT.FORMATHEADING \TEDIT.FORMATPAGE \TEDIT.FORMATTEXTBOX 
+                   \TEDIT.FORMATFOLIO \TEDIT.FORMAT.FOUNDBOX?)
               
               (* ;; "Aux function to capture page headings during line formatting:")
 
@@ -552,16 +553,12 @@
           (SETTOBJ TEXTOBJ \DIRTY T)
           STREAM])
 )
-
-
-
-(* ;; "Perform page layout, based on a regular expression of typed regions.")
-
 (DEFINEQ
 
 (TEDIT.FORMAT.HARDCOPY
   [LAMBDA (TEXTSTREAM FILE DONTSEND BREAKPAGETITLE SERVER PRINTOPTIONS IMAGETYPE FIRSTPG# STARTPG 
-                 ENDPG)                                      (* ; "Edited  7-Mar-2024 12:34 by rmk")
+                 ENDPG)                                      (* ; "Edited 16-Mar-2024 09:31 by rmk")
+                                                             (* ; "Edited  7-Mar-2024 12:34 by rmk")
                                                              (* ; "Edited 19-Jan-2024 23:39 by rmk")
                                                              (* ; "Edited 24-Dec-2023 14:10 by rmk")
                                                              (* ; "Edited 15-Nov-2023 23:56 by rmk")
@@ -662,7 +659,7 @@
                      do 
                         (* ;; "Format pages according to the existing layout:")
 
-                        (for PAGEREGION inside PAGEFRAMES do (TEDIT.FORMATBOX TEXTOBJ PRSTREAM
+                        (for PAGEREGION inside PAGEFRAMES do (\TEDIT.FORMATBOX TEXTOBJ PRSTREAM
                                                                     (GETPFS FORMATTINGSTATE CHNO)
                                                                     PAGEREGION FORMATTINGSTATE 
                                                                     IMAGETYPE))
@@ -705,7 +702,43 @@
                      T)
               (RETURN NPAGES)))])
 
-(TEDIT.FORMATBOX
+(TEDIT.SKIP.SPECIALCOND
+  [LAMBDA (TSTREAM LINE PARALOOKS CHNO)                      (* ; "Edited  5-Jul-2023 14:19 by rmk")
+                                                             (* ; "Edited 15-May-2023 22:36 by rmk")
+                                                             (* ; "Edited 16-Feb-2023 00:08 by rmk")
+                                                             (* ; 
+                                                        "Edited 25-May-93 13:44 by sybalsky:mv:envos")
+
+    (* ;; "This is a special-paragraph that should be skipped in this context (e.g. an EVEN para on an odd page).  This is done by setting LINE:LCHARLIM to the last character of the heading so it will move the document ahead to the next real text.")
+
+    (SETLD LINE LMARK 'SPECIAL)
+    (SETLD LINE 1STLN T)
+    (SETLD LINE LSTLN T)
+    (SETLD LINE LHEIGHT 0)
+    (SETLD LINE ASCENT 0)
+    (SETLD LINE DESCENT 0)
+    (SETLD LINE LTRUEASCENT 0)
+    (SETLD LINE LTRUEDESCENT 0)
+    (SETLD LINE LCHARLIM (SUB1 (IPLUS CHNO (for PC (HEADINGTYPE _ (fetch (FMTSPEC FMTPARASUBTYPE)
+                                                                     of PARALOOKS))
+                                              inpieces (fetch (TEXTSTREAM PIECE) of TSTREAM)
+                                              while [AND (EQ 'PAGEHEADING (fetch (FMTSPEC FMTPARATYPE
+                                                                                        )
+                                                                             of (PPARALOOKS PC)))
+                                                         (EQ HEADINGTYPE (fetch (FMTSPEC 
+                                                                                       FMTPARASUBTYPE
+                                                                                       )
+                                                                            of (PPARALOOKS PC]
+                                              sum (PLEN PC])
+)
+
+
+
+(* ;; "Perform page layout, based on a regular expression of typed regions.")
+
+(DEFINEQ
+
+(\TEDIT.FORMATBOX
   [LAMBDA (TEXTOBJ PRSTREAM STARTINGCHNO PAGEREGION FORMATTINGSTATE)
                                                              (* ; "Edited 13-Mar-2024 17:09 by rmk")
                                                              (* ; "Edited 20-Jan-2024 12:16 by rmk")
@@ -728,20 +761,20 @@
                                                              (* ; 
                                                "Only format if we're not looking for something else.")
                        (TEDIT.SETQS (LINES NIL LAST-CHNO)
-                              (TEDIT.FORMATTEXTBOX TEXTOBJ PRSTREAM STARTINGCHNO PAGEREGION 
+                              (\TEDIT.FORMATTEXTBOX TEXTOBJ PRSTREAM STARTINGCHNO PAGEREGION 
                                      FORMATTINGSTATE))))
              (FOLIO                                          (* ; 
                                            "A Page Number.  Fill it in according to the instructions")
                     (CL:WHEN (\TEDIT.FORMAT.FOUNDBOX? PAGEREGION FORMATTINGSTATE)
                                                              (* ; 
                                                "Only format if we're not looking for something else.")
-                        (SETQ LINES (TEDIT.FORMATFOLIO TEXTOBJ PRSTREAM FORMATTINGSTATE PAGEREGION))))
+                        (SETQ LINES (\TEDIT.FORMATFOLIO TEXTOBJ PRSTREAM FORMATTINGSTATE PAGEREGION))))
              (HEADING                                        (* ; 
                           "A Page heading.  Fill it in from a text source we saved for the occasion.")
                       (CL:WHEN (\TEDIT.FORMAT.FOUNDBOX? PAGEREGION FORMATTINGSTATE)
                                                              (* ; 
                                                "Only format if we're not looking for something else.")
-                          (SETQ LINES (TEDIT.FORMATHEADING TEXTOBJ PRSTREAM FORMATTINGSTATE 
+                          (SETQ LINES (\TEDIT.FORMATHEADING TEXTOBJ PRSTREAM FORMATTINGSTATE 
                                              PAGEREGION))))
              (PAGE 
                    (* ;; "This box is really a PAGE FRAME, no lines here.  Fill it in and do whatever other processing is needful for end of page.")
@@ -749,7 +782,7 @@
                    (\TEDIT.FORMAT.FOUNDBOX? PAGEREGION FORMATTINGSTATE)
                                                              (* ; 
                       "So that if this is the box he's looking for, we'll spot it and stop searching")
-                   (TEDIT.FORMATPAGE TEXTOBJ PRSTREAM STARTINGCHNO PAGEREGION FORMATTINGSTATE))
+                   (\TEDIT.FORMATPAGE TEXTOBJ PRSTREAM STARTINGCHNO PAGEREGION FORMATTINGSTATE))
              ((RECURSIVE SEQUENCE ALTERNATE SELECTION REPEAT) 
                                                              (* ; 
                                                     "This box is really a list of boxes.  Fill them.")
@@ -783,7 +816,7 @@
                                                                               of SUBREGION))
                                                                      (fetch (REGION BOTTOM)
                                                                         of REGION]
-                                 (TEDIT.FORMATBOX TEXTOBJ PRSTREAM (GETPFS FORMATTINGSTATE CHNO)
+                                 (\TEDIT.FORMATBOX TEXTOBJ PRSTREAM (GETPFS FORMATTINGSTATE CHNO)
                                         (create PAGEREGION using SUBREGION REGIONSPEC _ SUBREGIONSPEC
                                                )
                                         FORMATTINGSTATE)))
@@ -811,9 +844,9 @@
                                                                                 of SUBREGION))
                                                                        (fetch (REGION BOTTOM)
                                                                           of REGION]
-                                             (TEDIT.FORMATBOX TEXTOBJ PRSTREAM (GETPFS 
+                                             (\TEDIT.FORMATBOX TEXTOBJ PRSTREAM (GETPFS 
                                                                                       FORMATTINGSTATE
-                                                                                      CHNO)
+                                                                                       CHNO)
                                                     (create PAGEREGION using SUBREGION REGIONSPEC _ 
                                                                              SUBREGIONSPEC)
                                                     FORMATTINGSTATE))))
@@ -861,8 +894,10 @@
                                                  "Otherwise, use the new char no if we computed one.")
                   (SETPFS FORMATTINGSTATE CHNO CHNO])
 
-(TEDIT.FORMATHEADING
-  [LAMBDA (TEXTOBJ PRSTREAM FORMATTINGSTATE PAGEREGION)      (* ; "Edited 13-Mar-2024 09:00 by rmk")
+(\TEDIT.FORMATHEADING
+  [LAMBDA (TEXTOBJ PRSTREAM FORMATTINGSTATE PAGEREGION)      (* ; "Edited 17-Mar-2024 00:24 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 19:23 by rmk")
+                                                             (* ; "Edited 13-Mar-2024 09:00 by rmk")
                                                              (* ; "Edited  6-Mar-2024 13:09 by rmk")
                                                              (* ; "Edited 15-Feb-2024 22:02 by rmk")
                                                              (* ; "Edited 19-Jan-2024 23:20 by rmk")
@@ -890,8 +925,8 @@
 
              (* ;; "Insert the heading pieces into HEADINGTEXTOBJ")
 
-             (\INSERTPIECES (fetch (SELPIECES SPFIRST) of HEADING)
-                    (\ALIGNEDPIECE 1 HEADINGTEXTOBJ)
+             (\TEDIT.INSERTPIECES (fetch (SELPIECES SPFIRST) of HEADING)
+                    (\TEDIT.ALIGNEDPIECE 1 HEADINGTEXTOBJ)
                     HEADINGTEXTOBJ)
 
              (* ;; "")
@@ -905,8 +940,8 @@
 
                       (* ;; "Format the next line from HEADINGTEXTOBJ pieces")
 
-                      (SETQ LINE (\FORMATLINE HEADINGTEXTOBJ CHNO NIL REGION PRSTREAM FORMATTINGSTATE
-                                        ))
+                      (SETQ LINE (\TEDIT.FORMATLINE HEADINGTEXTOBJ CHNO NIL REGION PRSTREAM 
+                                        FORMATTINGSTATE))
                       (SETQ FORCENEXTPAGE (EQ (CHARCODE FORM)
                                               (GETLD LINE FORCED-END)))
                       [SETQ YBOT (COND
@@ -921,8 +956,9 @@
                                                              (* ; "Set the start of the next line")
                       LINE))])
 
-(TEDIT.FORMATPAGE
-  [LAMBDA (TEXTOBJ PRSTREAM CHNO PAGEREGION FORMATTINGSTATE) (* ; "Edited 13-Mar-2024 10:28 by rmk")
+(\TEDIT.FORMATPAGE
+  [LAMBDA (TEXTOBJ PRSTREAM CHNO PAGEREGION FORMATTINGSTATE) (* ; "Edited 17-Mar-2024 00:24 by rmk")
+                                                             (* ; "Edited 13-Mar-2024 10:28 by rmk")
                                                              (* ; "Edited 19-Jan-2024 23:10 by rmk")
                                                              (* ; "Edited 11-Dec-2023 22:02 by rmk")
                                                              (* ; "Edited 13-Nov-2023 00:15 by rmk")
@@ -961,7 +997,7 @@
                                                              "Print in the usual region on the page")
               (CL:UNLESS (ILEQ CHNO TEXTLEN)
                      (RETURN))
-              (SETQ PC (\ALIGNEDPIECE CHNO TEXTOBJ))
+              (SETQ PC (\TEDIT.ALIGNEDPIECE CHNO TEXTOBJ))
               (SETQ NEWPARALOOKS (\TEDIT.APPLY.PARASTYLES (PPARALOOKS PC)
                                         PC TEXTOBJ))         (* ; 
                                                 "RMK: Why both 'NEWPAGELAYOUT and :NEW-PAGE-LAYOUT ?")
@@ -1015,8 +1051,8 @@
                                          (* ;; 
                  "Now format the subregions of the page. The CHNO field may be updated by each call.")
 
-                                         (TEDIT.FORMATBOX TEXTOBJ PRSTREAM (GETPFS FORMATTINGSTATE 
-                                                                                  CHNO)
+                                         (\TEDIT.FORMATBOX TEXTOBJ PRSTREAM (GETPFS FORMATTINGSTATE 
+                                                                                   CHNO)
                                                 SUBREGION FORMATTINGSTATE))
 
          (* ;; "")
@@ -1056,8 +1092,9 @@
     (add (GETPFS FORMATTINGSTATE PAGECOUNT)
          1])
 
-(TEDIT.FORMATTEXTBOX
-  [LAMBDA (TEXTOBJ PRSTREAM CHNO PAGEREGION FORMATTINGSTATE) (* ; "Edited 19-Jan-2024 23:37 by rmk")
+(\TEDIT.FORMATTEXTBOX
+  [LAMBDA (TEXTOBJ PRSTREAM CHNO PAGEREGION FORMATTINGSTATE) (* ; "Edited 15-Mar-2024 19:24 by rmk")
+                                                             (* ; "Edited 19-Jan-2024 23:37 by rmk")
                                                              (* ; "Edited  4-Dec-2023 12:34 by rmk")
                                                              (* ; "Edited  4-Jul-2023 08:02 by rmk")
                                                              (* ; "Edited  2-Jul-2023 20:49 by rmk")
@@ -1118,7 +1155,7 @@
                    (SETQ LINE (pop (GETPFS FORMATTINGSTATE PAGELINECACHE))) 
                                                              (* ; 
                                                              "Format the line, noting any form-feeds")
-                   (SETQ LINE (\FORMATLINE TEXTOBJ CHNO LINE REGION PRSTREAM FORMATTINGSTATE))
+                   (SETQ LINE (\TEDIT.FORMATLINE TEXTOBJ CHNO LINE REGION PRSTREAM FORMATTINGSTATE))
                    (SETQ FORCENEXTPAGE (AND (EQ (CHARCODE FORM)
                                                 (FGETLD LINE FORCED-END))
                                             'USERBREAK))
@@ -1279,8 +1316,9 @@
          (TEDIT.HARDCOPY-COLUMN-END LINES ORPHAN FORCENEXTPAGE CHNO PAGEFOOTNOTES REGION TEXTOBJ 
                 FORMATTINGSTATE FINAL-CHNO)))])
 
-(TEDIT.FORMATFOLIO
-  [LAMBDA (TEXTOBJ PRSTREAM FORMATTINGSTATE PAGEREGION)      (* ; "Edited 13-Mar-2024 09:00 by rmk")
+(\TEDIT.FORMATFOLIO
+  [LAMBDA (TEXTOBJ PRSTREAM FORMATTINGSTATE PAGEREGION)      (* ; "Edited 15-Mar-2024 19:24 by rmk")
+                                                             (* ; "Edited 13-Mar-2024 09:00 by rmk")
                                                              (* ; "Edited 19-Jan-2024 23:28 by rmk")
                                                              (* ; "Edited 18-Jan-2024 17:04 by rmk")
                                                              (* ; "Edited 13-Nov-2023 00:24 by rmk")
@@ -1325,8 +1363,8 @@
              (bind LINE YBOT FORCENEXTPAGE (TEXTLEN _ (TEXTLEN FOLIOTEXTOBJ))
                    (BOTTOM _ (fetch (REGION BOTTOM) of REGION))
                    (CHNO _ 1) while (ILEQ CHNO TEXTLEN) until FORCENEXTPAGE
-                collect (SETQ LINE (\FORMATLINE FOLIOTEXTOBJ CHNO NIL REGION PRSTREAM FORMATTINGSTATE
-                                          ))
+                collect (SETQ LINE (\TEDIT.FORMATLINE FOLIOTEXTOBJ CHNO NIL REGION PRSTREAM 
+                                          FORMATTINGSTATE))
                       (SETQ FORCENEXTPAGE (EQ (CHARCODE FORM)
                                               (GETLD LINE FORCED-END))) 
                                                              (* ; "Format the next possible line")
@@ -1375,35 +1413,6 @@
                                                             "We've formatted enough pages up to now.")
                  (SETPFS FORMATTINGSTATE STATE 'FORMATTING)))
         T])
-
-(TEDIT.SKIP.SPECIALCOND
-  [LAMBDA (TSTREAM LINE PARALOOKS CHNO)                      (* ; "Edited  5-Jul-2023 14:19 by rmk")
-                                                             (* ; "Edited 15-May-2023 22:36 by rmk")
-                                                             (* ; "Edited 16-Feb-2023 00:08 by rmk")
-                                                             (* ; 
-                                                        "Edited 25-May-93 13:44 by sybalsky:mv:envos")
-
-    (* ;; "This is a special-paragraph that should be skipped in this context (e.g. an EVEN para on an odd page).  This is done by setting LINE:LCHARLIM to the last character of the heading so it will move the document ahead to the next real text.")
-
-    (SETLD LINE LMARK 'SPECIAL)
-    (SETLD LINE 1STLN T)
-    (SETLD LINE LSTLN T)
-    (SETLD LINE LHEIGHT 0)
-    (SETLD LINE ASCENT 0)
-    (SETLD LINE DESCENT 0)
-    (SETLD LINE LTRUEASCENT 0)
-    (SETLD LINE LTRUEDESCENT 0)
-    (SETLD LINE LCHARLIM (SUB1 (IPLUS CHNO (for PC (HEADINGTYPE _ (fetch (FMTSPEC FMTPARASUBTYPE)
-                                                                     of PARALOOKS))
-                                              inpieces (fetch (TEXTSTREAM PIECE) of TSTREAM)
-                                              while [AND (EQ 'PAGEHEADING (fetch (FMTSPEC FMTPARATYPE
-                                                                                        )
-                                                                             of (PPARALOOKS PC)))
-                                                         (EQ HEADINGTYPE (fetch (FMTSPEC 
-                                                                                       FMTPARASUBTYPE
-                                                                                       )
-                                                                            of (PPARALOOKS PC]
-                                              sum (PLEN PC])
 )
 
 
@@ -1413,7 +1422,9 @@
 (DEFINEQ
 
 (TEDIT.HARDCOPY.PAGEHEADINGS
-  [LAMBDA (TEXTOBJ CHNO FORMATTINGSTATE)                     (* ; "Edited  9-May-2023 17:46 by rmk")
+  [LAMBDA (TEXTOBJ CHNO FORMATTINGSTATE)                     (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:54 by rmk")
+                                                             (* ; "Edited  9-May-2023 17:46 by rmk")
                                                              (* ; "Edited  7-May-2023 23:45 by rmk")
                                                              (* ; "Edited  9-Oct-2022 17:12 by rmk")
 
@@ -1422,9 +1433,8 @@
     (CL:UNLESS FORMATTINGSTATE                               (* ; 
                                                      "If it isn't there, we would loose the headings")
         (SHOULDNT "NIL FORMATTINGSTATE"))
-    (bind HEADINGSUBTYPE (PC _ (\CHTOPC CHNO TEXTOBJ)) while [AND PC (EQ 'PAGEHEADING
-                                                                         (fetch FMTPARATYPE
-                                                                            of (PPARALOOKS PC]
+    (bind HEADINGSUBTYPE (PC _ (\TEDIT.CHTOPC CHNO TEXTOBJ))
+       while [AND PC (EQ 'PAGEHEADING (fetch FMTPARATYPE of (PPARALOOKS PC]
        do (SETQ HEADINGSUBTYPE (fetch FMTPARASUBTYPE of (PPARALOOKS PC)))
           (for P (START _ CHNO) inpieces PC while [AND (EQ 'PAGEHEADING (fetch FMTPARATYPE
                                                                            of (PPARALOOKS P)))
@@ -1435,8 +1445,9 @@
 
                 (add CHNO (PLEN P)) finally (LISTPUT (fetch PAGEHEADINGS of FORMATTINGSTATE)
                                                    HEADINGSUBTYPE
-                                                   (\SELPIECES.COPY (\SELPIECES START CHNO TEXTOBJ)))
-                                          
+                                                   (\TEDIT.SELPIECES.COPY (\TEDIT.SELPIECES START 
+                                                                                 CHNO TEXTOBJ))) 
+
                                           (* ;; 
                                           "Set PC to continue looking for the next headingtype.")
 
@@ -1761,7 +1772,8 @@
 (DEFINEQ
 
 (\TEDIT.FORMAT.FOOTNOTE
-  [LAMBDA (TEXTOBJ PRSTREAM LINE REGION FORMATTINGSTATE)     (* ; "Edited 13-Mar-2024 17:00 by rmk")
+  [LAMBDA (TEXTOBJ PRSTREAM LINE REGION FORMATTINGSTATE)     (* ; "Edited 15-Mar-2024 19:24 by rmk")
+                                                             (* ; "Edited 13-Mar-2024 17:00 by rmk")
                                                              (* ; "Edited 19-Jan-2024 23:30 by rmk")
                                                              (* ; "Edited  6-May-2023 20:38 by rmk")
                                                              (* ; "Edited  7-Mar-2023 13:11 by rmk")
@@ -1779,7 +1791,7 @@
 
              (* ;; "Grab a line descriptor from the formatting list, or create a new one.")
 
-             (SETQ LINE (\FORMATLINE TEXTOBJ CHNO (GETPFS FORMATTINGSTATE PAGELINECACHE)
+             (SETQ LINE (\TEDIT.FORMATLINE TEXTOBJ CHNO (GETPFS FORMATTINGSTATE PAGELINECACHE)
                                REGION PRSTREAM FORMATTINGSTATE)) 
                                                              (* ; 
                                                              "Format the line, noting any form-feeds")
@@ -1795,14 +1807,15 @@
                         (RETURN (DREMOVE NIL $$VAL])
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (12038 15371 (\TEDIT.PARSE.PAGEFRAMES 12048 . 13548) (\TEDIT.PUT.PAGEFRAMES 13550 . 
-14374) (\TEDIT.UNPARSE.PAGEFRAMES 14376 . 15369)) (15434 31896 (TEDIT.SINGLE.PAGEFORMAT 15444 . 25662)
- (TEDIT.COMPOUND.PAGEFORMAT 25664 . 26643) (TEDIT.PAGEFORMAT 26645 . 31894)) (31983 91368 (
-TEDIT.FORMAT.HARDCOPY 31993 . 42983) (TEDIT.FORMATBOX 42985 . 55757) (TEDIT.FORMATHEADING 55759 . 
-59542) (TEDIT.FORMATPAGE 59544 . 67846) (TEDIT.FORMATTEXTBOX 67848 . 82631) (TEDIT.FORMATFOLIO 82633
- . 87260) (\TEDIT.FORMAT.FOUNDBOX? 87262 . 89301) (TEDIT.SKIP.SPECIALCOND 89303 . 91366)) (91448 93729
- (TEDIT.HARDCOPY.PAGEHEADINGS 91458 . 93727)) (93838 101021 (TEDIT.HARDCOPY-COLUMN-END 93848 . 101019)
-) (101066 106007 (SCALEPAGEUNITS 101076 . 102217) (SCALEPAGEXUNITS 102219 . 102989) (SCALEPAGEYUNITS 
-102991 . 103762) (\TEDIT.PAPERHEIGHT 103764 . 104699) (\TEDIT.PAPERWIDTH 104701 . 106005)) (106423 
-109991 (ROMANNUMERALS 106433 . 109989)) (110027 112404 (\TEDIT.FORMAT.FOOTNOTE 110037 . 112402)))))
+  (FILEMAP (NIL (12106 15439 (\TEDIT.PARSE.PAGEFRAMES 12116 . 13616) (\TEDIT.PUT.PAGEFRAMES 13618 . 
+14442) (\TEDIT.UNPARSE.PAGEFRAMES 14444 . 15437)) (15502 31964 (TEDIT.SINGLE.PAGEFORMAT 15512 . 25730)
+ (TEDIT.COMPOUND.PAGEFORMAT 25732 . 26711) (TEDIT.PAGEFORMAT 26713 . 31962)) (31965 45142 (
+TEDIT.FORMAT.HARDCOPY 31975 . 43075) (TEDIT.SKIP.SPECIALCOND 43077 . 45140)) (45229 92152 (
+\TEDIT.FORMATBOX 45239 . 58019) (\TEDIT.FORMATHEADING 58021 . 62041) (\TEDIT.FORMATPAGE 62043 . 70463)
+ (\TEDIT.FORMATTEXTBOX 70465 . 85364) (\TEDIT.FORMATFOLIO 85366 . 90109) (\TEDIT.FORMAT.FOUNDBOX? 
+90111 . 92150)) (92232 94648 (TEDIT.HARDCOPY.PAGEHEADINGS 92242 . 94646)) (94757 101940 (
+TEDIT.HARDCOPY-COLUMN-END 94767 . 101938)) (101985 106926 (SCALEPAGEUNITS 101995 . 103136) (
+SCALEPAGEXUNITS 103138 . 103908) (SCALEPAGEYUNITS 103910 . 104681) (\TEDIT.PAPERHEIGHT 104683 . 105618
+) (\TEDIT.PAPERWIDTH 105620 . 106924)) (107342 110910 (ROMANNUMERALS 107352 . 110908)) (110946 113438 
+(\TEDIT.FORMAT.FOOTNOTE 110956 . 113436)))))
 STOP
diff --git a/library/tedit/TEDIT-PAGE.LCOM b/library/tedit/TEDIT-PAGE.LCOM
index 9c31e894..2250338f 100644
Binary files a/library/tedit/TEDIT-PAGE.LCOM and b/library/tedit/TEDIT-PAGE.LCOM differ
diff --git a/library/tedit/TEDIT-PCTREE b/library/tedit/TEDIT-PCTREE
index dd87c4d0..712f25e5 100644
--- a/library/tedit/TEDIT-PCTREE
+++ b/library/tedit/TEDIT-PCTREE
@@ -1,12 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 4-Mar-2024 22:50:24" {WMEDLEY}<library>tedit>TEDIT-PCTREE.;219 65397  
+(FILECREATED "20-Mar-2024 11:07:07" {WMEDLEY}<library>tedit>TEDIT-PCTREE.;239 66617  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS \DELETEPIECES)
+      :CHANGES-TO (FNS \TEDIT.INSERTPIECES)
 
-      :PREVIOUS-DATE " 3-Mar-2024 08:59:45" {WMEDLEY}<library>tedit>TEDIT-PCTREE.;218)
+      :PREVIOUS-DATE "17-Mar-2024 12:41:57" {WMEDLEY}<library>tedit>TEDIT-PCTREE.;238)
 
 
 (PRETTYCOMPRINT TEDIT-PCTREECOMS)
@@ -33,11 +33,13 @@
         (INITVARS (MULTIPLE-PIECE-TABLES T))
                                                              (* ; "Experimentation")
         (GLOBALVARS MULTIPLE-PIECE-TABLES)
-        (FNS \MAKEPCTB \UPDATEPCNODES \FIRSTPIECE \DELETETREE \INSERTTREE \LASTPIECE \MATCHPCS 
-             \PCTOCH \CHTOPC \TEDIT.SET-TOTLEN \MAKE.VACANT.BTREESLOT \LINKNEWPIECE \UNLINKPIECE 
-             \SPLITPIECE \INSERTPIECE \INSERTPIECES \DELETEPIECES \ALIGNEDPIECE)
+        (FNS \TEDIT.MAKEPCTB \TEDIT.UPDATEPCNODES \TEDIT.FIRSTPIECE \TEDIT.DELETETREE 
+             \TEDIT.INSERTTREE \TEDIT.LASTPIECE \TEDIT.PCTOCH \TEDIT.CHTOPC \TEDIT.SET-TOTLEN 
+             \TEDIT.MAKE.VACANT.BTREESLOT \TEDIT.LINKNEWPIECE \TEDIT.UNLINKPIECE \TEDIT.SPLITPIECE 
+             \TEDIT.INSERTPIECE \TEDIT.INSERTPIECES \TEDIT.DELETEPIECES \TEDIT.ALIGNEDPIECE)
         (COMS                                                (* ; "Debugging ")
-              (FNS BTVALIDATE BTVALIDATE.PRINT CHECK-BTREE CHECK-BTREE1 BTFAIL)
+              (FNS \TEDIT.BTVALIDATE \TEDIT.BTVALIDATE.PRINT \TEDIT.CHECK-BTREE \TEDIT.CHECK-BTREE1 
+                   \TEDIT.BTFAIL \TEDIT.MATCHPCS)
               (INITVARS (BTVALIDATETAGS 'DONT))
               (GLOBALVARS BTVALIDATETAGS))))
 
@@ -169,7 +171,7 @@
 (PUTPROPS \INSURE.VACANT.BTREESLOT MACRO ((BTNODE TEXTOBJ)
                                           (CL:WHEN (EQ \BTREEMAXCOUNT (ffetch (BTREENODE COUNT)
                                                                          of BTNODE))
-                                                 (\MAKE.VACANT.BTREESLOT BTNODE TEXTOBJ))))
+                                                 (\TEDIT.MAKE.VACANT.BTREESLOT BTNODE TEXTOBJ))))
 )
 
 
@@ -212,7 +214,7 @@
 )
 (DEFINEQ
 
-(\MAKEPCTB
+(\TEDIT.MAKEPCTB
   [LAMBDA (TEXTOBJ)                                          (* ; "Edited  7-Dec-2023 12:41 by rmk")
                                                              (* ; "Edited 31-Oct-2023 10:09 by rmk")
                                                              (* ; "Edited  8-Sep-2023 16:30 by rmk")
@@ -240,15 +242,16 @@
          (FSETTOBJ TEXTOBJ TEXTLEN 0)
          (FSETTOBJ TEXTOBJ PCTB (CONS NODE])
 
-(\UPDATEPCNODES
-  [LAMBDA (PC DELTA TEXTOBJ)                                 (* ; "Edited 10-Jun-2023 00:18 by rmk")
+(\TEDIT.UPDATEPCNODES
+  [LAMBDA (PC DELTA TEXTOBJ)                                 (* ; "Edited 16-Mar-2024 09:57 by rmk")
+                                                             (* ; "Edited 10-Jun-2023 00:18 by rmk")
                                                              (* ; "Edited  8-Jun-2023 23:03 by rmk")
                                                              (* ; "Edited 21-Apr-93 16:09 by jds")
 
     (* ;; 
     "The size of the text represented by PC has grown by DELTA (negative if text is being deleted).")
 
-    (* ;; "For insertions, this is called by either \INSERTPIECE, if a new piece is being inserted, or by \INSERTCH.EXTEND if the insertion is a string insertion physically adjacent to a previous insertion.")
+    (* ;; "For insertions, this is called by either \TEDIT.INSERTPIECE, if a new piece is being inserted, or by \TEDIT.INSERTCH.EXTEND if the insertion is a string insertion physically adjacent to a previous insertion.")
 
     (* ;; "It is assumed that PC PLEN and the corresponding DLEN in its node are consistent and correct, this updates the local TOTLEN and then propagates the DELTA upwards to all ancestors.")
 
@@ -268,7 +271,7 @@
        finally (add (ffetch (TEXTOBJ TEXTLEN) of TEXTOBJ)
                     DELTA])
 
-(\FIRSTPIECE
+(\TEDIT.FIRSTPIECE
   [LAMBDA (TEXTOBJ)                                          (* ; "Edited 31-Oct-2023 19:37 by rmk")
                                                              (* ; "Edited 11-Apr-2023 12:54 by rmk")
                                                              (* ; "Edited 24-Aug-2022 12:45 by rmk")
@@ -280,8 +283,9 @@
                                         (RETURN (CL:UNLESS (EQ NODE (FGETTOBJ TEXTOBJ LASTPIECE))
                                                        NODE])
 
-(\DELETETREE
-  [LAMBDA (OLD PCNODE TEXTOBJ)                               (* ; "Edited 31-Oct-2023 10:23 by rmk")
+(\TEDIT.DELETETREE
+  [LAMBDA (OLD PCNODE TEXTOBJ)                               (* ; "Edited 17-Mar-2024 00:22 by rmk")
+                                                             (* ; "Edited 31-Oct-2023 10:23 by rmk")
                                                              (* ; "Edited 26-Oct-2023 12:50 by rmk")
                                                              (* ; "Edited 30-May-2023 08:58 by rmk")
                                                              (* ; "Edited  5-Sep-2022 14:24 by rmk")
@@ -298,7 +302,7 @@
         then 
              (* ;; "OLD was the last child, delete the whole node")
 
-             (\DELETETREE PCNODE (fetch (BTREENODE UPWARD) of PCNODE)
+             (\TEDIT.DELETETREE PCNODE (fetch (BTREENODE UPWARD) of PCNODE)
                     TEXTOBJ)
       else 
            (* ;; "Move each of the downs above OLDSLOT forward one slot")
@@ -327,7 +331,7 @@
                         (add (ffetch (BTREENODE COUNT) of PCNODE)
                              -1)))])
 
-(\INSERTTREE
+(\TEDIT.INSERTTREE
   [LAMBDA (NEW NEXT TEXTOBJ)                                 (* ; "Edited  7-Dec-2023 21:08 by rmk")
                                                              (* ; "Edited 25-Nov-2023 12:24 by rmk")
                                                              (* ; "Edited 31-Oct-2023 11:04 by rmk")
@@ -372,7 +376,7 @@
 
          NEW])
 
-(\LASTPIECE
+(\TEDIT.LASTPIECE
   [LAMBDA (TEXTOBJ)                                          (* ; "Edited 31-Oct-2023 10:20 by rmk")
                                                              (* ; "Edited 12-Apr-2023 19:23 by rmk")
                                                              (* ; "Edited 21-Aug-2022 17:13 by rmk")
@@ -384,20 +388,7 @@
     (bind [CHILD _ (CAR (LAST (GETTOBJ TEXTOBJ PCTB] while (type? BTREENODE CHILD)
        do (SETQ CHILD (ffetch (BTSLOT DOWN) of (\LASTSLOT CHILD))) finally (RETURN CHILD])
 
-(\MATCHPCS
-  [LAMBDA (NODE)                                             (* ; "Edited 17-Aug-2022 19:03 by rmk")
-                                                             (* ; "Edited 15-Aug-2022 23:06 by rmk")
-                                                             (* ; "Edited  5-May-93 17:57 by jds")
-
-    (* ;; "Make sure that any downs pointed to by this node point back to this node.")
-
-    (for S DOWN inslots NODE do (SETQ DOWN (ffetch (BTSLOT DOWN) of S))
-                                (if (type? PIECE DOWN)
-                                    then (freplace (PIECE PTREENODE) of DOWN with NODE)
-                                  elseif (type? BTREENODE DOWN)
-                                    then (freplace (BTREENODE UPWARD) of DOWN with NODE])
-
-(\PCTOCH
+(\TEDIT.PCTOCH
   [LAMBDA (PC TEXTOBJ)                                       (* ; "Edited 31-Oct-2023 21:05 by rmk")
                                                              (* ; "Edited 21-Oct-2023 11:54 by rmk")
                                                              (* ; "Edited 19-Aug-2022 22:58 by rmk")
@@ -423,7 +414,7 @@
                                            until (EQ TOPNODE PREV) sum (ffetch (BTREENODE TOTLEN)
                                                                           of TOPNODE])
 
-(\CHTOPC
+(\TEDIT.CHTOPC
   [LAMBDA (CH# TEXTOBJ TELL-PC-START?)                       (* ; "Edited  4-Nov-2023 17:56 by rmk")
                                                              (* ; "Edited  1-Nov-2023 23:29 by rmk")
                                                              (* ; "Edited 13-Apr-2023 22:22 by rmk")
@@ -523,8 +514,9 @@
     (replace (BTREENODE TOTLEN) of PCNODE with (for S inslots PCNODE sum (fetch (BTSLOT DLEN)
                                                                             of S])
 
-(\MAKE.VACANT.BTREESLOT
-  [LAMBDA (BTNODE TEXTOBJ)                                   (* ; "Edited  7-Dec-2023 21:08 by rmk")
+(\TEDIT.MAKE.VACANT.BTREESLOT
+  [LAMBDA (BTNODE TEXTOBJ)                                   (* ; "Edited 16-Mar-2024 10:23 by rmk")
+                                                             (* ; "Edited  7-Dec-2023 21:08 by rmk")
                                                              (* ; "Edited 31-Oct-2023 10:32 by rmk")
                                                              (* ; "Edited 10-Jun-2023 00:13 by rmk")
                                                              (* ; "Edited 30-May-2023 12:11 by rmk")
@@ -536,7 +528,7 @@
 
     (* ;; "The intent here is that the tree is valid whenever the code is interruptable (an interrupt should never leave the tree in a trashed state.)")
 
-    (BTVALIDATE '\MAKE.VACANT.BTREESLOT 'START TEXTOBJ)
+    (\TEDIT.BTVALIDATE '\TEDIT.MAKE.VACANT.BTREESLOT 'START TEXTOBJ)
     (CL:WHEN (EQ \BTREEMAXCOUNT (fetch (BTREENODE COUNT) of BTNODE))
 
         (* ;; "All the slots of BTNODE are full.   We create PREFIXNODE to hold the lower lower half of BTNODE's slots, and install that as the left sister of BTNODE in its parent (perhaps first creating empty space in the parent if it is also full). The remaining slots of BTNODE are shifted down to its front.  We first have to make sure that the parent has room for PREFIXNODE.")
@@ -621,13 +613,13 @@
 
                  (* ;; "Finally, add PREFIXNODE in front of BTNODE in its PARENT.")
 
-                 (\INSERTTREE PREFIXNODE BTNODE TEXTOBJ))
+                 (\TEDIT.INSERTTREE PREFIXNODE BTNODE TEXTOBJ))
 
              (* ;; "")
 
-             (BTVALIDATE '\MAKE.VACANT.BTREESLOT 'END TEXTOBJ)))])
+             (\TEDIT.BTVALIDATE '\TEDIT.MAKE.VACANT.BTREESLOT 'END TEXTOBJ)))])
 
-(\LINKNEWPIECE
+(\TEDIT.LINKNEWPIECE
   [LAMBDA (NEW NEXT TEXTOBJ)                                 (* ; "Edited 29-May-2023 23:16 by rmk")
 
     (* ;; "Set up the linear-chain links to insert the piece NEW in front of the piece NEXT in its piece-chain.  This doesn't deal with the btree.")
@@ -650,7 +642,7 @@
              (freplace (PIECE PREVPIECE) of NEXT with NEW))
          NEW])
 
-(\UNLINKPIECE
+(\TEDIT.UNLINKPIECE
   [LAMBDA (PREV PC TEXTOBJ)                                  (* ; "Edited 21-Oct-2023 17:24 by rmk")
                                                              (* ; "Edited 30-May-2023 00:31 by rmk")
 
@@ -662,8 +654,9 @@
     (freplace (PIECE PREVPIECE) of (OR (NEXTPIECE PC)
                                        (ffetch (TEXTOBJ LASTPIECE) of TEXTOBJ)) with PREV])
 
-(\SPLITPIECE
-  [LAMBDA (PC CHOFFSET TEXTOBJ)                              (* ; "Edited 28-Dec-2023 22:17 by rmk")
+(\TEDIT.SPLITPIECE
+  [LAMBDA (PC CHOFFSET TEXTOBJ)                              (* ; "Edited 17-Mar-2024 00:11 by rmk")
+                                                             (* ; "Edited 28-Dec-2023 22:17 by rmk")
                                                              (* ; "Edited  7-Dec-2023 21:07 by rmk")
                                                              (* ; "Edited 25-Nov-2023 11:50 by rmk")
                                                              (* ; "Edited 31-Oct-2023 10:42 by rmk")
@@ -677,7 +670,7 @@
 
     (* ;; "")
 
-    (BTVALIDATE '\SPLITPIECE 'START TEXTOBJ)
+    (\TEDIT.BTVALIDATE '\TEDIT.SPLITPIECE 'START TEXTOBJ)
     (CL:WHEN (AND PC (IGREATERP CHOFFSET 0))                 (* ; "Nothing to do if asking for 0.")
         (FSETTOBJ TEXTOBJ HINTPC NIL)
         (\INSURE.VACANT.BTREESLOT (FGETPC PC PTREENODE)
@@ -723,13 +716,14 @@
 
                  (* ;; "Insert PREVPC into the piece tree in front of PC.  ")
 
-                 (\INSERTTREE PREVPC PC TEXTOBJ)
-                 (\LINKNEWPIECE PREVPC PC))
-             (BTVALIDATE '\SPLITPIECE 'AFTER-INSERTPIECE TEXTOBJ)))
+                 (\TEDIT.INSERTTREE PREVPC PC TEXTOBJ)
+                 (\TEDIT.LINKNEWPIECE PREVPC PC))
+             (\TEDIT.BTVALIDATE '\TEDIT.SPLITPIECE 'AFTER-INSERTPIECE TEXTOBJ)))
     PC])
 
-(\INSERTPIECE
-  [LAMBDA (NEWPC NEXTPC TEXTOBJ)                             (* ; "Edited  7-Dec-2023 21:07 by rmk")
+(\TEDIT.INSERTPIECE
+  [LAMBDA (NEWPC NEXTPC TEXTOBJ)                             (* ; "Edited 17-Mar-2024 00:11 by rmk")
+                                                             (* ; "Edited  7-Dec-2023 21:07 by rmk")
                                                              (* ; "Edited 31-Oct-2023 23:05 by rmk")
                                                              (* ; "Edited  9-Jun-2023 22:40 by rmk")
                                                              (* ; "Edited  3-Jun-2023 20:23 by rmk")
@@ -741,7 +735,7 @@
 
     (* ;; "Caller guarantees that the chain links of NEW can be smashed.")
 
-    (BTVALIDATE '\INSERTPIECE 'START TEXTOBJ)
+    (\TEDIT.BTVALIDATE '\TEDIT.INSERTPIECE 'START TEXTOBJ)
     (FSETTOBJ TEXTOBJ HINTPC NIL)
     (CL:UNLESS NEXTPC
         (SETQ NEXTPC (FGETTOBJ TEXTOBJ LASTPIECE)))
@@ -759,7 +753,7 @@
 
                  (* ;; "Make this uninterruptable.  We know that  NEXTPC is the zero-PLEN last piece, so no need for \UPDATEPCNODES to fix the lengths.")
 
-                 (\DELETETREE NEXTPC (FGETPC NEXTPC PTREENODE)
+                 (\TEDIT.DELETETREE NEXTPC (FGETPC NEXTPC PTREENODE)
                         TEXTOBJ)
                  [RPLACD LASTTREECONS
                         (SETQ LASTTREECONS
@@ -773,15 +767,18 @@
     (\INSURE.VACANT.BTREESLOT (FGETPC NEXTPC PTREENODE)
            TEXTOBJ)
     (UNINTERRUPTABLY
-        (\INSERTTREE NEWPC NEXTPC TEXTOBJ)
-        (\LINKNEWPIECE NEWPC NEXTPC TEXTOBJ)
-        (\UPDATEPCNODES NEWPC (PLEN NEWPC)
+        (\TEDIT.INSERTTREE NEWPC NEXTPC TEXTOBJ)
+        (\TEDIT.LINKNEWPIECE NEWPC NEXTPC TEXTOBJ)
+        (\TEDIT.UPDATEPCNODES NEWPC (PLEN NEWPC)
                TEXTOBJ))
-    (BTVALIDATE '\INSERTPIECE 'END TEXTOBJ)
+    (\TEDIT.BTVALIDATE '\TEDIT.INSERTPIECE 'END TEXTOBJ)
     NEWPC])
 
-(\INSERTPIECES
-  [LAMBDA (PIECES NEXTPC TEXTOBJ)                            (* ; "Edited  7-Dec-2023 21:08 by rmk")
+(\TEDIT.INSERTPIECES
+  [LAMBDA (PIECES NEXTPC TEXTOBJ)                            (* ; "Edited 20-Mar-2024 10:55 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:41 by rmk")
+                                                             (* ; "Edited 16-Mar-2024 10:23 by rmk")
+                                                             (* ; "Edited  7-Dec-2023 21:08 by rmk")
                                                              (* ; "Edited 25-Nov-2023 12:03 by rmk")
                                                              (* ; "Edited  5-Sep-2023 21:36 by rmk")
                                                              (* ; "Edited 29-Aug-2023 11:09 by rmk")
@@ -792,7 +789,7 @@
     (* ;; "Inserts the piece-chain PIECES in front of existing NEXTPC in TEXTOBJ.  This assumes that the piece-chain is already linked, that the nextpiece of the final piece in the chain is initially NIL but ends up pointing to NEXTPC (or NIL if it is the last piece).")
 
     (CL:WHEN PIECES
-        (\DTEST TEXTOBJ 'TEXTOBJ)
+        (TEXTOBJ! TEXTOBJ)
         (FSETTOBJ TEXTOBJ HINTPC NIL)
         (FSETTOBJ TEXTOBJ \DIRTY T)
         (CL:UNLESS NEXTPC
@@ -806,8 +803,8 @@
               (UNINTERRUPTABLY
                   (\INSURE.VACANT.BTREESLOT (FGETPC NEXTPC PTREENODE)
                          TEXTOBJ)
-                  (\INSERTTREE PC NEXTPC TEXTOBJ)
-                  (\UPDATEPCNODES PC (PLEN PC)
+                  (\TEDIT.INSERTTREE PC NEXTPC TEXTOBJ)
+                  (\TEDIT.UPDATEPCNODES PC (PLEN PC)
                          TEXTOBJ)) finally 
 
                                          (* ;; "PC is the final piece of the chain")
@@ -819,8 +816,9 @@
                                          (FSETPC PIECES PREVPIECE PREVPC)))
     PIECES])
 
-(\DELETEPIECES
-  [LAMBDA (SELPIECES TEXTOBJ)                                (* ; "Edited 25-Nov-2023 12:12 by rmk")
+(\TEDIT.DELETEPIECES
+  [LAMBDA (SELPIECES TEXTOBJ)                                (* ; "Edited 16-Mar-2024 10:00 by rmk")
+                                                             (* ; "Edited 25-Nov-2023 12:12 by rmk")
                                                              (* ; "Edited  4-Nov-2023 23:03 by rmk")
                                                              (* ; "Edited 22-Oct-2023 11:43 by rmk")
                                                              (* ; "Edited  5-Sep-2023 22:32 by rmk")
@@ -837,16 +835,16 @@
 
     (* ;; "This may not be entirely safe against an interrupt, which only matters on the call from \INSERTSELPIECES (otherwise the data isn't yet visible).  Although the tree is consistent  with the remaining pieces after each deletion, the fact that we keep the SELPIECE links intact means that the remaining pieces point to pieces that are no longer in the tree.  We could do a little more work to incrementally chain the deleted pieces together, one by one, as they are deleted--in the end they would all be out of the tree, and the deletion chain would have been reconnected.  Alternatively, we can make the whole loop be uninterruptable. ")
 
-    (BTVALIDATE '\DELETEPIECES 'BEFORE TEXTOBJ)
+    (\TEDIT.BTVALIDATE '\TEDIT.DELETEPIECES 'BEFORE TEXTOBJ)
     (for PC PREV NEXT first (FSETTOBJ TEXTOBJ HINTPC NIL)
                             (SETQ PREV (PREVPIECE (fetch (SELPIECES SPFIRST) of SELPIECES))) 
                                                              (* ; "For incremental chain-update")
                             (SETQ NEXT (OR (NEXTPIECE (fetch (SELPIECES SPLAST) of SELPIECES))
                                            (FGETTOBJ TEXTOBJ LASTPIECE))) inselpieces SELPIECES
        do (UNINTERRUPTABLY
-              (\UPDATEPCNODES PC (IMINUS (PLEN PC))
+              (\TEDIT.UPDATEPCNODES PC (IMINUS (PLEN PC))
                      TEXTOBJ)
-              (\DELETETREE PC (FGETPC PC PTREENODE)
+              (\TEDIT.DELETETREE PC (FGETPC PC PTREENODE)
                      TEXTOBJ)
 
               (* ;; "This piece and its lengths are out of the tree, but its chain-links are still there. To keep the tree valid at each point, we incrementally splice it out.")
@@ -862,10 +860,11 @@
                                                          PREVPIECE NIL)
                                                   (FSETPC (fetch (SELPIECES SPLAST) of SELPIECES)
                                                          NEXTPIECE NIL))
-    (BTVALIDATE '\DELETEPIECES 'AFTER TEXTOBJ])
+    (\TEDIT.BTVALIDATE '\TEDIT.DELETEPIECES 'AFTER TEXTOBJ])
 
-(\ALIGNEDPIECE
-  [LAMBDA (CHNO TEXTOBJ)                                     (* ; "Edited 31-Oct-2023 19:37 by rmk")
+(\TEDIT.ALIGNEDPIECE
+  [LAMBDA (CHNO TEXTOBJ)                                     (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 31-Oct-2023 19:37 by rmk")
                                                              (* ; "Edited 29-May-2023 23:48 by rmk")
                                                              (* ; "Edited 20-May-2023 13:53 by rmk")
                                                              (* ; "Edited  3-May-2023 18:47 by rmk")
@@ -881,13 +880,13 @@
 
              (FGETTOBJ TEXTOBJ LASTPIECE)
       elseif (ILEQ CHNO 1)
-        then (\FIRSTPIECE TEXTOBJ)
+        then (\TEDIT.FIRSTPIECE TEXTOBJ)
       else (LET (PC START-OF-PIECE)
                 (DECLARE (SPECVARS START-OF-PIECE))
-                (SETQ PC (\CHTOPC CHNO TEXTOBJ T))
+                (SETQ PC (\TEDIT.CHTOPC CHNO TEXTOBJ T))
                 (CL:UNLESS (IEQP CHNO START-OF-PIECE)        (* ; 
                                    "There can be no para break before the split, as things now work.")
-                    (\SPLITPIECE PC (IDIFFERENCE CHNO START-OF-PIECE)
+                    (\TEDIT.SPLITPIECE PC (IDIFFERENCE CHNO START-OF-PIECE)
                            TEXTOBJ))
                 PC])
 )
@@ -898,7 +897,7 @@
 
 (DEFINEQ
 
-(BTVALIDATE
+(\TEDIT.BTVALIDATE
   [LAMBDA (TAG MSG TOBJ PRINT)                               (* ; "Edited  8-Jun-2023 22:05 by rmk")
                                                              (* ; "Edited  3-Jun-2023 17:14 by rmk")
                                                              (* ; "Edited 29-Aug-2022 12:10 by rmk")
@@ -909,20 +908,20 @@
         [LET (DEPTHHIST COUNTHIST PLENHIST (NNODES 0)
                     (NPIECES 0))
              (DECLARE (SPECVARS DEPTHHIST COUNTHIST NNODES NPIECES PLENHIST))
-             (PROG1 [CHECK-BTREE (if TOBJ
-                                     then (TEXTOBJ TOBJ)
-                                   else (OR (AND (NEQ (GETATOMVAL 'TEXTOBJ)
-                                                      (EVALV 'TEXTOBJ))
-                                                 (TEXTOBJ (EVALV 'TEXTOBJ)
-                                                        T))
-                                            (TEXTOBJ (WHICHW)
-                                                   T)
-                                            (TEXTOBJ (EVALV 'LASTTESTSTREAM)
-                                                   T)
-                                            (ERROR "NOT A TEXTOBJ"]
-                 (CL:WHEN PRINT (BTVALIDATE.PRINT)))])])
+             (PROG1 [\TEDIT.CHECK-BTREE (if TOBJ
+                                            then (TEXTOBJ TOBJ)
+                                          else (OR (AND (NEQ (GETATOMVAL 'TEXTOBJ)
+                                                             (EVALV 'TEXTOBJ))
+                                                        (TEXTOBJ (EVALV 'TEXTOBJ)
+                                                               T))
+                                                   (TEXTOBJ (WHICHW)
+                                                          T)
+                                                   (TEXTOBJ (EVALV 'LASTTESTSTREAM)
+                                                          T)
+                                                   (ERROR "NOT A TEXTOBJ"]
+                 (CL:WHEN PRINT (\TEDIT.BTVALIDATE.PRINT)))])])
 
-(BTVALIDATE.PRINT
+(\TEDIT.BTVALIDATE.PRINT
   [LAMBDA NIL                                                (* ; "Edited 30-May-2023 09:37 by rmk")
     (DECLARE (USEDFREE DEPTHHIST COUNTHIST NNODES NPIECES PLENHIST))
     (SETQ DEPTHHIST (SORT DEPTHHIST T))
@@ -944,46 +943,40 @@
            T "Maximum PLEN: " .I3 (CAAR (LAST PLENHIST))
            T])
 
-(CHECK-BTREE
-  [LAMBDA (TEXTOBJ EMBEDDED)                                 (* ; "Edited 21-Oct-2023 17:33 by rmk")
+(\TEDIT.CHECK-BTREE
+  [LAMBDA (TEXTOBJ EMBEDDED)                                 (* ; "Edited 17-Mar-2024 00:25 by rmk")
+                                                             (* ; "Edited 21-Oct-2023 17:33 by rmk")
                                                              (* ; "Edited  7-Sep-2022 09:43 by rmk")
                                                              (* ; "Edited  4-Sep-2022 16:37 by rmk")
     (SETQ TEXTOBJ (TEXTOBJ TEXTOBJ))
     (for BT (LASTPIECE _ (FGETTOBJ TEXTOBJ LASTPIECE)) inside (FGETTOBJ TEXTOBJ PCTB)
-       declare (SPECVARS LASTPIECE) do (CHECK-BTREE1 BT 0 NIL))
-    (for PC inpieces (\FIRSTPIECE TEXTOBJ) do (SELECTC (PTYPE PC)
-                                                  (FILE.PTYPES (CL:UNLESS (STREAMP (PCONTENTS PC))
-                                                                      (BTFAIL 
-                                                                        "File piece without a stream"
-                                                                             PC)))
-                                                  (STRING.PTYPES (CL:UNLESS (STRINGP (PCONTENTS
-                                                                                      PC))
-                                                                        (BTFAIL 
-                                                                      "String piece without a string"
-                                                                               PC)))
-                                                  (OBJECT.PTYPE (CL:UNLESS (IMAGEOBJP (PCONTENTS
-                                                                                       PC))
-                                                                       (BTFAIL 
-                                                                "Imageobject piece without an object"
-                                                                              PC)))
-                                                  NIL))
+       declare (SPECVARS LASTPIECE) do (\TEDIT.CHECK-BTREE1 BT 0 NIL))
+    (for PC inpieces (\TEDIT.FIRSTPIECE TEXTOBJ)
+       do (SELECTC (PTYPE PC)
+              (FILE.PTYPES (CL:UNLESS (STREAMP (PCONTENTS PC))
+                                  (\TEDIT.BTFAIL "File piece without a stream" PC)))
+              (STRING.PTYPES (CL:UNLESS (STRINGP (PCONTENTS PC))
+                                    (\TEDIT.BTFAIL "String piece without a string" PC)))
+              (OBJECT.PTYPE (CL:UNLESS (IMAGEOBJP (PCONTENTS PC))
+                                   (\TEDIT.BTFAIL "Imageobject piece without an object" PC)))
+              NIL))
     (CL:WHEN (AND (FGETTOBJ TEXTOBJ HINTPC)
                   (FGETTOBJ TEXTOBJ HINTPCSTARTCH#))
         (CL:UNLESS (IEQP (FGETTOBJ TEXTOBJ HINTPCSTARTCH#)
-                         (\PCTOCH (FGETTOBJ TEXTOBJ HINTPC)
+                         (\TEDIT.PCTOCH (FGETTOBJ TEXTOBJ HINTPC)
                                 TEXTOBJ))
-            (BTFAIL "HINTPC is not valid" (LIST (FGETTOBJ TEXTOBJ HINTPC)
-                                                (FGETTOBJ TEXTOBJ HINTPCSTARTCH#)
-                                                (\PCTOCH (FGETTOBJ TEXTOBJ HINTPC)
-                                                       TEXTOBJ)))))
+            (\TEDIT.BTFAIL "HINTPC is not valid" (LIST (FGETTOBJ TEXTOBJ HINTPC)
+                                                       (FGETTOBJ TEXTOBJ HINTPCSTARTCH#)
+                                                       (\TEDIT.PCTOCH (FGETTOBJ TEXTOBJ HINTPC)
+                                                              TEXTOBJ)))))
     (CL:WHEN TEXTOBJ
         (CL:UNLESS [IEQP (FGETTOBJ TEXTOBJ TEXTLEN)
                          (for BT inside (GETTOBJ TEXTOBJ PCTB)
                             sum (for S inslots BT sum (fetch (BTSLOT DLEN) of S]
-               (BTFAIL "TEXTLEN is inconsistent" TEXTOBJ)))
+               (\TEDIT.BTFAIL "TEXTLEN is inconsistent" TEXTOBJ)))
     'VALID])
 
-(CHECK-BTREE1
+(\TEDIT.CHECK-BTREE1
   [LAMBDA (NODE DEPTH PARENT)                                (* ; "Edited 31-Oct-2023 10:35 by rmk")
                                                              (* ; "Edited 30-May-2023 00:06 by rmk")
                                                              (* ; "Edited 27-May-2023 15:00 by rmk")
@@ -1000,25 +993,25 @@
         then [if (EQ NODE LASTPIECE)
                  then (CL:WHEN (AND (PREVPIECE LASTPIECE)
                                     (NEXTPIECE (PREVPIECE LASTPIECE)))
-                             (BTFAIL "(NEXT (PPREV of LASTPIECE is not NULL" LASTPIECE))
+                             (\TEDIT.BTFAIL "(NEXT (PPREV of LASTPIECE is not NULL" LASTPIECE))
                else (CL:UNLESS (IGEQ (PLEN NODE)
                                      0)
-                           (BTFAIL "Negative PLEN" NODE))
+                           (\TEDIT.BTFAIL "Negative PLEN" NODE))
                     (CL:UNLESS (OR (NEXTPIECE NODE)
                                    (EQ NODE (PREVPIECE LASTPIECE)))
-                           (BTFAIL "PIECE with no NEXT is not PREV of LASTPIECE" NODE))
+                           (\TEDIT.BTFAIL "PIECE with no NEXT is not PREV of LASTPIECE" NODE))
                     (CL:UNLESS (EQ PARENT (fetch (PIECE PTREENODE) of NODE))
-                           (BTFAIL "Piece with wrong PTREENODE" NODE))
+                           (\TEDIT.BTFAIL "Piece with wrong PTREENODE" NODE))
                     (CL:WHEN (PREVPIECE NODE)
                         (CL:UNLESS (OR (EQ NODE (NEXTPIECE (PREVPIECE NODE)))
                                        (AND (NULL (NEXTPIECE (PREVPIECE NODE)))
                                             (EQ NODE LASTPIECE)))
-                               (BTFAIL "PREVPIECE is not consistent" NODE)))
+                               (\TEDIT.BTFAIL "PREVPIECE is not consistent" NODE)))
                     (CL:WHEN (OR (NEXTPIECE NODE)
                                  LASTPIECE)
                         (CL:UNLESS (EQ NODE (PREVPIECE (OR (NEXTPIECE NODE)
                                                            LASTPIECE)))
-                               (BTFAIL "NEXTPIECE is not consistent" NODE)))]
+                               (\TEDIT.BTFAIL "NEXTPIECE is not consistent" NODE)))]
              (add NPIECES 1)
              (add [CDR (OR (SASSOC DEPTH DEPTHHIST)
                            (CAR (PUSH DEPTHHIST (CONS DEPTH 0]
@@ -1030,7 +1023,7 @@
                   1)
              (PLEN NODE)
       else (CL:UNLESS (EQ PARENT (fetch (BTREENODE UPWARD) of NODE))
-                  (BTFAIL "NODE with wrong UPWARD" NODE))
+                  (\TEDIT.BTFAIL "NODE with wrong UPWARD" NODE))
            (add NNODES 1)
            (add [CDR (OR (ASSOC (fetch (BTREENODE COUNT) of NODE)
                                 COUNTHIST)
@@ -1041,28 +1034,28 @@
               eachtime (SETQ S (\NTHSLOT NODE I)) unless [AND (NULL (fetch (BTSLOT DOWN) of S))
                                                               (MEMB (fetch (BTSLOT DLEN) of S)
                                                                     '(0 NIL]
-              do (BTFAIL "Upper node entries are not empty" NODE))
+              do (\TEDIT.BTFAIL "Upper node entries are not empty" NODE))
            (for S DLEN CHECKLEN inslots NODE sum (SETQ DLEN (fetch (BTSLOT DLEN) of S))
                                                  (CL:UNLESS (IGEQ DLEN 0)
-                                                        (BTFAIL "Negative DLEN" NODE))
+                                                        (\TEDIT.BTFAIL "Negative DLEN" NODE))
                                                  (CL:UNLESS (IEQP DLEN 0)
                                                              (* ; 
                                                    "Could be intermediate in \INSUREVACANT.BTREESLOT")
-                                                     (SETQ CHECKLEN (CHECK-BTREE1 (fetch (BTSLOT
-                                                                                          DOWN)
-                                                                                     of S)
-                                                                           DEPTH NODE))
+                                                     (SETQ CHECKLEN (\TEDIT.CHECK-BTREE1
+                                                                     (fetch (BTSLOT DOWN)
+                                                                        of S)
+                                                                     DEPTH NODE))
                                                      (CL:UNLESS (IEQP DLEN CHECKLEN)
-                                                         (BTFAIL "Mismatching DLEN"
+                                                         (\TEDIT.BTFAIL "Mismatching DLEN"
                                                                 (LIST NODE DLEN CHECKLEN))))
                                                  DLEN
               finally (CL:UNLESS (IEQP (fetch (BTREENODE TOTLEN) of NODE)
                                        $$VAL)
-                          (BTFAIL "Mismatching TOTLEN" (LIST NODE (fetch (BTREENODE TOTLEN)
-                                                                     of NODE)
-                                                             $$VAL)))])
+                          (\TEDIT.BTFAIL "Mismatching TOTLEN" (LIST NODE (fetch (BTREENODE TOTLEN)
+                                                                            of NODE)
+                                                                    $$VAL)))])
 
-(BTFAIL
+(\TEDIT.BTFAIL
   [LAMBDA (STRING VAL)
     (DECLARE (USEDFREE TAG MSG))                             (* ; "Edited 28-May-2023 08:45 by rmk")
     (HELP (CONCAT (OR TAG "")
@@ -1070,6 +1063,20 @@
                  (OR MSG "")
                  ": " STRING)
           VAL])
+
+(\TEDIT.MATCHPCS
+  [LAMBDA (NODE)                                             (* ; "Edited 16-Mar-2024 11:07 by rmk")
+                                                             (* ; "Edited 17-Aug-2022 19:03 by rmk")
+                                                             (* ; "Edited 15-Aug-2022 23:06 by rmk")
+                                                             (* ; "Edited  5-May-93 17:57 by jds")
+
+    (* ;; "Make sure that any downs pointed to by this node point back to this node.  This is for validity testing.")
+
+    (for S DOWN inslots NODE do (SETQ DOWN (ffetch (BTSLOT DOWN) of S))
+                                (if (type? PIECE DOWN)
+                                    then (freplace (PIECE PTREENODE) of DOWN with NODE)
+                                  elseif (type? BTREENODE DOWN)
+                                    then (freplace (BTREENODE UPWARD) of DOWN with NODE])
 )
 
 (RPAQ? BTVALIDATETAGS 'DONT)
@@ -1078,12 +1085,13 @@
 (GLOBALVARS BTVALIDATETAGS)
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (8515 53834 (\MAKEPCTB 8525 . 10070) (\UPDATEPCNODES 10072 . 12239) (\FIRSTPIECE 12241
- . 13149) (\DELETETREE 13151 . 16191) (\INSERTTREE 16193 . 18932) (\LASTPIECE 18934 . 19864) (
-\MATCHPCS 19866 . 20735) (\PCTOCH 20737 . 22828) (\CHTOPC 22830 . 28886) (\TEDIT.SET-TOTLEN 28888 . 
-29559) (\MAKE.VACANT.BTREESLOT 29561 . 36027) (\LINKNEWPIECE 36029 . 37516) (\UNLINKPIECE 37518 . 
-38123) (\SPLITPIECE 38125 . 42515) (\INSERTPIECE 42517 . 45505) (\INSERTPIECES 45507 . 48148) (
-\DELETEPIECES 48150 . 51961) (\ALIGNEDPIECE 51963 . 53832)) (53862 65274 (BTVALIDATE 53872 . 55322) (
-BTVALIDATE.PRINT 55324 . 56682) (CHECK-BTREE 56684 . 59560) (CHECK-BTREE1 59562 . 64997) (BTFAIL 64999
- . 65272)))))
+  (FILEMAP (NIL (8698 54531 (\TEDIT.MAKEPCTB 8708 . 10259) (\TEDIT.UPDATEPCNODES 10261 . 12555) (
+\TEDIT.FIRSTPIECE 12557 . 13471) (\TEDIT.DELETETREE 13473 . 16634) (\TEDIT.INSERTTREE 16636 . 19381) (
+\TEDIT.LASTPIECE 19383 . 20319) (\TEDIT.PCTOCH 20321 . 22418) (\TEDIT.CHTOPC 22420 . 28482) (
+\TEDIT.SET-TOTLEN 28484 . 29155) (\TEDIT.MAKE.VACANT.BTREESLOT 29157 . 35770) (\TEDIT.LINKNEWPIECE 
+35772 . 37265) (\TEDIT.UNLINKPIECE 37267 . 37878) (\TEDIT.SPLITPIECE 37880 . 42423) (
+\TEDIT.INSERTPIECE 42425 . 45578) (\TEDIT.INSERTPIECES 45580 . 48559) (\TEDIT.DELETEPIECES 48561 . 
+52525) (\TEDIT.ALIGNEDPIECE 52527 . 54529)) (54559 66494 (\TEDIT.BTVALIDATE 54569 . 56110) (
+\TEDIT.BTVALIDATE.PRINT 56112 . 57477) (\TEDIT.CHECK-BTREE 57479 . 59691) (\TEDIT.CHECK-BTREE1 59693
+ . 65193) (\TEDIT.BTFAIL 65195 . 65475) (\TEDIT.MATCHPCS 65477 . 66492)))))
 STOP
diff --git a/library/tedit/TEDIT-PCTREE.LCOM b/library/tedit/TEDIT-PCTREE.LCOM
index 07bb0ab2..f5b4ce06 100644
Binary files a/library/tedit/TEDIT-PCTREE.LCOM and b/library/tedit/TEDIT-PCTREE.LCOM differ
diff --git a/library/tedit/TEDIT-SCREEN b/library/tedit/TEDIT-SCREEN
index d8fd641a..f24afffd 100644
--- a/library/tedit/TEDIT-SCREEN
+++ b/library/tedit/TEDIT-SCREEN
@@ -1,17 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "14-Mar-2024 12:53:18" {WMEDLEY}<library>tedit>TEDIT-SCREEN.;618 186031 
+(FILECREATED "20-Mar-2024 11:07:35" {WMEDLEY}<library>tedit>TEDIT-SCREEN.;645 189050 
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS \FORMATLINE \TEDIT.CREATEPLINE)
-                  (I.S.OPRS inlines backlines incharslots backcharslots)
-                  (RECORDS THISLINE LINECACHE LINEDESCRIPTOR CHARSLOT)
-                  (MACROS GETLD FGETLD SETLD FSETLD SETYPOS LINKLD HCSCALE HCUNSCALE CHAR CHARW 
-                         PREVCHARSLOT PREVCHARSLOT! NEXTCHARSLOT FIRSTCHARSLOT NTHCHARSLOT 
-                         LASTCHARSLOT FILLCHARSLOT BACKCHARS PUSHCHAR POPCHAR CHARSLOTP DIACRITICP)
+      :CHANGES-TO (FNS \TEDIT.DISPLAYLINE \TEDIT.RAISE.LINES)
 
-      :PREVIOUS-DATE "13-Mar-2024 14:40:10" {WMEDLEY}<library>tedit>TEDIT-SCREEN.;613)
+      :PREVIOUS-DATE "20-Mar-2024 07:27:05" {WMEDLEY}<library>tedit>TEDIT-SCREEN.;644)
 
 
 (PRETTYCOMPRINT TEDIT-SCREENCOMS)
@@ -46,9 +41,10 @@
                (MACROS SPACEBREAK SAVEBREAK DOBREAK FORCEBREAK FORGETHYPHENBREAK FORGETPREVIOUSBREAK)
                (RECORDS PENDINGTAB))
         (INITRECORDS PENDINGTAB)
-        (FNS \FORMATLINE \FORMATLINE.SETUP \TEDIT.FORMATLINE.HORIZONTAL \TEDIT.FORMATLINE.VERTICAL 
-             \FORMATLINE.JUSTIFY \FORMATLINE.TABS \FORMATLINE.SCALETABS \FORMATLINE.PURGE.SPACES 
-             \FORMATLINE.EMPTY \FORMATLINE.UPDATELOOKS \FORMATLINE.LASTLEGAL \FORMATBLOCK)
+        (FNS \TEDIT.FORMATLINE \TEDIT.FORMATLINE.SETUP \TEDIT.FORMATLINE.HORIZONTAL 
+             \TEDIT.FORMATLINE.VERTICAL \TEDIT.FORMATLINE.JUSTIFY \TEDIT.FORMATLINE.TABS 
+             \TEDIT.FORMATLINE.SCALETABS \TEDIT.FORMATLINE.PURGE.SPACES \TEDIT.FORMATLINE.EMPTY 
+             \TEDIT.FORMATLINE.UPDATELOOKS \TEDIT.FORMATLINE.LASTLEGAL \TEDIT.LINES.ABOVE)
         (INITVARS (TEDIT.LINELEADING.BELOW NIL))
         (GLOBALVARS TEDIT.LINELEADING.BELOW)
         (FNS \CLEARTHISLINE \TLVALIDATE)
@@ -56,18 +52,18 @@
         (INITVARS *TEDIT-CACHED-FMTSPEC*)
                                                              (* ; "Heuristic for \FORMATLINE")
         (GLOBALVARS *TEDIT-CACHED-FMTSPEC*)
-        (FNS \DISPLAYLINE \DISPLAYLINE.TABS \TEDIT.LINECACHE \TEDIT.CREATE.LINECACHE \TEDIT.BLTCHAR 
-             \TEDIT.DIACRITIC.SHIFT)
+        (FNS \TEDIT.DISPLAYLINE \TEDIT.DISPLAYLINE.TABS \TEDIT.LINECACHE \TEDIT.CREATE.LINECACHE 
+             \TEDIT.BLTCHAR \TEDIT.DIACRITIC.SHIFT)
         (DECLARE%: EVAL@COMPILE DONTCOPY 
 
                (* ;; "Machine independent version of \TEDIT.BLTCHAR")
 
                (MACROS MI-TEDIT.BLTCHAR))
-        (FNS TEDIT.UPDATE.SCREEN \BACKFORMAT \TEDIT.PREVIOUS.LINEBREAK \FILLPANE \TEDIT.UPDATE.LINES
-             \TEDIT.CREATEPLINE \TEDIT.FIND.DIRTYCHARS \TEDIT.FORMATLINES \FORMAT.GAP.LINES 
-             \TEDIT.LOWER.LINES \TEDIT.RAISE.LINES \TEDIT.VALID.LINES \TEDIT.CLEARPANE.BELOW.LINE 
-             \TEDIT.INSERTLINE \TEDIT.INSURE.TRAILING.LINE \TEDIT.MARK.LINES.DIRTY \TEDIT.LINE.BOTTOM
-             \TEDIT.NCONC.LINES)))
+        (FNS \TEDIT.UPDATE.SCREEN \TEDIT.BACKFORMAT \TEDIT.PREVIOUS.LINEBREAK \TEDIT.FILLPANE 
+             \TEDIT.UPDATE.LINES \TEDIT.CREATEPLINE \TEDIT.FIND.DIRTYCHARS \TEDIT.LINES.BELOW 
+             \FORMAT.GAP.LINES \TEDIT.LOWER.LINES \TEDIT.RAISE.LINES \TEDIT.VALID.LINES 
+             \TEDIT.CLEARPANE.BELOW.LINE \TEDIT.INSERTLINE \TEDIT.INSURE.TRAILING.LINE 
+             \TEDIT.MARK.LINES.DIRTY \TEDIT.LINE.BOTTOM \TEDIT.NCONC.LINES)))
 (DECLARE%: EVAL@COMPILE DONTCOPY 
 (* "FOLLOWING DEFINITIONS EXPORTED")(DECLARE%: EVAL@COMPILE
 
@@ -550,16 +546,14 @@
                          (COND
                             ((AND SPACERUN FIRSTWHITESLOT)   (* ; "Clear/register the overhangs")
                              (CL:WHEN PREVSP
-                                 (SETQ PREVSP (\FORMATLINE.PURGE.SPACES PREVSP (fetch (CHARSLOT
-                                                                                       CHAR)
-                                                                                  of FIRSTWHITESLOT))
-                                  ))
+                                 (SETQ PREVSP (\TEDIT.FORMATLINE.PURGE.SPACES PREVSP
+                                                     (fetch (CHARSLOT CHAR) of FIRSTWHITESLOT))))
                              (SETQ SPACELEFT (IDIFFERENCE WIDTH FIRSTWHITEX))
                              (SETQ OVERHANG (IDIFFERENCE TX FIRSTWHITEX)))
                             (T (SETQ SPACELEFT (IDIFFERENCE WIDTH TX))
                                (SETQ OVERHANG 0])
 
-(PUTPROPS FORCEBREAK MACRO [NIL (SETQ PREVSP (\FORMATLINE.PURGE.SPACES PREVSP))
+(PUTPROPS FORCEBREAK MACRO [NIL (SETQ PREVSP (\TEDIT.FORMATLINE.PURGE.SPACES PREVSP))
                                                              (* ; "All spaces are natural")
 
                                 (* ;; "If the EOL comes right after a word-character that was preceded by a space run, those earlier spaces don't count in our overhang.  INSPACES tracks that. ")
@@ -619,8 +613,10 @@
        '12)
 (DEFINEQ
 
-(\FORMATLINE
+(\TEDIT.FORMATLINE
   [LAMBDA (TEXTOBJ CH#1 LINE REGION IMAGESTREAM FORMATTINGSTATE)
+                                                             (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 19:43 by rmk")
                                                              (* ; "Edited 14-Mar-2024 12:53 by rmk")
                                                              (* ; "Edited  2-Mar-2024 07:39 by rmk")
                                                              (* ; "Edited  5-Feb-2024 09:35 by rmk")
@@ -735,7 +731,7 @@
 
      (* ;; "")
 
-          (SETQ PC (\CHTOPC CH#1 TEXTOBJ T))
+          (SETQ PC (\TEDIT.CHTOPC CH#1 TEXTOBJ T))
           (CL:WHEN (OR (NULL PC)
                        (EQ PC (FGETTOBJ TEXTOBJ LASTPIECE)))
 
@@ -751,12 +747,12 @@
 
           (CL:UNLESS (VISIBLEPIECEP PC)
               (CL:UNLESS (SETQ PC (\NEXT.VISIBLE.PIECE PC))
-                  (RETURN (\FORMATLINE.EMPTY TEXTOBJ CH#1 LINE)))
-              (SETQ CH#1 (\PCTOCH PC TEXTOBJ))               (* ; 
+                  (RETURN (\TEDIT.FORMATLINE.EMPTY TEXTOBJ CH#1 LINE)))
+              (SETQ CH#1 (\TEDIT.PCTOCH PC TEXTOBJ))         (* ; 
                                                      "Unusual, simpler than keeping track on the fly")
               (SETQ START-OF-PIECE CH#1))
           (SETQ CHNO CH#1)
-          (SETQ IMAGESTREAM (\FORMATLINE.SETUP TEXTOBJ PC LINE IMAGESTREAM))
+          (SETQ IMAGESTREAM (\TEDIT.FORMATLINE.SETUP TEXTOBJ PC LINE IMAGESTREAM))
           (SETQ FMTSPEC (FGETLD LINE LFMTSPEC))
 
      (* ;; "Display stream could have switched for hardcopy font widths.")
@@ -790,7 +786,7 @@
           (CL:WHEN (EQ LINETYPE 'HARDCOPYDISPLAY)            (* ; "Scale points up to hardcopy")
               (SETQ LX1 (HCSCALE SCALE LX1))
               (SETQ WIDTH (HCSCALE SCALE WIDTH))
-              (SETQ TABSPEC (\FORMATLINE.SCALETABS TABSPEC SCALE)))
+              (SETQ TABSPEC (\TEDIT.FORMATLINE.SCALETABS TABSPEC SCALE)))
 
      (* ;; "")
 
@@ -798,7 +794,8 @@
 
      (* ;; "The LOOKSUPDATEFN will initialize the character looks of the starting piece PC. It is also called at piece boundaries to reset the character-looks variables when BIN (=\TEXTBIN) moves from piece to piece.")
 
-          (freplace (TEXTSTREAM LOOKSUPDATEFN) of TSTREAM with (FUNCTION \FORMATLINE.UPDATELOOKS))
+          (freplace (TEXTSTREAM LOOKSUPDATEFN) of TSTREAM with (FUNCTION 
+                                                                \TEDIT.FORMATLINE.UPDATELOOKS))
           (freplace (TEXTSTREAM CURRENTLOOKS) of TSTREAM with NIL)
           (SETQ CHARSLOT (FIRSTCHARSLOT THISLINE))
           (\TEDIT.INSTALL.PIECE TSTREAM PC (- CH#1 START-OF-PIECE))
@@ -921,14 +918,14 @@
                           (* ;; "Remove all prior candidate break points and expandable spaces")
 
                           (FORGETPREVIOUSBREAK)
-                          (SETQ PREVSP (\FORMATLINE.PURGE.SPACES PREVSP))
+                          (SETQ PREVSP (\TEDIT.FORMATLINE.PURGE.SPACES PREVSP))
 
                           (* ;; "Now for this tab:")
                                                              (* ; 
                                                        "Start with 0 width, then set up the next tab")
                           (FILLCHARSLOT CHARSLOT CH 0)
-                          (SETQ TABPENDING (\FORMATLINE.TABS TEXTOBJ TABSPEC SCALE CHARSLOT LX1 TX 
-                                                  TABPENDING))
+                          (SETQ TABPENDING (\TEDIT.FORMATLINE.TABS TEXTOBJ TABSPEC SCALE CHARSLOT LX1
+                                                  TX TABPENDING))
                                                              (* ; 
                                                              "Proper width is already in CHARSLOT")
                           (SETQ DX (CL:IF (FIXP TABPENDING)
@@ -995,7 +992,7 @@
 
                                  (* ;; "We've seen at least one real character, line is not empty, but no good candidate break point. Back up to the last legal break (or add a real hyphenator). ")
 
-                                    (CL:UNLESS (\FORMATLINE.LASTLEGAL)
+                                    (CL:UNLESS (\TEDIT.FORMATLINE.LASTLEGAL)
 
                                         (* ;; "Didn't find one, the offender protrudes on this line")
 
@@ -1024,8 +1021,8 @@
                                               DX)            (* ; 
                "Adjust the tab stop's X value so that the LEFT edge of the decimal point goes there.")
                                          (SETQ TABPENDING
-                                          (\FORMATLINE.TABS TEXTOBJ TABSPEC SCALE CHARSLOT LX1 TX 
-                                                 TABPENDING T))
+                                          (\TEDIT.FORMATLINE.TABS TEXTOBJ TABSPEC SCALE CHARSLOT LX1
+                                                 TX TABPENDING T))
                                                              (* ; 
                                                     "Tab over to the LEFT side of the decimal point.")
                                          (add TX (CL:IF (FIXP TABPENDING)
@@ -1033,7 +1030,7 @@
                                                      (fetch (PENDINGTAB PTRESOLVEDWIDTH) of 
                                                                                            TABPENDING
                                                             )))
-                                         (SETQ PREVSP (\FORMATLINE.PURGE.SPACES PREVSP))
+                                         (SETQ PREVSP (\TEDIT.FORMATLINE.PURGE.SPACES PREVSP))
                                                              (* ; 
                                         "Spaces before a tab don't take part in later justification.")
                                          (SAVEBREAK)))
@@ -1099,9 +1096,10 @@
      (* ;; "Fix up last tab?")
 
           (CL:WHEN TABPENDING
-              (SETQ PREVSP (\FORMATLINE.PURGE.SPACES PREVSP))(* ; "Don't justify spaces before tabs")
-              (add TX (\FORMATLINE.TABS TEXTOBJ TABSPEC SCALE (FETCH (PENDINGTAB PTCHARSLOT)
-                                                                 OF TABPENDING)
+              (SETQ PREVSP (\TEDIT.FORMATLINE.PURGE.SPACES PREVSP))
+                                                             (* ; "Don't justify spaces before tabs")
+              (add TX (\TEDIT.FORMATLINE.TABS TEXTOBJ TABSPEC SCALE (FETCH (PENDINGTAB PTCHARSLOT)
+                                                                       OF TABPENDING)
                              LX1
                              (IDIFFERENCE TX OVERHANG)
                              TABPENDING T)))
@@ -1117,7 +1115,7 @@
                                                             "Still maybe scaled for hardcopy display")
           (FSETLD LINE LXLIM (IPLUS LX1 TX))
           (FSETLD LINE 1STLN 1STLN)                          (* ; "First line of a paragraph")
-          [FSETLD LINE LSTLN (AND FORCED-END (PPARALAST (\CHTOPC CHNO TEXTOBJ]
+          [FSETLD LINE LSTLN (AND FORCED-END (PPARALAST (\TEDIT.CHTOPC CHNO TEXTOBJ]
                                                              (* ; "Last line of a paragraph")
 
      (* ;; "For display, the value of LMARK (GREY) just causes the little grey box to show up in the left margin, but is not interpreted in any other way. The hardcopy code uses this field for other purposes.")
@@ -1184,7 +1182,7 @@
                WMARGIN)
           (RETURN LINE])
 
-(\FORMATLINE.SETUP
+(\TEDIT.FORMATLINE.SETUP
   [LAMBDA (TEXTOBJ PC LINE IMAGESTREAM)                      (* ; "Edited 16-Dec-2023 23:34 by rmk")
                                                              (* ; "Edited 14-Jun-2023 16:43 by rmk")
                                                              (* ; "Edited  8-Mar-2023 22:15 by rmk")
@@ -1232,7 +1230,8 @@
          IMAGESTREAM])
 
 (\TEDIT.FORMATLINE.HORIZONTAL
-  [LAMBDA (LINE THISLINE PREVSP SPACELEFT OVERHANG LINETYPE) (* ; "Edited  3-Dec-2023 16:49 by rmk")
+  [LAMBDA (LINE THISLINE PREVSP SPACELEFT OVERHANG LINETYPE) (* ; "Edited 15-Mar-2024 19:35 by rmk")
+                                                             (* ; "Edited  3-Dec-2023 16:49 by rmk")
                                                              (* ; "Edited 29-Oct-2023 18:24 by rmk")
                                                              (* ; "Edited  2-Jul-2023 15:15 by rmk")
                                                              (* ; "Edited  6-Apr-2023 10:13 by rmk")
@@ -1261,8 +1260,8 @@
 
           (freplace (THISLINE TLSPACEFACTOR) of THISLINE with 1)
           (CL:WHEN (EQ 'JUSTIFIED (fetch (FMTSPEC QUAD) of FMTSPEC))
-                 (\FORMATLINE.JUSTIFY LINE THISLINE PREVSP SPACELEFT LINETYPE))
-          (\FORMATLINE.PURGE.SPACES PREVSP)
+                 (\TEDIT.FORMATLINE.JUSTIFY LINE THISLINE PREVSP SPACELEFT LINETYPE))
+          (\TEDIT.FORMATLINE.PURGE.SPACES PREVSP)
 
           (* ;; "")
 
@@ -1301,7 +1300,8 @@
               NIL])
 
 (\TEDIT.FORMATLINE.VERTICAL
-  [LAMBDA (LINE TEXTOBJ)                                     (* ; "Edited 17-Dec-2023 00:43 by rmk")
+  [LAMBDA (LINE TEXTOBJ)                                     (* ; "Edited 20-Mar-2024 07:26 by rmk")
+                                                             (* ; "Edited 17-Dec-2023 00:43 by rmk")
                                                              (* ; "Edited  6-Dec-2023 20:13 by rmk")
                                                              (* ; "Edited  4-Dec-2023 12:13 by rmk")
 
@@ -1317,7 +1317,7 @@
          (CL:WHEN (FGETLD LINE LSTLN)                        (* ; "Set post-paragraph leading")
              (add DESCENT (ffetch (FMTSPEC LEADAFTER) of FMTSPEC)))
 
-         (* ;; "Documentation says that lineleading goes above, which automatically makes for reasonable selection marking.  It went below in the original implementation, selections are very odd if lineleading is big.")
+         (* ;; "Documentation says that lineleading goes above, which automatically makes for reasonable selection marking.  It went below in the original implementation, selections were very odd for large line leadings.  This flag is set to T when recently created files are loaded, we try to preserve the old (bad) behavior for older files.")
 
          (CL:IF (FGETTOBJ TEXTOBJ TXTLINELEADINGABOVE)
              (add ASCENT (fetch (FMTSPEC LINELEAD) of FMTSPEC))
@@ -1326,7 +1326,7 @@
          (FSETLD LINE DESCENT DESCENT)
          (FSETLD LINE LHEIGHT (IPLUS ASCENT DESCENT])
 
-(\FORMATLINE.JUSTIFY
+(\TEDIT.FORMATLINE.JUSTIFY
   [LAMBDA (LINE THISLINE PREVSP SPACELEFT LINETYPE)          (* ; "Edited  7-Mar-2023 18:01 by rmk")
                                                              (* ; "Edited  2-Mar-2023 22:45 by rmk")
                                                              (* ; "Edited 22-Oct-2022 00:06 by rmk")
@@ -1401,7 +1401,7 @@
                                                                                    SPACELEFT)
                                                                         NATURALWIDTHS))))])
 
-(\FORMATLINE.TABS
+(\TEDIT.FORMATLINE.TABS
   [LAMBDA (TEXTOBJ TABSPEC SCALE CHARSLOT LX1 TX PRIORTAB CLEANINGUP)
                                                              (* ; "Edited 17-Dec-2023 12:46 by rmk")
                                                              (* ; "Edited  9-Mar-2023 23:25 by rmk")
@@ -1505,7 +1505,7 @@
                                 PTCHARSLOT _ CHARSLOT
                                 PTOLDTX _ TX])
 
-(\FORMATLINE.SCALETABS
+(\TEDIT.FORMATLINE.SCALETABS
   [LAMBDA (TABSPEC SCALE)                                    (* ; "Edited  7-Mar-2023 21:06 by rmk")
                                                              (* ; "Edited  5-Mar-2023 20:39 by rmk")
 
@@ -1523,7 +1523,7 @@
                                                                             (fetch (TAB TABX)
                                                                                of TAB])
 
-(\FORMATLINE.PURGE.SPACES
+(\TEDIT.FORMATLINE.PURGE.SPACES
   [LAMBDA (PREVSP UNTILSP)                                   (* ; "Edited 29-Oct-2023 19:11 by rmk")
                                                              (* ; "Edited 21-Mar-2023 11:28 by rmk")
                                                              (* ; "Edited 10-Mar-2023 12:28 by rmk")
@@ -1541,8 +1541,9 @@
                                                       with (CHARCODE SPACE))))
     PREVSP])
 
-(\FORMATLINE.EMPTY
-  [LAMBDA (TEXTOBJ CH#1 LINE)                                (* ; "Edited 26-Jan-2024 11:08 by rmk")
+(\TEDIT.FORMATLINE.EMPTY
+  [LAMBDA (TEXTOBJ CH#1 LINE)                                (* ; "Edited 15-Mar-2024 22:00 by rmk")
+                                                             (* ; "Edited 26-Jan-2024 11:08 by rmk")
                                                              (* ; "Edited  6-Dec-2023 20:15 by rmk")
                                                              (* ; "Edited  3-Dec-2023 19:41 by rmk")
                                                              (* ; "Edited 26-Sep-2023 17:32 by rmk")
@@ -1565,8 +1566,8 @@
                           YBOT _ (SUB1 (FGETTOBJ TEXTOBJ WBOTTOM])
     (\DTEST LINE 'LINEDESCRIPTOR)
     (LET (CHARSLOT FONT TRUEASCENT TRUEDESCENT LM FMTSPEC (THISLINE (FGETTOBJ TEXTOBJ THISLINE)))
-         (\FORMATLINE.SETUP TEXTOBJ NIL LINE (WINDOWPROP (CAR (FGETTOBJ TEXTOBJ \WINDOW))
-                                                    'DSP))
+         (\TEDIT.FORMATLINE.SETUP TEXTOBJ NIL LINE (WINDOWPROP (CAR (FGETTOBJ TEXTOBJ \WINDOW))
+                                                          'DSP))
          (SETQ FMTSPEC (FGETLD LINE LFMTSPEC))
          (SETQ CHARSLOT (FIRSTCHARSLOT THISLINE))
          (replace (THISLINE NEXTAVAILABLECHARSLOT) of THISLINE with (NEXTCHARSLOT CHARSLOT))
@@ -1618,8 +1619,10 @@
          (\TEDIT.FORMATLINE.HORIZONTAL LINE THISLINE NIL 0 0)
          LINE])
 
-(\FORMATLINE.UPDATELOOKS
-  [LAMBDA (TSTREAM PC)                                       (* ; "Edited 24-Dec-2023 22:54 by rmk")
+(\TEDIT.FORMATLINE.UPDATELOOKS
+  [LAMBDA (TSTREAM PC)                                       (* ; "Edited 17-Mar-2024 11:08 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 19:34 by rmk")
+                                                             (* ; "Edited 24-Dec-2023 22:54 by rmk")
                                                              (* ; "Edited 23-Dec-2023 20:37 by rmk")
                                                              (* ; "Edited 22-Aug-2023 16:46 by rmk")
                                                              (* ; "Edited 24-Jul-2023 16:39 by rmk")
@@ -1638,7 +1641,7 @@
                     UNBREAKABLE))
     (CL:UNLESS PC                                            (* ; 
                                                           "Ran off the end ? Skips the ENDOFSTREAMOP")
-        (RETFROM (FUNCTION \TEXTBIN)
+        (RETFROM (FUNCTION \TEDIT.TEXTBIN)
                NIL))
     (LET (PLOOKS INVISIBLERUN SCALE CLOFFSET)
 
@@ -1706,12 +1709,13 @@
                       (SETQ FMTSPEC (PPARALOOKS PC))
                       (SETQ TABSPEC (ffetch (FMTSPEC TABSPEC) of FMTSPEC))
                       (CL:WHEN (EQ LINETYPE 'TRUEHARDCOPY)
-                          (SETQ TABSPEC (\FORMATLINE.SCALETABS TABSPEC (DSPSCALE NIL IMAGESTREAM)))))
+                          (SETQ TABSPEC (\TEDIT.FORMATLINE.SCALETABS TABSPEC (DSPSCALE NIL 
+                                                                                    IMAGESTREAM)))))
            else (add CHNO INVISIBLERUN)
                 (\TEDIT.INSTALL.PIECE TSTREAM PC 0))
          PC])
 
-(\FORMATLINE.LASTLEGAL
+(\TEDIT.FORMATLINE.LASTLEGAL
   [LAMBDA NIL                                                (* ; "Edited  1-Feb-2024 16:51 by rmk")
                                                              (* ; "Edited  2-Jul-2023 14:39 by rmk")
                                                              (* ; "Edited 17-Mar-2023 05:36 by rmk")
@@ -1763,8 +1767,9 @@
                 repeatuntil (EQ CHARSLOT BESTSLOT))
              T)])
 
-(\FORMATBLOCK
-  [LAMBDA (TEXTOBJ CHN YBOTN)                                (* ; "Edited  5-Apr-2023 09:13 by rmk")
+(\TEDIT.LINES.ABOVE
+  [LAMBDA (TEXTOBJ CHN YBOTN)                                (* ; "Edited 15-Mar-2024 19:22 by rmk")
+                                                             (* ; "Edited  5-Apr-2023 09:13 by rmk")
                                                              (* ; "Edited  1-Apr-2023 12:02 by rmk")
                                                              (* ; "Edited 30-May-91 23:02 by jds")
 
@@ -1776,11 +1781,11 @@
         (SETQ CHN (TEXTLEN TEXTOBJ)))
     (CL:UNLESS YBOTN (SETQ YBOTN 0))
     (bind L1 LN LINE HEIGHT (CHNO _ (\TEDIT.PREVIOUS.LINEBREAK TEXTOBJ CHN))
-       first (SETQ L1 (\FORMATLINE TEXTOBJ CHNO))            (* ; 
+       first (SETQ L1 (\TEDIT.FORMATLINE TEXTOBJ CHNO))      (* ; 
                                                              "CHNO is the first char of the top line")
              (SETQ LN L1)
              (SETQ CHNO (ADD1 (GETLD L1 LCHARLIM))) until (IGREATERP CHNO CHN)
-       do (SETQ LINE (\FORMATLINE TEXTOBJ CHNO))             (* ; 
+       do (SETQ LINE (\TEDIT.FORMATLINE TEXTOBJ CHNO))       (* ; 
                                                  "The line immediately after a preceding known break")
           (LINKLD LN LINE)
           (SETQ LN LINE)
@@ -1815,9 +1820,10 @@
     THISLINE])
 
 (\TLVALIDATE
-  [LAMBDA (THISLINE)                                         (* ; "Edited  7-Nov-2022 10:16 by rmk")
+  [LAMBDA (THISLINE)                                         (* ; "Edited 15-Mar-2024 19:33 by rmk")
+                                                             (* ; "Edited  7-Nov-2022 10:16 by rmk")
 
-    (* ;; "Check validity of THISLINE, either just before or anytime after \FORMATLINE.JUSTIFY")
+    (* ;; "Check validity of THISLINE, either just before or anytime after \TEDIT.FORMATLINE.JUSTIFY")
 
     [with THISLINE THISLINE (CL:WHEN (EQ DESC 'NODESC)
                                    (HELP "INVALID THISLINE" DESC))
@@ -1859,8 +1865,10 @@
 )
 (DEFINEQ
 
-(\DISPLAYLINE
-  [LAMBDA (TEXTOBJ LINE PANE)                                (* ; "Edited 24-Dec-2023 22:05 by rmk")
+(\TEDIT.DISPLAYLINE
+  [LAMBDA (TEXTOBJ LINE PANE)                                (* ; "Edited 20-Mar-2024 10:57 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 22:04 by rmk")
+                                                             (* ; "Edited 24-Dec-2023 22:05 by rmk")
                                                              (* ; "Edited  2-Dec-2023 11:34 by rmk")
                                                              (* ; "Edited 20-Nov-2023 13:57 by rmk")
                                                              (* ; "Edited 28-Oct-2023 23:57 by rmk")
@@ -1877,7 +1885,7 @@
 
     (* ;; "Validate the incoming arguments so ffetch can be used consistently for all their field extractions.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (\DTEST LINE 'LINEDESCRIPTOR)
     (LET ((WINDOWDS (WINDOWPROP (FGETPANE PANE PWINDOW)
                            'DSP))
@@ -1920,7 +1928,7 @@
              (CL:UNLESS (EQ LINE (fetch (THISLINE DESC) of THISLINE))
                                                              (* ; 
                                                             "No image cache -- re-format and display")
-                 (\FORMATLINE TEXTOBJ (FGETLD LINE LCHAR1)
+                 (\TEDIT.FORMATLINE TEXTOBJ (FGETLD LINE LCHAR1)
                         LINE))
              (MOVETO (FGETLD LINE LX1)
                     (FGETLD LINE DESCENT)
@@ -1959,7 +1967,7 @@
 
                                  (* ;; "Not just white space, have to fill in with dots.")
 
-                                 (\DISPLAYLINE.TABS CHARW DS TX TERMSA LINE CLOOKS DISPLAYDATA 
+                                 (\TEDIT.DISPLAYLINE.TABS CHARW DS TX TERMSA LINE CLOOKS DISPLAYDATA
                                         DDPILOTBBT CLIPRIGHT TEXTOBJ))
                              (add TX CHARW))
                         (NIL                                 (* ; 
@@ -2037,7 +2045,7 @@
          (FSETLD LINE LDIRTY NIL)
          LINE])
 
-(\DISPLAYLINE.TABS
+(\TEDIT.DISPLAYLINE.TABS
   [LAMBDA (CW DS TX TERMSA LINE CLOOKS DISPLAYDATA DDPILOTBBT CLIPRIGHT TEXTOBJ)
                                                              (* ; "Edited 10-Oct-2023 23:29 by rmk")
                                                              (* ; "Edited  4-Oct-2023 21:16 by rmk")
@@ -2100,22 +2108,19 @@
           (RETURN CACHES])
 
 (\TEDIT.BLTCHAR
-  [LAMBDA (CHARCODE DISPLAYSTREAM CURX DISPLAYDATA DDPILOTBBT CLIPRIGHT)
+  [LAMBDA (CHARCODE DISPLAYSTREAM CURX DISPLAYDATA DDPILOTBBT CLIPRIGHT)
+                                                             (* ; "Edited 15-Mar-2024 14:39 by rmk")
                                                              (* jds " 9-Jan-86 17:14")
 
-         (* Version of BLTCHAR peculiar to TEdit --
-         relies on \DISPLAYLINE to make sure things keep working right.)
+    (* ;; "Version of BLTCHAR peculiar to TEdit -- relies on \TEDIT.DISPLAYLINE to make sure things keep working right.")
 
-         (* puts a character on a guaranteed display stream.
-         Much of the information needed by the BitBlt microcode is prestored by the 
-         routines that change it. This is kept in the BitBltTable.)
-                                                             (* knows about the representation of 
-                                                             display stream image data)
-                                                             (* MUST NOT POINT AT A WINDOW'S 
-                                                             DISPLAYSTREAM!!!)
+    (* ;; "puts a character on a guaranteed display stream.  Much of the information needed by the BitBlt microcode is prestored by the routines that change it.  This is kept in the BitBltTable.")
+                                                             (* ; 
+                                        "knows about the representation of display stream image data")
+                                                             (* ; 
+                                                      "MUST NOT POINT AT A WINDOW'S DISPLAYSTREAM!!!")
 
-         (* ASSUMES THAT WE NEVER WANT TO PRINT TO THE LEFT OF ORIGIN 0 ON THE LINE CACHE 
-         BITMAP, OR THAT IF WE DO, ALL BETS ARE OFF)
+    (* ;; "ASSUMES THAT WE NEVER WANT TO PRINT TO THE LEFT OF ORIGIN 0 ON THE LINE CACHE BITMAP, OR THAT IF WE DO, ALL BETS ARE OFF")
 
     (DECLARE (LOCALVARS . T))
     (PROG (NEWX LEFT RIGHT IMAGEWIDTH (CHAR8CODE (\CHAR8CODE CHARCODE)))
@@ -2129,11 +2134,12 @@
           (SETQ LEFT (IMAX 0 CURX))
           (SETQ RIGHT (IMIN CLIPRIGHT NEWX))
           (COND
-             ((ILESSP LEFT RIGHT)                            (* Only print anything if there is a 
-                                                             place to put it)
+             ((ILESSP LEFT RIGHT)                            (* ; 
+                                                  "Only print anything if there is a place to put it")
               (UNINTERRUPTABLY
                   (freplace PBTDESTBIT of DDPILOTBBT with LEFT)
-                                                             (* Set up the bitblt-table source left)
+                                                             (* ; 
+                                                             "Set up the bitblt-table source left")
                   (freplace PBTWIDTH of DDPILOTBBT with (IMIN IMAGEWIDTH (IDIFFERENCE RIGHT LEFT)))
                   (freplace PBTSOURCEBIT of DDPILOTBBT with (\GETBASE (fetch DDOFFSETSCACHE
                                                                          of DISPLAYDATA)
@@ -2165,8 +2171,9 @@
 )
 (DEFINEQ
 
-(TEDIT.UPDATE.SCREEN
-  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 16-Dec-2023 23:52 by rmk")
+(\TEDIT.UPDATE.SCREEN
+  [LAMBDA (TEXTOBJ)                                          (* ; "Edited 15-Mar-2024 22:00 by rmk")
+                                                             (* ; "Edited 16-Dec-2023 23:52 by rmk")
                                                              (* ; "Edited 12-Oct-2023 15:27 by rmk")
                                                              (* ; "Edited 17-Sep-2023 11:50 by rmk")
                                                              (* ; "Edited 22-May-2023 22:19 by rmk")
@@ -2181,12 +2188,15 @@
 
                       (\TEDIT.UPDATE.LINES TEXTOBJ 'APPEARANCE (CAR DIRTYCHARS)
                              (CDR DIRTYCHARS))
-               else (for PANE inpanes TEXTOBJ do (\FILLPANE (fetch (TEXTWINDOW PLINES) of PANE)
+               else (for PANE inpanes TEXTOBJ do (\TEDIT.FILLPANE (fetch (TEXTWINDOW PLINES)
+                                                                     of PANE)
                                                         TEXTOBJ PANE]
         (FSETTOBJ TEXTOBJ TXTNEEDSUPDATE NIL))])
 
-(\BACKFORMAT
-  [LAMBDA (TEXTOBJ DY CH1 HEIGHT)                            (* ; "Edited 30-Nov-2023 21:16 by rmk")
+(\TEDIT.BACKFORMAT
+  [LAMBDA (TEXTOBJ DY CH1 HEIGHT)                            (* ; "Edited 20-Mar-2024 06:46 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 19:44 by rmk")
+                                                             (* ; "Edited 30-Nov-2023 21:16 by rmk")
                                                              (* ; "Edited  3-Nov-2023 12:02 by rmk")
                                                              (* ; "Edited  6-Apr-2023 16:46 by rmk")
                                                              (* ; "Edited  5-Apr-2023 09:13 by rmk")
@@ -2199,7 +2209,8 @@
     (* ;; "This computes block by block, where the first line of a block either starts a paragraph or comes immediately after a forced break.")
 
     (bind L1 PAIR (CHNO _ CH1) until (IGREATERP HEIGHT DY) while (IGEQ CHNO 1)
-       do (SETQ PAIR (\FORMATBLOCK TEXTOBJ CHNO HEIGHT))     (* ; "The block may go beyond DY")
+       do (SETQ PAIR (\TEDIT.LINES.ABOVE TEXTOBJ CHNO HEIGHT)) 
+                                                             (* ; "The block may go beyond DY")
           (LINKLD (CADR PAIR)
                  L1)                                         (* ; 
                                                              "This block's LN links to previous L1")
@@ -2211,7 +2222,8 @@
                                                        DY])
 
 (\TEDIT.PREVIOUS.LINEBREAK
-  [LAMBDA (TEXTOBJ CHNO)                                     (* ; "Edited 11-Dec-2023 21:59 by rmk")
+  [LAMBDA (TEXTOBJ CHNO)                                     (* ; "Edited 17-Mar-2024 12:05 by rmk")
+                                                             (* ; "Edited 11-Dec-2023 21:59 by rmk")
                                                              (* ; "Edited 16-Oct-2023 23:19 by rmk")
                                                              (* ; "Edited 31-Mar-2023 17:44 by rmk")
                                                              (* ; "Edited 28-Mar-2023 09:03 by rmk")
@@ -2233,10 +2245,10 @@
                (SETQ CHNO (FGETTOBJ TEXTOBJ TEXTLEN)))
            (LET ((TSTREAM (FGETTOBJ TEXTOBJ STREAMHINT))
                  NCHARS)
-                (\TEXTSETFILEPTR TSTREAM (SUB1 CHNO))        (* ; 
+                (\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 CHNO))  (* ; 
                                  "Start at (SUB1 CHNO) because fileptrs are one back from characters")
                 [SETQ NCHARS (find I from 1
-                                suchthat (MEMB (\TEXTBACKFILEPTR TSTREAM)
+                                suchthat (MEMB (\TEDIT.TEXTBACKFILEPTR TSTREAM)
                                                (CHARCODE (EOL FORM %#EOL Meta,EOL CR LF NIL]
 
                 (* ;; 
@@ -2246,8 +2258,10 @@
                     (ADD1 (IDIFFERENCE CHNO NCHARS))
                     1)])
 
-(\FILLPANE
-  [LAMBDA (PREVLINE TEXTOBJ PANE)                            (* ; "Edited 11-Jan-2024 19:32 by rmk")
+(\TEDIT.FILLPANE
+  [LAMBDA (PREVLINE TEXTOBJ PANE)                            (* ; "Edited 20-Mar-2024 06:43 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:39 by rmk")
+                                                             (* ; "Edited 11-Jan-2024 19:32 by rmk")
                                                              (* ; "Edited  2-Jan-2024 12:45 by rmk")
                                                              (* ; "Edited 24-Dec-2023 22:00 by rmk")
                                                              (* ; "Edited  2-Dec-2023 23:05 by rmk")
@@ -2278,12 +2292,12 @@
 
          (* ;; "Format and display any lines that are still needed to fill out the pane.   ")
 
-         (SETQ PREVLINE (\TEDIT.FORMATLINES PREVLINE NIL PANE TEXTOBJ))
+         (SETQ PREVLINE (\TEDIT.LINES.BELOW PREVLINE NIL PANE TEXTOBJ))
 
          (* ;; "")
 
          (CL:WHEN (\TEDIT.INSURE.TRAILING.LINE TEXTOBJ PREVLINE)
-             (\DISPLAYLINE TEXTOBJ (GETLD PREVLINE NEXTLINE)
+             (\TEDIT.DISPLAYLINE TEXTOBJ (GETLD PREVLINE NEXTLINE)
                     PANE))
 
          (* ;; "")
@@ -2294,6 +2308,7 @@
 
 (\TEDIT.UPDATE.LINES
   [LAMBDA (TEXTOBJ REASON FIRSTCHANGEDCHNO NCHARSCHANGED DONTDISPLAY)
+                                                             (* ; "Edited 20-Mar-2024 06:43 by rmk")
                                                              (* ; "Edited 24-Dec-2023 22:00 by rmk")
                                                              (* ; "Edited 18-Dec-2023 00:12 by rmk")
                                                              (* ; "Edited 16-Dec-2023 13:43 by rmk")
@@ -2320,7 +2335,7 @@
               (* ;; "Create/format/display new lines between LASTVALID=(CAR VALIDS) and NEXTVALID  ")
 
               (SETQ NEXTVALID (CDR VALIDS))
-              (SETQ LASTGAPLINE (\TEDIT.FORMATLINES (CAR VALIDS)
+              (SETQ LASTGAPLINE (\TEDIT.LINES.BELOW (CAR VALIDS)
                                        (AND NEXTVALID (SUB1 (FGETLD NEXTVALID LCHAR1)))
                                        PANE TEXTOBJ DONTDISPLAY))
               (LINKLD LASTGAPLINE NEXTVALID) 
@@ -2426,8 +2441,9 @@
                                  (IDIFFERENCE (ADD1 LASTDIRTYCHAR)
                                         (FGETLD FIRSTDIRTYLINE LCHAR1))))])
 
-(\TEDIT.FORMATLINES
-  [LAMBDA (PREVLINE LASTCHAR PANE TEXTOBJ DONTDISPLAY)       (* ; "Edited 23-Dec-2023 23:38 by rmk")
+(\TEDIT.LINES.BELOW
+  [LAMBDA (PREVLINE LASTCHAR PANE TEXTOBJ DONTDISPLAY)       (* ; "Edited 15-Mar-2024 19:22 by rmk")
+                                                             (* ; "Edited 23-Dec-2023 23:38 by rmk")
                                                              (* ; "Edited 17-Dec-2023 15:56 by rmk")
                                                              (* ; "Edited 14-Dec-2023 12:46 by rmk")
 
@@ -2456,7 +2472,7 @@
            first (CL:WHEN (OR (IGREATERP LCHARLIM LASTCHAR)
                               (ILEQ YBOT PBOTTOM))
                      (FSETLD PREVLINE NEXTLINE NIL)          (* ; "Eliminate dangling garbage")
-                     (RETURN PREVLINE)) while (SETQ NEXT (\FORMATLINE TEXTOBJ (ADD1 LCHARLIM)))
+                     (RETURN PREVLINE)) while (SETQ NEXT (\TEDIT.FORMATLINE TEXTOBJ (ADD1 LCHARLIM)))
            do 
               (* ;; 
        "L is formatted, positioned, linked, displayed. Next is the following line unless at the end.")
@@ -2470,14 +2486,15 @@
                   (RETURN L))
               (CL:UNLESS DONTDISPLAY                         (* ; 
                                                              "Cached formatting is good for display")
-                  (\DISPLAYLINE TEXTOBJ NEXT PANE)) finally 
+                  (\TEDIT.DISPLAYLINE TEXTOBJ NEXT PANE)) finally 
 
-                                                          (* ;; "Ran out of lines")
+                                                                (* ;; "Ran out of lines")
 
-                                                          (RETURN (OR L PREVLINE))))])
+                                                                (RETURN (OR L PREVLINE))))])
 
 (\FORMAT.GAP.LINES
-  [LAMBDA (VALIDS PANE TEXTOBJ DONTDISPLAY)                  (* ; "Edited  4-Dec-2023 20:42 by rmk")
+  [LAMBDA (VALIDS PANE TEXTOBJ DONTDISPLAY)                  (* ; "Edited 15-Mar-2024 19:23 by rmk")
+                                                             (* ; "Edited  4-Dec-2023 20:42 by rmk")
                                                              (* ; "Edited 20-Nov-2023 10:47 by rmk")
                                                              (* ; "Edited  3-Nov-2023 12:05 by rmk")
                                                              (* ; "Edited 15-May-2023 17:31 by rmk")
@@ -2517,7 +2534,7 @@
                    (CL:WHEN (IGREATERP (FGETLD NEXTVALID YTOP)
                                    (FGETLD LASTVALID YBOT))
                           (BITBLT)))
-          (SETQ LASTVALID (\FORMATLINE TEXTOBJ (ADD1 LCHARLIM)))
+          (SETQ LASTVALID (\TEDIT.FORMATLINE TEXTOBJ (ADD1 LCHARLIM)))
           (LINKLD L LASTVALID)
           (SETQ YBOT (\TEDIT.LINE.BOTTOM LASTVALID))
           (SETQ LCHARLIM (FGETLD LASTVALID LCHARLIM))
@@ -2525,11 +2542,12 @@
 
               (* ;; "The THISLINE cache for  NEXT is good if we display immediately after formatting")
 
-              (\DISPLAYLINE TEXTOBJ LASTVALID PANE)) finally (LINKLD LASTVALID NEXTVALID)
-                                                           (RETURN LASTVALID])
+              (\TEDIT.DISPLAYLINE TEXTOBJ LASTVALID PANE)) finally (LINKLD LASTVALID NEXTVALID)
+                                                                 (RETURN LASTVALID])
 
 (\TEDIT.LOWER.LINES
-  [LAMBDA (NEXTVALID LASTVALID PANE TEXTOBJ)                 (* ; "Edited 20-Jan-2024 23:15 by rmk")
+  [LAMBDA (NEXTVALID LASTVALID PANE TEXTOBJ)                 (* ; "Edited 15-Mar-2024 14:40 by rmk")
+                                                             (* ; "Edited 20-Jan-2024 23:15 by rmk")
                                                              (* ; "Edited  2-Jan-2024 00:26 by rmk")
                                                              (* ; "Edited  4-Dec-2023 11:25 by rmk")
                                                              (* ; "Edited 24-Nov-2023 13:01 by rmk")
@@ -2590,7 +2608,7 @@
                                                (if (IGEQ (FGETLD L YTOP)
                                                          NEWTOP)
                                                    then (SETYPOS L YBOT)
-                                                        (\DISPLAYLINE TEXTOBJ L PANE)
+                                                        (\TEDIT.DISPLAYLINE TEXTOBJ L PANE)
                                                  else (SETYPOS L YBOT)))
 
          (* ;; "Clear whatever might be left over below the last visible line")
@@ -2600,7 +2618,8 @@
                          'REPLACE))])])
 
 (\TEDIT.RAISE.LINES
-  [LAMBDA (LINE NEWTOP PANE TEXTOBJ)                         (* ; "Edited 20-Jan-2024 23:14 by rmk")
+  [LAMBDA (LINE NEWTOP PANE TEXTOBJ)                         (* ; "Edited 20-Mar-2024 10:57 by rmk")
+                                                             (* ; "Edited 20-Jan-2024 23:14 by rmk")
                                                              (* ; "Edited  2-Jan-2024 00:31 by rmk")
                                                              (* ; "Edited 14-Dec-2023 17:20 by rmk")
                                                              (* ; "Edited  4-Dec-2023 20:57 by rmk")
@@ -2615,7 +2634,7 @@
 
     (* ;; "If PANE has been moved so that it is not entirely within the screen, then don't try to find the relevant bits, just repaint the whole window.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (PROG ((PREG (DSPCLIPPINGREGION NIL PANE))
            (LTOP (GETLD LINE YTOP))
            RAISE PWIDTH PBOTTOM LASTVISIBLE)
@@ -2652,11 +2671,13 @@
 
               (* ;; "If the last visible line in the pane (whose image is now elevated) is not the last line of the text, we build and display new lines to fill out the pane.")
 
-              (\TEDIT.FORMATLINES LASTVISIBLE NIL PANE TEXTOBJ)
+              (\TEDIT.LINES.BELOW LASTVISIBLE NIL PANE TEXTOBJ)
               (RETURN))])
 
 (\TEDIT.VALID.LINES
-  [LAMBDA (TEXTOBJ FIRSTCHANGEDCHNO NCHARSCHANGED REASON)    (* ; "Edited 22-Feb-2024 01:05 by rmk")
+  [LAMBDA (TEXTOBJ FIRSTCHANGEDCHNO NCHARSCHANGED REASON)    (* ; "Edited 20-Mar-2024 06:46 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 19:44 by rmk")
+                                                             (* ; "Edited 22-Feb-2024 01:05 by rmk")
                                                              (* ; "Edited  3-Nov-2023 12:07 by rmk")
                                                              (* ; "Edited 14-Jun-2023 15:55 by rmk")
                                                              (* ; "Edited 17-May-2023 09:32 by rmk")
@@ -2735,9 +2756,8 @@
 
                          (* ;; "We ran back to the top of the pane without finding a forced-end. If it's not the beginning of the document, we need to insert a new line with the proper LCHARLIM and YBOT just above the pane.  ")
 
-                         [SETQ LASTVALIDLINE (CADR (\FORMATBLOCK TEXTOBJ (SUB1 (FGETLD 
-                                                                                     FIRSTCHANGEDLINE
-                                                                                      LCHAR1))
+                         [SETQ LASTVALIDLINE (CADR (\TEDIT.LINES.ABOVE TEXTOBJ
+                                                          (SUB1 (FGETLD FIRSTCHANGEDLINE LCHAR1))
                                                           (FGETLD FIRSTCHANGEDLINE YTOP]
                          (\TEDIT.INSERTLINE LASTVALIDLINE PLINES T)))
 
@@ -2817,19 +2837,20 @@
                 (SETLD OLDLINE PREVLINE NEWLINE])
 
 (\TEDIT.INSURE.TRAILING.LINE
-  [LAMBDA (TEXTOBJ LASTLINE)                                 (* ; "Edited 16-Dec-2023 00:12 by rmk")
+  [LAMBDA (TEXTOBJ LASTLINE)                                 (* ; "Edited 15-Mar-2024 19:31 by rmk")
+                                                             (* ; "Edited 16-Dec-2023 00:12 by rmk")
                                                              (* ; "Edited 15-Jul-2023 13:53 by rmk")
                                                              (* ; "Edited  8-May-2023 22:00 by rmk")
                                                              (* ; "Edited  5-May-2023 10:54 by rmk")
 
     (* ;; "Fabricates a final line to insure that there is a place for the caret to blink after the last EOL of the text.  Something for \FIXSEL to move to.")
 
-    (* ;; "\FORMATLINE may be overkill--maybe we really want to construct exactly what we want.  But \FORMATLINE does get the LHEIGHT.")
+    (* ;; "\TEDIT.FORMATLINE may be overkill--maybe we really want to construct exactly what we want.  But \TEDIT.FORMATLINE does get the LHEIGHT.")
 
     (CL:WHEN (AND (GETLD LASTLINE FORCED-END)
                   (IEQP (FGETLD LASTLINE LCHARLIM)
                         (FGETTOBJ TEXTOBJ TEXTLEN)))
-        (LET [(LINE (\FORMATLINE.EMPTY TEXTOBJ (ADD1 (FGETTOBJ TEXTOBJ TEXTLEN]
+        (LET [(LINE (\TEDIT.FORMATLINE.EMPTY TEXTOBJ (ADD1 (FGETTOBJ TEXTOBJ TEXTLEN]
              (SETYPOS LINE (IDIFFERENCE (FGETLD LASTLINE YBOT)
                                   (FGETLD LINE LHEIGHT)))
              (LINKLD LASTLINE LINE)
@@ -2945,21 +2966,22 @@
                                                          (SETQ TAILLINE NIL))))])
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (24822 26231 (\TEDIT.LINEDESCRIPTOR.DEFPRINT 24832 . 26229)) (33728 110992 (\FORMATLINE 
-33738 . 68365) (\FORMATLINE.SETUP 68367 . 71752) (\TEDIT.FORMATLINE.HORIZONTAL 71754 . 76029) (
-\TEDIT.FORMATLINE.VERTICAL 76031 . 78000) (\FORMATLINE.JUSTIFY 78002 . 83936) (\FORMATLINE.TABS 83938
- . 91419) (\FORMATLINE.SCALETABS 91421 . 92418) (\FORMATLINE.PURGE.SPACES 92420 . 93724) (
-\FORMATLINE.EMPTY 93726 . 98429) (\FORMATLINE.UPDATELOOKS 98431 . 105376) (\FORMATLINE.LASTLEGAL 
-105378 . 108854) (\FORMATBLOCK 108856 . 110990)) (111109 113415 (\CLEARTHISLINE 111119 . 111788) (
-\TLVALIDATE 111790 . 113413)) (113609 133326 (\DISPLAYLINE 113619 . 125731) (\DISPLAYLINE.TABS 125733
- . 128350) (\TEDIT.LINECACHE 128352 . 129080) (\TEDIT.CREATE.LINECACHE 129082 . 129918) (
-\TEDIT.BLTCHAR 129920 . 132441) (\TEDIT.DIACRITIC.SHIFT 132443 . 133324)) (133941 186008 (
-TEDIT.UPDATE.SCREEN 133951 . 135590) (\BACKFORMAT 135592 . 137346) (\TEDIT.PREVIOUS.LINEBREAK 137348
- . 139536) (\FILLPANE 139538 . 141857) (\TEDIT.UPDATE.LINES 141859 . 146738) (\TEDIT.CREATEPLINE 
-146740 . 148583) (\TEDIT.FIND.DIRTYCHARS 148585 . 150597) (\TEDIT.FORMATLINES 150599 . 153948) (
-\FORMAT.GAP.LINES 153950 . 157814) (\TEDIT.LOWER.LINES 157816 . 162068) (\TEDIT.RAISE.LINES 162070 . 
-165395) (\TEDIT.VALID.LINES 165397 . 174681) (\TEDIT.CLEARPANE.BELOW.LINE 174683 . 176001) (
-\TEDIT.INSERTLINE 176003 . 177261) (\TEDIT.INSURE.TRAILING.LINE 177263 . 178451) (
-\TEDIT.MARK.LINES.DIRTY 178453 . 181164) (\TEDIT.LINE.BOTTOM 181166 . 184006) (\TEDIT.NCONC.LINES 
-184008 . 186006)))))
+  (FILEMAP (NIL (24497 25906 (\TEDIT.LINEDESCRIPTOR.DEFPRINT 24507 . 25904)) (33264 111915 (
+\TEDIT.FORMATLINE 33274 . 68334) (\TEDIT.FORMATLINE.SETUP 68336 . 71727) (\TEDIT.FORMATLINE.HORIZONTAL
+ 71729 . 76125) (\TEDIT.FORMATLINE.VERTICAL 76127 . 78330) (\TEDIT.FORMATLINE.JUSTIFY 78332 . 84272) (
+\TEDIT.FORMATLINE.TABS 84274 . 91761) (\TEDIT.FORMATLINE.SCALETABS 91763 . 92766) (
+\TEDIT.FORMATLINE.PURGE.SPACES 92768 . 94078) (\TEDIT.FORMATLINE.EMPTY 94080 . 98910) (
+\TEDIT.FORMATLINE.UPDATELOOKS 98912 . 106178) (\TEDIT.FORMATLINE.LASTLEGAL 106180 . 109662) (
+\TEDIT.LINES.ABOVE 109664 . 111913)) (112032 114453 (\CLEARTHISLINE 112042 . 112711) (\TLVALIDATE 
+112713 . 114451)) (114647 134704 (\TEDIT.DISPLAYLINE 114657 . 126997) (\TEDIT.DISPLAYLINE.TABS 126999
+ . 129622) (\TEDIT.LINECACHE 129624 . 130352) (\TEDIT.CREATE.LINECACHE 130354 . 131190) (
+\TEDIT.BLTCHAR 131192 . 133819) (\TEDIT.DIACRITIC.SHIFT 133821 . 134702)) (135319 189027 (
+\TEDIT.UPDATE.SCREEN 135329 . 137153) (\TEDIT.BACKFORMAT 137155 . 139197) (\TEDIT.PREVIOUS.LINEBREAK 
+139199 . 141502) (\TEDIT.FILLPANE 141504 . 144053) (\TEDIT.UPDATE.LINES 144055 . 149043) (
+\TEDIT.CREATEPLINE 149045 . 150888) (\TEDIT.FIND.DIRTYCHARS 150890 . 152902) (\TEDIT.LINES.BELOW 
+152904 . 156386) (\FORMAT.GAP.LINES 156388 . 160379) (\TEDIT.LOWER.LINES 160381 . 164748) (
+\TEDIT.RAISE.LINES 164750 . 168177) (\TEDIT.VALID.LINES 168179 . 177573) (\TEDIT.CLEARPANE.BELOW.LINE 
+177575 . 178893) (\TEDIT.INSERTLINE 178895 . 180153) (\TEDIT.INSURE.TRAILING.LINE 180155 . 181470) (
+\TEDIT.MARK.LINES.DIRTY 181472 . 184183) (\TEDIT.LINE.BOTTOM 184185 . 187025) (\TEDIT.NCONC.LINES 
+187027 . 189025)))))
 STOP
diff --git a/library/tedit/TEDIT-SCREEN.LCOM b/library/tedit/TEDIT-SCREEN.LCOM
index f79d8277..888b2edd 100644
Binary files a/library/tedit/TEDIT-SCREEN.LCOM and b/library/tedit/TEDIT-SCREEN.LCOM differ
diff --git a/library/tedit/TEDIT-SELECTION b/library/tedit/TEDIT-SELECTION
index ee2f3a0a..0f99c720 100644
--- a/library/tedit/TEDIT-SELECTION
+++ b/library/tedit/TEDIT-SELECTION
@@ -1,12 +1,15 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "21-Mar-2024 10:32:02" {MEDLEY}<library>tedit>TEDIT-SELECTION.;80 126882 
+(FILECREATED "21-Mar-2024 10:49:49" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-SELECTION.;461 130592 
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (VARS TEDIT-SELECTIONCOMS)
+      :CHANGES-TO (FNS TEDIT.SCANSEL TEDIT.XYTOCH TEDIT.SELECT)
+                  (VARS TEDIT-SELECTIONCOMS)
 
-      :PREVIOUS-DATE "16-Mar-2024 16:31:03" {MEDLEY}<library>tedit>TEDIT-SELECTION.;79)
+      :PREVIOUS-DATE "20-Mar-2024 11:08:55" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-SELECTION.;453)
 
 
 (PRETTYCOMPRINT TEDIT-SELECTIONCOMS)
@@ -28,28 +31,29 @@
         (FNS \TEDIT.SELECTION.DEFPRINT)
         (FNS \TEDIT.SET.GLOBAL.SELECTIONS)
         (P (\TEDIT.SET.GLOBAL.SELECTIONS))
-        (FNS TEDIT.SEL.AS.STRING TEDIT.SEL.AS.SEXPR TEDIT.SELECTALL TEDIT.SELECTED.PIECES 
-             \TEDIT.FIND.PROTECTED.END \TEDIT.FIND.PROTECTED.START \TEDIT.WORD.BOUND)
+        (FNS \TEDIT.SELECTED.PIECES \TEDIT.FIND.PROTECTED.END \TEDIT.FIND.PROTECTED.START 
+             \TEDIT.WORD.BOUND)
         (INITVARS (TEDIT.EXTEND.PENDING.DELETE T))
                                                              (* ; "Setting for a %"Laurel%" mode")
         (COMS                                                (* ; "Selection manipulating code")
               (FNS \TEDIT.EXTEND.SEL \TEDIT.SELECT \TEDIT.SCAN.LINE \TEDIT.SCAN.LINE.WORD 
                    \TEDIT.SELECT.LINE.SCANNER \TEDIT.SELECT.OBJECT)
-              (FNS \FIXSEL \TEDIT.CHTOX \TEDIT.COLLECTSELS \TEDIT.SELECTION.UNSET)
-              (FNS TEDIT.RESET.EXTEND.PENDING.DELETE \TEDIT.SET.SEL.LOOKS)
-              (FNS \SHOWSEL \TEDIT.SHOWSEL.HILIGHT \TEDIT.UPDATE.SHOWSEL \TEDIT.REFRESH.SHOWSEL 
+              (FNS \TEDIT.FIXSEL \TEDIT.CHTOX \TEDIT.COLLECTSELS \TEDIT.SELECTION.UNSET)
+              (FNS \TEDIT.RESET.EXTEND.PENDING.DELETE \TEDIT.SET.SEL.LOOKS)
+              (FNS \TEDIT.SHOWSEL \TEDIT.SHOWSEL.HILIGHT \TEDIT.UPDATE.SHOWSEL \TEDIT.REFRESH.SHOWSEL
                    \TEDIT.UPDATE.SEL \TEDIT.SEL.L1 \TEDIT.SEL.LN \TEDIT.SEL.DELETEDCHARS)
-              (FNS \COPYSEL \TEDIT.SEL.CHANGED?))
+              (FNS \TEDIT.COPYSEL \TEDIT.SEL.CHANGED?))
+        
+        (* ;; "SELPIECES")
+
+        (FNS \TEDIT.SELPIECES \TEDIT.SELPIECES.COPY \TEDIT.SELPIECES.CONCAT 
+             \TEDIT.SELPIECES.CHARTRANSFORM \TEDIT.SELPIECES.FROM.STRING \TEDIT.SELPIECES.TO.STRING)
         
         (* ;; "User entries to the selection code")
 
         (FNS TEDIT.XYTOCH TEDIT.GETPOINT TEDIT.GETSEL TEDIT.GETSEL.PARA TEDIT.MAKESEL TEDIT.SCANSEL 
-             TEDIT.SET.SEL.LOOKS TEDIT.SETSEL TEDIT.SHOWSEL)
-        
-        (* ;; "SELPIECES")
-
-        (FNS \SELPIECES \SELPIECES.COPY \SELPIECES.CONCAT \SELPIECES.CHARTRANSFORM 
-             \SELPIECES.FROM.STRING \SELPIECES.TO.STRING)))
+             TEDIT.SET.SEL.LOOKS TEDIT.SETSEL TEDIT.SHOWSEL TEDIT.SEL.AS.STRING TEDIT.SEL.AS.SEXPR 
+             TEDIT.SELECTALL)))
 (DECLARE%: EVAL@COMPILE DONTCOPY 
 (* "FOLLOWING DEFINITIONS EXPORTED")(DECLARE%: EVAL@COMPILE
 
@@ -292,7 +296,8 @@
 (DEFINEQ
 
 (\TEDIT.SET.GLOBAL.SELECTIONS
-  [LAMBDA (SELOPERATION SOURCESEL)                           (* ; "Edited 12-Feb-2024 08:15 by rmk")
+  [LAMBDA (SELOPERATION SOURCESEL)                           (* ; "Edited 15-Mar-2024 13:38 by rmk")
+                                                             (* ; "Edited 12-Feb-2024 08:15 by rmk")
 
     (* ;; "This sets the documented global selections (TEDIT.*SELECTION), and some that are not documented (COPYLOOKS, DELETE).")
 
@@ -300,11 +305,11 @@
 
     (SELECTQ SELOPERATION
         ((NORMAL PENDINGDEL) 
-             (SETQ TEDIT.SELECTION (\COPYSEL SOURCESEL)))
-        (COPY (SETQ TEDIT.SHIFTEDSELECTION (\COPYSEL SOURCESEL)))
-        (MOVE (SETQ TEDIT.MOVESELECTION (\COPYSEL SOURCESEL)))
-        (COPYLOOKS (SETQ TEDIT.COPYLOOKSSELECTION (\COPYSEL SOURCESEL)))
-        (DELETE (SETQ TEDIT.DELETESELECTION (\COPYSEL SOURCESEL)))
+             (SETQ TEDIT.SELECTION (\TEDIT.COPYSEL SOURCESEL)))
+        (COPY (SETQ TEDIT.SHIFTEDSELECTION (\TEDIT.COPYSEL SOURCESEL)))
+        (MOVE (SETQ TEDIT.MOVESELECTION (\TEDIT.COPYSEL SOURCESEL)))
+        (COPYLOOKS (SETQ TEDIT.COPYLOOKSSELECTION (\TEDIT.COPYSEL SOURCESEL)))
+        (DELETE (SETQ TEDIT.DELETESELECTION (\TEDIT.COPYSEL SOURCESEL)))
         (NIL (for S in '(TEDIT.SELECTION TEDIT.SHIFTEDSELECTION TEDIT.COPYLOOKSSELECTION 
                                TEDIT.MOVESELECTION TEDIT.DELETESELECTION) unless (BOUNDP S)
                 do (SETATOMVAL S (create SELECTION))))
@@ -314,62 +319,16 @@
 (\TEDIT.SET.GLOBAL.SELECTIONS)
 (DEFINEQ
 
-(TEDIT.SEL.AS.STRING
-  [LAMBDA (TSTREAM SEL)                                      (* ; "Edited 27-Jan-2024 22:57 by rmk")
-                                                             (* ; "Edited 23-May-2023 12:36 by rmk")
-                                                             (* ; "Edited  8-Sep-2022 23:35 by rmk")
-                                                             (* ; "Edited 22-Apr-93 16:44 by jds")
-
-    (* ;; "RMK:  WHAT IF THE STREAM CONTAINS AN OBJECT?")
-
-    (* ;; 
-    "Given a text stream, go to the TEXTOBJ, get the current selection, and return it as a string.")
-
-    (SETQ TSTREAM (TEXTSTREAM TSTREAM))
-    (CL:UNLESS SEL
-        (SETQ SEL (GETTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
-                         SEL)))
-    (LET (RESULT (LEN (GETSEL SEL DCH)))
-         (COND
-            ((ZEROP LEN)                                     (* ; 
-                                              "There is no selection, or it's zero-width.  Return ''")
-             (CONCAT ""))
-            (T (SETQ RESULT (ALLOCSTRING LEN (CHARCODE SPACE)))
-                                                             (* ; "The resulting string")
-               (\TEXTSETFILEPTR TSTREAM (SUB1 (GETSEL SEL CH#)))
-                                                             (* ; 
-                                               "Starting point for the string is start of selection.")
-               (for I from 1 to LEN do (RPLCHARCODE RESULT I (BIN TSTREAM)))
-               RESULT])
-
-(TEDIT.SEL.AS.SEXPR
-  [LAMBDA (TSTREAM SEL RDTBL FLG)                            (* ; "Edited 25-Dec-2023 18:52 by rmk")
-                                                             (* ; "Edited  9-Jul-2023 09:37 by rmk")
-                                                             (* ; "Edited 22-Apr-93 16:44 by jds")
-
-    (* ;; "Return an s-expression from the characters defined by SEL's point position.")
-
-    (* ;; "This backs up to the beginning of the word that precedes the caret, then READ's from there.  A little tricky to point to the paren in front of an atom, to get a complete list structure and not just the initial atom.")
-
-    (SETQ TSTREAM (TEXTSTREAM TSTREAM))
-    [\TEXTSETFILEPTR TSTREAM (SUB1 (\TEDIT.WORD.FIRST (TEXTOBJ TSTREAM)
-                                          (TEDIT.GETPOINT TSTREAM SEL)
-                                          (TEDIT.ATOMBOUND.READTABLE (OR RDTBL *READTABLE*]
-    (READ TSTREAM RDTBL FLG])
-
-(TEDIT.SELECTALL
-  [LAMBDA (TEXTSTREAM TEXTOBJ SEL)                           (* ; "Edited 14-Jun-2023 16:58 by rmk")
-                                                            (* ; "Edited  3-May-2020 17:29 by rmk:")
-    (TEDIT.SETSEL TEXTSTREAM 0 (ADD1 (TEXTLEN (TEXTOBJ TEXTSTREAM)))
-           'LEFT])
-
-(TEDIT.SELECTED.PIECES
-  [LAMBDA (TEXTOBJ SEL CROSSCOPY PIECEMAPFN FNARG1 FNARG2)   (* ; "Edited 28-Nov-2023 23:14 by rmk")
+(\TEDIT.SELECTED.PIECES
+  [LAMBDA (TEXTOBJ SEL CROSSCOPY PIECEMAPFN FNARG1 FNARG2)   (* ; "Edited 15-Mar-2024 14:15 by rmk")
+                                                             (* ; "Edited 28-Nov-2023 23:14 by rmk")
                                                              (* ; "Edited 21-Jun-2023 20:30 by rmk")
                                                              (* ; "Edited  9-May-2023 13:16 by rmk")
                                                              (* ; "Edited 11-Apr-2023 12:07 by rmk")
                                                              (* ; "Edited 20-Apr-93 17:06 by jds")
 
+    (* ;; "NOT SURE THIS IS CALLED")
+
     (* ;; "Create a list of pieces corresponding to the selection;  if FNARG, apply it to each piece, and use the result instead of the piece")
 
     (SETQ TEXTOBJ (TEXTOBJ TEXTOBJ))
@@ -377,16 +336,17 @@
         (CL:UNLESS SEL
             (SETQ SEL (FGETTOBJ TEXTOBJ SEL)))
         (CL:WHEN (GETSEL SEL SET)
-            (LET ((SELPIECES (\SELPIECES SEL NIL TEXTOBJ)))
+            (LET ((SELPIECES (\TEDIT.SELPIECES SEL NIL TEXTOBJ)))
                  (for PC inselpieces (CL:IF CROSSCOPY
-                                         (\SELPIECES.COPY SELPIECES 'COPY TEXTOBJ)
+                                         (\TEDIT.SELPIECES.COPY SELPIECES 'COPY TEXTOBJ)
                                          SELPIECES)
                     collect (CL:IF PIECEMAPFN
                                 (APPLY* PIECEMAPFN PC TEXTOBJ FNARG1 FNARG2)
                                 PC)))))])
 
 (\TEDIT.FIND.PROTECTED.END
-  [LAMBDA (TEXTOBJ CH# LIMITCH#)                             (* ; "Edited  7-Apr-2023 22:13 by rmk")
+  [LAMBDA (TEXTOBJ CH# LIMITCH#)                             (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited  7-Apr-2023 22:13 by rmk")
                                                              (* ; "Edited 23-Oct-2022 17:44 by rmk")
                                                              (* ; "Edited  5-Sep-2022 15:31 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:21 by rmk")
@@ -397,7 +357,7 @@
     (SETQ LIMITCH# (IMIN LIMITCH# (TEXTLEN TEXTOBJ)))
     (LET (START-OF-PIECE)
          (DECLARE (SPECVARS START-OF-PIECE))
-         (for PC inpieces (\CHTOPC CH# TEXTOBJ T) until (IGREATERP START-OF-PIECE LIMITCH#)
+         (for PC inpieces (\TEDIT.CHTOPC CH# TEXTOBJ T) until (IGREATERP START-OF-PIECE LIMITCH#)
             do 
                (* ;; "Move forward thru the pieces of the document, looking for one that contains protected text.  If that comes before the end of the region we're interested in, tell the caller about the earlier end to selectable text.")
 
@@ -410,7 +370,8 @@
                (add START-OF-PIECE (PLEN PC)) finally (RETURN LIMITCH#])
 
 (\TEDIT.FIND.PROTECTED.START
-  [LAMBDA (TEXTOBJ CH# LIMITCH#)                             (* ; "Edited 24-Nov-2023 21:25 by rmk")
+  [LAMBDA (TEXTOBJ CH# LIMITCH#)                             (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 24-Nov-2023 21:25 by rmk")
                                                              (* ; "Edited  7-Apr-2023 21:59 by rmk")
                                                              (* ; "Edited  4-Feb-2023 10:23 by rmk")
                                                              (* ; "Edited 23-Oct-2022 16:20 by rmk")
@@ -425,7 +386,8 @@
     (LET (START-OF-PIECE)                                    (* ; 
                                                              "Gets us to the beginning of CH# piece")
          (DECLARE (SPECVARS START-OF-PIECE))
-         (for PC backpieces (PREVPIECE (\CHTOPC CH# TEXTOBJ T)) until (ILEQ START-OF-PIECE LIMITCH#)
+         (for PC backpieces (PREVPIECE (\TEDIT.CHTOPC CH# TEXTOBJ T)) until (ILEQ START-OF-PIECE 
+                                                                                  LIMITCH#)
             do (CL:WHEN (fetch (CHARLOOKS CLPROTECTED) of (PLOOKS PC))
 
                    (* ;; "Return the CH# just AFTER this first protected piece.")
@@ -459,7 +421,8 @@
 (DEFINEQ
 
 (\TEDIT.EXTEND.SEL
-  [LAMBDA (X Y OSEL TEXTOBJ SELOPERATION PANE)               (* ; "Edited 26-Dec-2023 11:46 by rmk")
+  [LAMBDA (X Y OSEL TEXTOBJ SELOPERATION PANE)               (* ; "Edited 15-Mar-2024 13:38 by rmk")
+                                                             (* ; "Edited 26-Dec-2023 11:46 by rmk")
                                                              (* ; "Edited 15-Oct-2023 10:39 by rmk")
                                                              (* ; "Edited  5-Oct-2023 22:08 by rmk")
                                                              (* ; "Edited 19-Apr-2023 17:36 by rmk")
@@ -554,14 +517,15 @@
                              (FGETSEL NEWSEL SELOBJ))        (* ; 
                                                           "Keep object if it is in overlapping part?")
                   (FSETSEL NEWSEL SELOBJ NIL))
-              (\FIXSEL NEWSEL TEXTOBJ)
+              (\TEDIT.FIXSEL NEWSEL TEXTOBJ)
               (CL:WHEN SETOSELFLG                            (* ; 
                                                    "It is wise to copy the new sel into the old one.")
-                  (\COPYSEL NEWSEL OSEL))
+                  (\TEDIT.COPYSEL NEWSEL OSEL))
               (RETURN NEWSEL)))])
 
 (\TEDIT.SELECT
   [LAMBDA (X Y TEXTOBJ REGION WORDSELFLG SELOPERATION PANE EXTENDING)
+                                                             (* ; "Edited 15-Mar-2024 13:36 by rmk")
                                                              (* ; "Edited  2-Jan-2024 12:32 by rmk")
                                                              (* ; "Edited 26-Dec-2023 08:50 by rmk")
                                                              (* ; "Edited 23-May-2023 12:38 by rmk")
@@ -576,12 +540,13 @@
                        (GETSEL SEL SET))                     (* ; 
                                                         "He pointed at something real;  return that.")
              (\TEDIT.SET.SEL.LOOKS SEL SELOPERATION)
-             (\FIXSEL SEL TEXTOBJ PANE)                      (* ; 
+             (\TEDIT.FIXSEL SEL TEXTOBJ PANE)                (* ; 
                                                           "This PANE is good, fix all the other ones")
              SEL)])
 
 (\TEDIT.SCAN.LINE
   [LAMBDA (TEXTOBJ LINE X Y WORDSELFLG SELOPERATION PANE EXTENDING)
+                                                             (* ; "Edited 15-Mar-2024 19:22 by rmk")
                                                              (* ; "Edited 27-Jan-2024 23:44 by rmk")
                                                              (* ; "Edited 26-Jan-2024 21:54 by rmk")
                                                              (* ; "Edited 22-Jan-2024 17:15 by rmk")
@@ -598,7 +563,7 @@
                  (THISLINE (FGETTOBJ TEXTOBJ THISLINE)))
           (CL:UNLESS (EQ LINE (fetch DESC of THISLINE))      (* ; 
                                                             "Make sure the cache describes this line")
-              (SETQ LINE (\FORMATLINE TEXTOBJ (GETLD LINE LCHAR1)
+              (SETQ LINE (\TEDIT.FORMATLINE TEXTOBJ (GETLD LINE LCHAR1)
                                 LINE)))                      (* ; 
                                                           "Convert X's display units to LINE's scale")
           (SETQ TX (GETLD LINE LX1))
@@ -800,6 +765,7 @@
 
 (\TEDIT.SELECT.LINE.SCANNER
   [LAMBDA (X Y TEXTOBJ LINES REGION WORDSELFLG SELOPERATION PANE EXTENDING)
+                                                             (* ; "Edited 15-Mar-2024 13:36 by rmk")
                                                              (* ; "Edited 26-Dec-2023 08:53 by rmk")
                                                              (* ; "Edited  3-Nov-2023 12:00 by rmk")
                                                              (* ; "Edited 14-Oct-2023 22:43 by rmk")
@@ -882,7 +848,7 @@
                                                  (T 'RIGHT))
                                               NIL T)
                                        (FSETSEL SCRSEL SELKIND 'PARA)
-                                       (\FIXSEL SCRSEL TEXTOBJ NIL PANE)
+                                       (\TEDIT.FIXSEL SCRSEL TEXTOBJ NIL PANE)
                                 else                         (* ; 
                                                             "Select just the line we're pointing at.")
                                      (RPLACA PL1 LINE)
@@ -903,6 +869,7 @@
 
 (\TEDIT.SELECT.OBJECT
   [LAMBDA (TEXTOBJ SEL OBJ LINE X Y TXB SELPANE SELOPERATION WHERE)
+                                                             (* ; "Edited 15-Mar-2024 19:22 by rmk")
                                                              (* ; "Edited 24-Jan-2024 11:59 by rmk")
                                                              (* ; "Edited 14-Oct-2023 11:38 by rmk")
                                                              (* ; "Edited 10-Apr-2023 08:38 by rmk")
@@ -961,16 +928,17 @@
                                                              "The object declines to be selected.  ")
                         (FSETSEL SEL SET NIL))
                  (CHANGED                                    (* ; "Update the screen")
-                          (\FORMATLINE TEXTOBJ (GETLD LINE LCHAR1)
+                          (\TEDIT.FORMATLINE TEXTOBJ (GETLD LINE LCHAR1)
                                  LINE)
-                          (\DISPLAYLINE TEXTOBJ LINE SELPANE)
+                          (\TEDIT.DISPLAYLINE TEXTOBJ LINE SELPANE)
                           (TEDIT.OBJECT.CHANGED TEXTOBJ (fetch (SELECTION SELOBJ) of SEL)))
                  NIL))])
 )
 (DEFINEQ
 
-(\FIXSEL
-  [LAMBDA (SEL TEXTOBJ AVOIDPANE ONLYPANE)                   (* ; "Edited  2-Mar-2024 23:38 by rmk")
+(\TEDIT.FIXSEL
+  [LAMBDA (SEL TEXTOBJ AVOIDPANE ONLYPANE)                   (* ; "Edited 20-Mar-2024 10:55 by rmk")
+                                                             (* ; "Edited  2-Mar-2024 23:38 by rmk")
                                                              (* ; "Edited 16-Dec-2023 11:44 by rmk")
                                                              (* ; "Edited  3-Nov-2023 12:01 by rmk")
                                                              (* ; "Edited 28-Jul-2023 15:58 by rmk")
@@ -1015,7 +983,7 @@
     (\DTEST SEL 'SELECTION)
     (CL:UNLESS TEXTOBJ
         (SETQ TEXTOBJ (GETSEL SEL SELTEXTOBJ)))
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (CL:WHEN (AND (FGETTOBJ TEXTOBJ \WINDOW)
                   (FGETSEL SEL SET)
                   (NOT (FGETTOBJ TEXTOBJ TXTDON'TUPDATE)))
@@ -1127,7 +1095,8 @@
     SEL])
 
 (\TEDIT.CHTOX
-  [LAMBDA (TEXTOBJ LINE CH# AFTER)                           (* ; "Edited 23-Dec-2023 14:07 by rmk")
+  [LAMBDA (TEXTOBJ LINE CH# AFTER)                           (* ; "Edited 15-Mar-2024 19:22 by rmk")
+                                                             (* ; "Edited 23-Dec-2023 14:07 by rmk")
                                                              (* ; "Edited  2-Dec-2023 10:01 by rmk")
                                                              (* ; "Edited 16-May-2023 00:20 by rmk")
                                                              (* ; "Edited 23-Mar-2023 23:04 by rmk")
@@ -1145,7 +1114,7 @@
 
              (* ;; "Reformat if LINE is dirty or not cached in THISLINE. ")
 
-             (\FORMATLINE TEXTOBJ (FGETLD LINE LCHAR1)
+             (\TEDIT.FORMATLINE TEXTOBJ (FGETLD LINE LCHAR1)
                     LINE))
 
          (* ;; "Can avoid another loop if we are asking about the first or last characters.")
@@ -1183,7 +1152,8 @@
                                                      (RETURN (FGETLD LINE LX1)))])
 
 (\TEDIT.COLLECTSELS
-  [LAMBDA (TEXTOBJ AVOIDSEL)                                 (* ; "Edited 11-Feb-2024 09:21 by rmk")
+  [LAMBDA (TEXTOBJ AVOIDSEL)                                 (* ; "Edited 20-Mar-2024 10:56 by rmk")
+                                                             (* ; "Edited 11-Feb-2024 09:21 by rmk")
                                                              (* ; "Edited  9-Feb-2024 15:55 by rmk")
                                                              (* ; "Edited 20-Sep-2023 17:02 by rmk")
                                                              (* ; "Edited  9-Sep-2023 17:15 by rmk")
@@ -1192,7 +1162,7 @@
 
     (* ;; "AVOIDSEL to avoid double hits on selections that we might be dealing with separately (e.g. SCRATCHSEL)  MAYBE NOT USED")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (DREMOVE AVOIDSEL (DREMOVE NIL (LIST (FGETTOBJ TEXTOBJ SEL)
                                          (FGETTOBJ TEXTOBJ SCRATCHSEL)
                                          (FGETTOBJ TEXTOBJ SCRATCHSEL2])
@@ -1208,8 +1178,9 @@
 )
 (DEFINEQ
 
-(TEDIT.RESET.EXTEND.PENDING.DELETE
-  [LAMBDA (SEL)                                              (* ; "Edited 19-Feb-2024 23:10 by rmk")
+(\TEDIT.RESET.EXTEND.PENDING.DELETE
+  [LAMBDA (SEL TEXTOBJ)                                      (* ; "Edited  9-Mar-2024 11:37 by rmk")
+                                                             (* ; "Edited 19-Feb-2024 23:10 by rmk")
                                                              (* ; "Edited 24-Dec-2023 00:18 by rmk")
                                                              (* ; "Edited  4-May-2023 00:08 by rmk")
                                                              (* ; "Edited 21-Oct-2022 18:41 by rmk")
@@ -1219,9 +1190,7 @@
 
     (CL:WHEN SEL
         (\TEDIT.SET.SEL.LOOKS SEL 'NORMAL)
-        (CL:WHEN (GETSEL SEL SELTEXTOBJ)
-            (SETTOBJ (GETSEL SEL SELTEXTOBJ)
-                   BLUEPENDINGDELETE NIL)))])
+        (SETTOBJ TEXTOBJ BLUEPENDINGDELETE NIL))])
 
 (\TEDIT.SET.SEL.LOOKS
   [LAMBDA (SEL OPERATION)                                    (* ; "Edited 12-Oct-2023 22:36 by rmk")
@@ -1269,16 +1238,13 @@
 )
 (DEFINEQ
 
-(\SHOWSEL
-  [LAMBDA (SEL ON ONLYPANE)                                  (* ; "Edited 18-Feb-2024 15:24 by rmk")
+(\TEDIT.SHOWSEL
+  [LAMBDA (SEL ON ONLYPANE TEXTOBJ)                          (* ; "Edited 20-Mar-2024 10:56 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 12:01 by rmk")
+                                                             (* ; "Edited 18-Feb-2024 15:24 by rmk")
                                                              (* ; "Edited 24-Jan-2024 08:07 by rmk")
                                                              (* ; "Edited 18-Nov-2023 11:27 by rmk")
-                                                             (* ; "Edited 23-Oct-2023 23:24 by rmk")
                                                              (* ; "Edited 14-Oct-2023 12:10 by rmk")
-                                                             (* ; "Edited 23-May-2023 12:37 by rmk")
-                                                             (* ; "Edited  1-May-2023 14:34 by rmk")
-                                                             (* ; "Edited 20-Apr-2023 14:29 by rmk")
-                                                             (* ; "Edited  9-Apr-2023 15:13 by rmk")
                                                              (* ; "Edited  5-Apr-2023 09:13 by rmk")
                                                              (* ; "Edited 22-May-92 16:11 by jds")
     (\DTEST SEL 'SELECTION)
@@ -1288,8 +1254,7 @@
     (* ;; "The selection's lines [L1...LN] are the subset of lines selected globally by CH# to CHLIM that are visible within each pane.")
 
     (CL:WHEN (FGETSEL SEL SET)                               (* ; "Nothing to do if not set")
-        (PROG [(TEXTOBJ (\DTEST (FGETSEL SEL SELTEXTOBJ)
-                               'TEXTOBJ]
+        (PROG [(TEXTOBJ (TEXTOBJ! (OR TEXTOBJ (FGETSEL SEL SELTEXTOBJ]
 
          (* ;; "This operation only makes sense if there is at least one pane to highlight in, and we are allowed to update.")
 
@@ -1376,7 +1341,8 @@
                  'INVERT) repeatuntil (EQ L LN])
 
 (\TEDIT.UPDATE.SHOWSEL
-  [LAMBDA (NSEL OSEL TEXTOBJ)                                (* ; "Edited 18-Feb-2024 15:25 by rmk")
+  [LAMBDA (NSEL OSEL TEXTOBJ)                                (* ; "Edited 15-Mar-2024 13:37 by rmk")
+                                                             (* ; "Edited 18-Feb-2024 15:25 by rmk")
                                                              (* ; "Edited 17-Nov-2023 23:03 by rmk")
                                                              (* ; "Edited 23-Oct-2023 23:18 by rmk")
                                                              (* ; "Edited  9-Oct-2023 23:02 by rmk")
@@ -1386,7 +1352,7 @@
                                                              (* ; "Edited 21-Oct-2022 18:41 by rmk")
                                                              (* ; "Edited 30-May-91 23:03 by jds")
 
-    (* ;; "Update the selection highlighting and caret flashing to represent NSEL. Instead of normal \SHOWSEL, the goal is to avoid changing the highlighting on the screen for the pixels that are common between the 2 selections, to just flip whatever bits need to be flipped in order for the screen to reflect NSEL's highlighting.  We know that both selections are from the same TEXTOBJ, and that they both implement the same operation (copy, delete) so have the same HOW and HOWHEIGHT.  And we know that OSEL is ON.")
+    (* ;; "Update the selection highlighting and caret flashing to represent NSEL. Instead of normal \TEDIT.SHOWSEL, the goal is to avoid changing the highlighting on the screen for the pixels that are common between the 2 selections, to just flip whatever bits need to be flipped in order for the screen to reflect NSEL's highlighting.  We know that both selections are from the same TEXTOBJ, and that they both implement the same operation (copy, delete) so have the same HOW and HOWHEIGHT.  And we know that OSEL is ON.")
 
     (* ;; 
     "It is also the case that the lines of NSEL and OSELfor each pane are drawn from the same lists.")
@@ -1410,7 +1376,7 @@
 
     (* ;; "")
 
-    (* ;; "The nicest implementation would be to create a selection that describes just the characters whose highlighting has changed (either on or off), and then do (\SHOWSEL of that selection)")
+    (* ;; "The nicest implementation would be to create a selection that describes just the characters whose highlighting has changed (either on or off), and then do (\TEDIT.SHOWSEL of that selection)")
 
     (LET ((NPOINT (FGETSEL NSEL POINT))
           NEWLINES OLDLINES NCH# OCH# NLASTCH OLASTCH CARETXPOS)
@@ -1468,7 +1434,9 @@
                (\TEDIT.SETCARET NSEL PANE TEXTOBJ T PCARET])
 
 (\TEDIT.REFRESH.SHOWSEL
-  [LAMBDA (TEXTOBJ SOURCESEL OLDSEL OLDOP NEWOP EXTENDFLG)   (* ; "Edited 11-Feb-2024 00:06 by rmk")
+  [LAMBDA (TEXTOBJ SOURCESEL OLDSEL OLDOP NEWOP EXTENDFLG)   (* ; "Edited 15-Mar-2024 13:38 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 12:02 by rmk")
+                                                             (* ; "Edited 11-Feb-2024 00:06 by rmk")
                                                              (* ; "Edited  9-Feb-2024 15:48 by rmk")
                                                              (* ; "Edited 28-Jan-2024 23:27 by rmk")
                                                              (* ; "Edited  9-Oct-2023 11:48 by rmk")
@@ -1488,23 +1456,24 @@
         (* ;; "If we're extending a selection and the looks haven't changed, we can try doing it the fast way, to prevent flicker.")
 
         (\TEDIT.UPDATE.SHOWSEL SOURCESEL OLDSEL TEXTOBJ)
-        (\COPYSEL SOURCESEL OLDSEL)
+        (\TEDIT.COPYSEL SOURCESEL OLDSEL)
         (SETSEL OLDSEL ONFLG T)
         OLDSEL)
        (T                                                    (* ; 
                 "Otherwise, we have to turn the old one off, change things, and turn the new one on.")
-          (\SHOWSEL OLDSEL NIL)
+          (\TEDIT.SHOWSEL OLDSEL NIL NIL TEXTOBJ)
           (SETSEL OLDSEL SET NIL)
           (CL:UNLESS (EQ OLDOP NEWOP)
                  (\TEDIT.SET.SEL.LOOKS SOURCESEL NEWOP))
-          (\COPYSEL SOURCESEL OLDSEL)
+          (\TEDIT.COPYSEL SOURCESEL OLDSEL)
           (SETSEL OLDSEL ONFLG NIL)                          (* ; 
                                                          "Make sure we can turn the highlighting on.")
-          (\SHOWSEL OLDSEL T)
+          (\TEDIT.SHOWSEL OLDSEL T NIL TEXTOBJ)
           OLDSEL])
 
 (\TEDIT.UPDATE.SEL
-  [LAMBDA (SEL CH# DCH POINT DONTFIX)                        (* ; "Edited  5-Mar-2024 14:45 by rmk")
+  [LAMBDA (SEL CH# DCH POINT DONTFIX)                        (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited  5-Mar-2024 14:45 by rmk")
                                                              (* ; "Edited 25-Feb-2024 17:30 by rmk")
                                                              (* ; "Edited 16-Feb-2024 23:49 by rmk")
                                                              (* ; "Edited 17-Sep-2023 00:05 by rmk")
@@ -1559,7 +1528,7 @@
          (FSETSEL SEL SET T)                                 (* ; "")
          (FSETSEL SEL SELOBJ NIL)                            (* ; 
                                     "If we are moving around, we are moving away from any old object")
-         (CL:UNLESS DONTFIX (\FIXSEL SEL))
+         (CL:UNLESS DONTFIX (\TEDIT.FIXSEL SEL))
          SEL])
 
 (\TEDIT.SEL.L1
@@ -1610,7 +1579,7 @@
 )
 (DEFINEQ
 
-(\COPYSEL
+(\TEDIT.COPYSEL
   [LAMBDA (FROM TO)                                          (* ; "Edited 24-Jan-2024 09:37 by rmk")
                                                              (* ; "Edited 25-Oct-2023 22:24 by rmk")
                                                              (* ; "Edited 22-Oct-2023 23:05 by rmk")
@@ -1668,6 +1637,275 @@
 
 
 
+(* ;; "SELPIECES")
+
+(DEFINEQ
+
+(\TEDIT.SELPIECES
+  [LAMBDA (SEL/FIRSTCHAR LASTCHAR TEXTOBJ)                   (* ; "Edited 17-Mar-2024 00:24 by rmk")
+                                                             (* ; "Edited  4-Mar-2024 22:47 by rmk")
+                                                             (* ; "Edited 12-Dec-2023 12:06 by rmk")
+                                                             (* ; "Edited 11-Dec-2023 10:05 by rmk")
+                                                             (* ; "Edited  2-Jun-2023 20:36 by rmk")
+                                                             (* ; "Edited 31-May-2023 10:27 by rmk")
+                                                             (* ; "Edited  5-Sep-2022 14:40 by rmk")
+
+    (* ;; "This converts a selection to the SELPIECES of the properly aligned pieces that SEL/FIRSTCHAR selects. .")
+
+    (* ;; "The first character of SPFIRST is the first character selected in TEXTOBJ and the last character of SPLAST is the last character of the last  selected piece in TEXTOBJ. The pieces maintain their chain-sequence pointers in TEXTOBJ.  The pieces must be copied and re-chained if they are going to be used in any way that is inconsistent with where they may still be linked into the text.")
+
+    (* ;; "")
+
+    (* ;; "A prefix of the piece containing FIRSTCHAR in TEXTOBJ may be split off, to provide a properly aligned suffix.")
+
+    (* ;; "LIkewise, a suffix of the piece containing  LASTCHAR may be split off, to povide a properly aligned prefix.")
+
+    (* ;; "SPLEN is the sum of the lengths of the selected pieces.")
+
+    (* ;; "The I.S.OPR inselpieces iterates over the pieces in SELPIECES.")
+
+    (* ;; "")
+
+    (* ;; "For convenience the %"selection%" can be specified by FIRSTCHAR and LASTCHAR parameters, plus TEXTOBJ.  ")
+
+    (LET (FIRSTCHAR LEFTPC RIGHTPC)
+         (if (type? SELECTION SEL/FIRSTCHAR)
+             then (SETQ TEXTOBJ (FGETSEL SEL/FIRSTCHAR SELTEXTOBJ))
+                  (SETQ FIRSTCHAR (FGETSEL SEL/FIRSTCHAR CH#))
+                  [SETQ LASTCHAR (CL:IF (EQ 0 (FGETSEL SEL/FIRSTCHAR DCH))
+                                     FIRSTCHAR
+                                     (SUB1 (FGETSEL SEL/FIRSTCHAR CHLIM)))]
+           elseif (type? TEDITHISTORYEVENT SEL/FIRSTCHAR)
+             then (SETQ FIRSTCHAR (GETTH SEL/FIRSTCHAR THCH#))
+                  (SETQ LASTCHAR (SUB1 (GETTH SEL/FIRSTCHAR THCHLIM)))
+           else (SETQ FIRSTCHAR SEL/FIRSTCHAR))
+
+         (* ;; "Do the right first so that we retain the center piece when FIRTCHAR and LASTCHAR are in the same original piece.")
+
+         (SETQ RIGHTPC (\TEDIT.ALIGNEDPIECE (ADD1 LASTCHAR)
+                              TEXTOBJ))
+         (SETQ LEFTPC (\TEDIT.ALIGNEDPIECE FIRSTCHAR TEXTOBJ))
+         (create SELPIECES
+                SPFIRST _ LEFTPC
+                SPLAST _ (PREVPIECE RIGHTPC)
+                SPLEN _ (ADD1 (IDIFFERENCE LASTCHAR FIRSTCHAR))
+                SPFIRSTCHAR _ FIRSTCHAR
+                SPLASTCHAR _ LASTCHAR])
+
+(\TEDIT.SELPIECES.COPY
+  [LAMBDA (SELPIECES OPERATION TOTEXTOBJ FROMTEXTOBJ)        (* ; "Edited 11-Dec-2023 08:16 by rmk")
+                                                             (* ; "Edited  2-Jun-2023 11:21 by rmk")
+                                                             (* ; "Edited 26-May-2023 00:28 by rmk")
+                                                             (* ; "Edited 21-May-2023 23:01 by rmk")
+                                                             (* ; "Edited  7-May-2023 17:26 by rmk")
+
+    (* ;; "Produces a copy of SELPIECES where the pieces from first to last are chained-together copies of the original pieces so that later inpieces can run from first to last.  OPERATION determines which imageobject functions will be invoked, if any.")
+
+    (* ;; "FROMTEXTOBJ is optional.  Providing a FROMTEXTOBJ that is different from TOTEXTOBJ is a signal that this is a cross-copy needing to create private copies of strings and files.  ")
+
+    (CL:UNLESS FROMTEXTOBJ (SETQ FROMTEXTOBJ TOTEXTOBJ))
+    (for PC NPC PREVPC NEWFIRSTPIECE inselpieces SELPIECES
+       do (SETQ NPC (\TEDIT.COPYPIECE PC FROMTEXTOBJ TOTEXTOBJ NIL OPERATION))
+          (CL:UNLESS NPC                                     (* ; "Was an object-copy disallowed?")
+              (RETURN)) 
+
+          (* ;; "Linke the new pieces together")
+
+          (if PREVPC
+              then (replace (PIECE NEXTPIECE) of PREVPC with NPC)
+            else (SETQ NEWFIRSTPIECE NPC))
+          (replace (PIECE PREVPIECE) of NPC with PREVPC)
+          (SETQ PREVPC NPC) finally (RETURN (create SELPIECES
+                                               using SELPIECES SPFIRST _ NEWFIRSTPIECE SPLAST _ 
+                                                     PREVPC])
+
+(\TEDIT.SELPIECES.CONCAT
+  [LAMBDA (SP1 SP2 TEXTOBJ)                                  (* ; "Edited  3-Mar-2024 12:24 by rmk")
+                                                             (* ; "Edited 11-Dec-2023 23:03 by rmk")
+                                                             (* ; "Edited  3-Jun-2023 17:08 by rmk")
+                                                             (* ; "Edited  2-Jun-2023 12:09 by rmk")
+                                                             (* ; "Edited 21-May-2023 22:20 by rmk")
+
+    (* ;; "The returned SELPIECE concatenates the pieces in SP1 and SP2.  Probably only sensible if those pieces are consecutive with respect to some textobj or some operation. ")
+
+    (* ;; "NOTE:  This modifies the actual pieces to connect them together.  Caller is responsible for insuring that this is safe.")
+
+    (if (NULL (fetch (SELPIECES SPFIRST) of SP1))
+        then SP2
+      elseif (NULL (fetch (SELPIECES SPFIRST) of SP2))
+        then SP1
+      else (freplace (PIECE NEXTPIECE) of (ffetch (SELPIECES SPLAST) of SP1)
+              with (ffetch (SELPIECES SPFIRST) of SP2))
+           (freplace (PIECE PREVPIECE) of (ffetch (SELPIECES SPFIRST) of SP2)
+              with (ffetch (SELPIECES SPLAST) of SP1))
+           (create SELPIECES
+                  SPFIRST _ (ffetch (SELPIECES SPFIRST) of SP1)
+                  SPLAST _ (ffetch (SELPIECES SPLAST) of SP2)
+                  SPLEN _ (IPLUS (ffetch (SELPIECES SPLEN) of SP1)
+                                 (ffetch (SELPIECES SPLEN) of SP2))
+                  SPFIRSTCHAR _ (ffetch (SELPIECES SPFIRSTCHAR) of SP1)
+                  SPLASTCHAR _ (ffetch (SELPIECES SPLASTCHAR) of SP2])
+
+(\TEDIT.SELPIECES.CHARTRANSFORM
+  [LAMBDA (SELPIECES CHARFN OBJECTSTOO TEXTOBJ)              (* ; "Edited  3-Mar-2024 12:28 by rmk")
+                                                             (* ; "Edited 24-May-2023 13:04 by rmk")
+
+    (* ;; "This transforms the characters in SELPIECES according to CHARFN, skipping image objects unless OBJECTSTOO.  The purpose is to allow for character transformations (e.g. case switching) without depending on strings (TEDIT.SELAS.STRING) and character insertion (\INSERTCH) as intermediaries.  Strings can't hold image objects.")
+
+    (* ;; 
+    "This smashes the pieces, use crosscopy \SELPIECES.COPY first to protect the document pieces.")
+
+    (for PC PCONTENTS inselpieces SELPIECES
+       do (SETQ PCONTENTS (PCONTENTS PC))
+          (SELECTC (PTYPE PC)
+              (STRING.PTYPES (for I CH (STR _ PCONTENTS) from 1 while (SETQ CH (NTHCHARCODE STR I))
+                                do (RPLCHARCODE STR I (APPLY* CHARFN CH TEXTOBJ))))
+              (FILE.PTYPES (SETFILEPTR PCONTENTS (PFPOS PC))
+                           [if (AND NIL (\IOMODEP PCONTENTS 'BOTH T))
+                               then 
+
+                                 (* ;; "Not clear whether \TEDIT.COPYPIECeS has set things up to allow us to actually smash the underlying stream. So for now, copy into string space.")
+
+                                    (for I from 1 to (PLEN PC)
+                                       do (\OUTCHAR PCONTENTS (APPLY* CHARFN (\PEEKCCODE PCONTENTS T)
+                                                                     TEXTOBJ)))
+                             else 
+
+                                 (* ;; "This assumes that no file piece has a PLEN greater than \MaxArrayLen characters. We rely on the piece-table reader and writer to guarantee this.  If not, ALLOCSTRING will cause an error.")
+
+                                  (LET ((FATP (NEQ THINFILE.PTYPE (PTYPE PC)))
+                                        STR)
+                                       (SETQ STR (ALLOCSTRING (PLEN PC)
+                                                        NIL NIL FATP))
+                                       (for I from 1 to (PLEN PC)
+                                          do (RPLCHARCODE STR I (APPLY* CHARFN (\INCCODE PCONTENTS)
+                                                                       TEXTOBJ)))
+                                       (FSETPC PC PCONTENTS STR)
+                                       (FSETPC PC PTYPE (CL:IF FATP
+                                                            FATSTRING.PTYPE
+                                                            THINSTRING.PTYPE)])
+              (OBJECT.PTYPE (CL:WHEN OBJECTSTOO
+                                (FSETPC PC PCONTENTS (APPLY* CHARFN PCONTENTS TEXTOBJ))))
+              (SUBSTREAM.PTYPE 
+                   (HELP "SUBSTREAM PIECE ?"))
+              (SHOULDNT)))
+    SELPIECES])
+
+(\TEDIT.SELPIECES.FROM.STRING
+  [LAMBDA (STRING TEXTOBJ CHECKFOREOL CHARLOOKS PARALOOKS)   (* ; "Edited 20-Mar-2024 10:57 by rmk")
+                                                             (* ; "Edited  3-Mar-2024 13:00 by rmk")
+                                                             (* ; "Edited 28-Jan-2024 08:28 by rmk")
+                                                             (* ; "Edited 11-Dec-2023 08:12 by rmk")
+                                                             (* ; "Edited 25-Nov-2023 15:22 by rmk")
+                                                             (* ; "Edited 11-Nov-2023 15:49 by rmk")
+                                                             (* ; "Edited  2-Jun-2023 11:59 by rmk")
+                                                             (* ; "Edited 24-May-2023 15:26 by rmk")
+
+    (* ;; "Creates SELPIECES with pieces representing STRING.  If CHECKFOREOL and the string contains a paragraph-breaking character, then the string will be coded as a sequence of pieces with EOL-terminated pieces (but not necessarily the last piece) marked as PPARALAST. ")
+
+    (TEXTOBJ! TEXTOBJ)
+    (CL:UNLESS CHARLOOKS
+        (SETQ CHARLOOKS (FGETTOBJ TEXTOBJ DEFAULTCHARLOOKS)))
+    (CL:UNLESS PARALOOKS
+        (SETQ PARALOOKS (FGETTOBJ TEXTOBJ FMTSPEC)))
+    (CL:WHEN (AND TEXTOBJ (FGETTOBJ TEXTOBJ FORMATTEDP))
+           (SETQ CHECKFOREOL T))
+    (LET (FIRSTPIECE EOLPOS (BYTESPERCHAR 1)
+                (PTYPE THINSTRING.PTYPE)
+                (PBINABLE T))
+         (SETQ STRING (CONCAT STRING))
+         (CL:WHEN (fetch (STRINGP FATSTRINGP) of STRING)
+             (SETQ PTYPE FATSTRING.PTYPE)
+             (SETQ PBINABLE NIL)
+             (SETQ BYTESPERCHAR 2))
+         (if (AND CHECKFOREOL (SETQ EOLPOS (STRPOS (CONSTANT (CHARACTER (CHARCODE EOL)))
+                                                  STRING)))
+             then 
+                  (* ;; "Break it up into PPARALAST pieces")
+
+                  [bind PC STR PREVPC (NCHARS _ (NCHARS STRING))
+                        (LASTEOLPOS _ 0)
+                     collect (SETQ STR (SUBSTRING STRING (ADD1 LASTEOLPOS)
+                                              (SETQ LASTEOLPOS EOLPOS)))
+                           (PROG1 
+                               (SETQ PC
+                                (create PIECE
+                                       PTYPE _ PTYPE
+                                       PCONTENTS _ STR
+                                       PLEN _ (NCHARS STR)
+                                       PBYTELEN _ (ITIMES (NCHARS STR)
+                                                         BYTESPERCHAR)
+                                       PLOOKS _ CHARLOOKS
+                                       PPARALOOKS _ PARALOOKS
+                                       PPARALAST _ T
+                                       PREVPIECE _ PC
+                                       PBINABLE _ PBINABLE))
+                               (CL:WHEN PREVPC (FSETPC PREVPC NEXTPIECE PC))
+                               (SETQ PREVPC PC)
+                               (SETQ EOLPOS (OR (STRPOS (CONSTANT (CHARACTER (CHARCODE EOL)))
+                                                       STRING
+                                                       (ADD1 LASTEOLPOS))
+                                                NCHARS))) repeatuntil (IGEQ LASTEOLPOS NCHARS)
+                     finally (CL:UNLESS (EQ (CHARCODE EOL)
+                                            (NTHCHARCODE STR -1))
+                                                             (* ; "Last piece didn't end in EOL")
+                                 (FSETPC PC PPARALAST NIL))
+                           (RETURN (create SELPIECES
+                                          SPFIRST _ (CAR $$VAL)
+                                          SPLAST _ PC
+                                          SPLEN _ NCHARS
+                                          SPFIRSTCHAR _ 1
+                                          SPLASTCHAR _ (NCHARS STRING]
+           else (SETQ FIRSTPIECE (create PIECE
+                                        PTYPE _ PTYPE
+                                        PCONTENTS _ STRING
+                                        PLEN _ (NCHARS STRING)
+                                        PBYTELEN _ (ITIMES (NCHARS STRING)
+                                                          BYTESPERCHAR)
+                                        PBYTESPERCHAR _ BYTESPERCHAR
+                                        PBINABLE _ PBINABLE
+                                        PLOOKS _ CHARLOOKS
+                                        PPARALOOKS _ PARALOOKS))
+                (create SELPIECES
+                       SPFIRST _ FIRSTPIECE
+                       SPLAST _ FIRSTPIECE
+                       SPLEN _ (NCHARS STRING)
+                       SPFIRSTCHAR _ 1
+                       SPLASTCHAR _ (NCHARS STRING])
+
+(\TEDIT.SELPIECES.TO.STRING
+  [LAMBDA (SELPIECES OBJECTCHARCODE TEXTOBJ)                 (* ; "Edited  3-Mar-2024 12:24 by rmk")
+                                                             (* ; "Edited  2-Jun-2023 12:07 by rmk")
+                                                             (* ; "Edited 24-May-2023 20:00 by rmk")
+
+    (* ;; "Produce a string representing the contents of SELPIECES.  Optional OBJECTCHARCODE is a code to be used to represent an image object.  If it is a TEXTOBJ with an OBJECTBYTE property, then that code is used.  Otherwise, arbitrarily the escape character.")
+
+    (* ;; "Would it be better to take the chracters from the PREPRINTFN, if present?")
+
+    (for PC PCONTENTS (I _ 1)
+         (RESULT _ (ALLOCSTRING (fetch (SELPIECES SPLEN) of SELPIECES))) inselpieces SELPIECES
+       do (SETQ PCONTENTS (PCONTENTS PC))
+          (SELECTC (PTYPE PC)
+              (STRING.PTYPES (RPLSTRING RESULT I PCONTENTS)
+                             (add I (PLEN PC)))
+              (FILE.PTYPES (SETFILEPTR PCONTENTS (PFPOS PC))
+                           (for J from 1 to (PLEN PC) do (RPLCHARCODE RESULT I (\INCCODE PCONTENTS))
+                                                         (add I 1)))
+              (OBJECT.PTYPE                                  (* ; 
+                               "Could run the PREPRINTFN ?  But we then have to let the string grow.")
+                            (RPLCHARCODE RESULT I (OR (SMALLP OBJECTCHARCODE)
+                                                      [AND (SETQ OBJECTCHARCODE (GETTEXTPROP
+                                                                                 TEXTOBJ
+                                                                                 'OBJECTBYTE]
+                                                      (CHARCODE ESCAPE)))
+                            (add I 1))
+              (SUBSTREAM.PTYPE 
+                   (HELP "SUBSTREAM PIECE?"))
+              (SHOULDNT)) finally (RETURN RESULT])
+)
+
+
+
 (* ;; "User entries to the selection code")
 
 (DEFINEQ
@@ -1736,37 +1974,45 @@
                                   ONFLG _ NIL SET _ T])
 
 (TEDIT.MAKESEL
-  [LAMBDA (STREAM CH# LEN POINT)                             (* ; "Edited 16-Jan-2024 14:52 by rmk")
+  [LAMBDA (STREAM CH# LEN POINT)                             (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 12:03 by rmk")
+                                                             (* ; "Edited 16-Jan-2024 14:52 by rmk")
                                                              (* ; "Edited 23-May-2023 12:39 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:53 by rmk")
                                                              (* ; "Edited 21-Oct-2022 18:37 by rmk")
                                                              (* ; "Edited 30-May-91 23:03 by jds")
     (LET* ((TEXTOBJ (TEXTOBJ STREAM))
            (SEL (FGETTOBJ TEXTOBJ SEL)))
-          (\SHOWSEL SEL NIL)
+          (\TEDIT.SHOWSEL SEL NIL NIL TEXTOBJ)
           (FSETSEL SEL CH# CH#)
           (FSETSEL SEL CHLIM (IMAX CH# (IPLUS CH# LEN)))
           (FSETSEL SEL DCH LEN)
           (FSETSEL SEL POINT (OR POINT 'LEFT))
           (FSETSEL SEL SELTEXTOBJ TEXTOBJ)
           (FSETSEL SEL SET T)
-          (\FIXSEL SEL TEXTOBJ)
-          (\SHOWSEL SEL T])
+          (\TEDIT.FIXSEL SEL TEXTOBJ)
+          (\TEDIT.SHOWSEL SEL T NIL TEXTOBJ])
 
 (TEDIT.SCANSEL
-  [LAMBDA (TSTREAM)                                          (* ; "Edited 26-May-2023 22:35 by rmk")
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 21-Mar-2024 10:49 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:07 by rmk")
+                                                             (* ; "Edited 26-May-2023 22:35 by rmk")
                                                              (* ; "Edited  8-Sep-2022 23:29 by rmk")
                                                              (* ; "Edited 30-May-91 23:03 by jds")
 
     (* ;; "Set up to read the selected text;  return the sel's length or NIL if nothing selected.")
 
-    (LET [(SEL (fetch (TEXTOBJ SEL) of (fetch (TEXTSTREAM TEXTOBJ) of STREAM]
+    (SETQ TSTREAM (TEXTSTREAM TSTREAM))
+    (LET ((SEL (FGETTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
+                      SEL)))
          (CL:WHEN (GETSEL SEL SET)
-             (\TEXTSETFILEPTR TSTREAM (SUB1 (GETSEL SEL CH#)))
-             (GETSEL SEL DCH))])
+             (\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 (FGETSEL SEL CH#)))
+             (FGETSEL SEL DCH))])
 
 (TEDIT.SET.SEL.LOOKS
-  [LAMBDA (SEL OPERATION)                                    (* ; "Edited 12-Oct-2023 22:32 by rmk")
+  [LAMBDA (SEL OPERATION)                                    (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 12:04 by rmk")
+                                                             (* ; "Edited 12-Oct-2023 22:32 by rmk")
                                                              (* ; "Edited 10-Jun-2023 13:35 by rmk")
                                                              (* ; "Edited 20-May-2023 23:53 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:53 by rmk")
@@ -1775,13 +2021,16 @@
     (* ;; "Set what the selection should be displayed like, given what it's for (NORMAL, COPY, MOVE, etc.).  This is a documented entry.")
 
     (LET ((WASON (GETSEL SEL ONFLG)))
-         (\SHOWSEL SEL NIL)
+         (\TEDIT.SHOWSEL SEL NIL NIL (FGETSEL SEL SELTEXTOBJ))
          (\TEDIT.SET.SEL.LOOKS SEL OPERATION)
-         (\SHOWSEL SEL WASON)
+         (\TEDIT.SHOWSEL SEL WASON NIL (FGETSEL SEL SELTEXTOBJ))
          SEL])
 
 (TEDIT.SETSEL
   [LAMBDA (STREAM CH# LEN POINT PENDINGDELFLG LEAVECARETLOOKS OPERATION)
+                                                             (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:38 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 12:04 by rmk")
                                                              (* ; "Edited 22-Sep-2023 18:09 by rmk")
                                                              (* ; "Edited  3-Aug-2023 23:12 by rmk")
                                                              (* ; "Edited 23-May-2023 16:50 by rmk")
@@ -1795,11 +2044,11 @@
           SEL TEXTLEN PC)
          (SETQ SEL (TEXTSEL TEXTOBJ))
          (SETQ TEXTLEN (TEXTLEN TEXTOBJ))
-         (\SHOWSEL SEL NIL)                                  (* ; "First turn the old sel off.")
+         (\TEDIT.SHOWSEL SEL NIL NIL TEXTOBJ)                (* ; "First turn the old sel off.")
          [COND
             ((type? SELECTION CH#)                           (* ; 
                                                           "He gave use a selection;  just plug it in")
-             (\COPYSEL CH# SEL)                              (* ; 
+             (\TEDIT.COPYSEL CH# SEL)                        (* ; 
                                                              "And make sure it can be turned on.")
              (SETSEL SEL ONFLG NIL))
             (T                                               (* ; 
@@ -1827,7 +2076,7 @@
                                    elseif POINT
                                    else 'LEFT))              (* ; "Which side the caret should go on")
                (FSETSEL SEL SELOBJ (CL:WHEN (EQ 1 LEN)       (* ; "If CH# beyond TEXTLEN, LEN is 0")
-                                       (SETQ PC (\CHTOPC (GETSEL SEL CH#)
+                                       (SETQ PC (\TEDIT.CHTOPC (GETSEL SEL CH#)
                                                        TEXTOBJ))
                                        (CL:WHEN (EQ OBJECT.PTYPE (PTYPE PC))
                                               (PCONTENTS PC)))]
@@ -1841,20 +2090,22 @@
                    (\TEDIT.SET.SEL.LOOKS SEL (OR OPERATION 'PENDINGDEL]
             (T                                               (* ; 
                                                     "This selection is to be a pending-deletion sel.")
-               (TEDIT.RESET.EXTEND.PENDING.DELETE SEL)
+               (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ)
                (\TEDIT.SET.SEL.LOOKS SEL (OR OPERATION 'NORMAL]
          (SETSEL SEL SET T)                                  (* ; 
                                                       "Mark the selection as valid for others to use")
          (CL:UNLESS LEAVECARETLOOKS                          (* ; 
                                                              "And set the insertion looks to follow.")
              (SETTOBJ TEXTOBJ CARETLOOKS (\TEDIT.GET.INSERT.CHARLOOKS TEXTOBJ SEL)))
-         (\FIXSEL SEL TEXTOBJ)                               (* ; 
+         (\TEDIT.FIXSEL SEL TEXTOBJ)                         (* ; 
                                                              "Update the selection's screen location")
-         (\SHOWSEL SEL T)                                    (* ; "Highlight it on the screen")
+         (\TEDIT.SHOWSEL SEL T NIL TEXTOBJ)                  (* ; "Highlight it on the screen")
          SEL])
 
 (TEDIT.SHOWSEL
-  [LAMBDA (STREAM ONFLG SEL)                                 (* ; "Edited  3-May-2023 09:23 by rmk")
+  [LAMBDA (STREAM ONFLG SEL)                                 (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 12:06 by rmk")
+                                                             (* ; "Edited  3-May-2023 09:23 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:54 by rmk")
                                                              (* ; "Edited 21-Oct-2022 18:36 by rmk")
 
@@ -1862,298 +2113,82 @@
                                                              (* ; "Edited 30-May-91 23:04 by jds")
     (LET ((TEXTOBJ (TEXTOBJ STREAM)))
          (CL:UNLESS SEL
-             (SETQ SEL (fetch (TEXTOBJ SEL) of TEXTOBJ)))
+             (SETQ SEL (FGETTOBJ TEXTOBJ SEL)))
          (CL:WHEN SEL
              (SETSEL SEL SELTEXTOBJ TEXTOBJ)
-             (\FIXSEL SEL TEXTOBJ)
-             (\SHOWSEL SEL ONFLG))])
-)
+             (\TEDIT.FIXSEL SEL TEXTOBJ)
+             (\TEDIT.SHOWSEL SEL ONFLG NIL TEXTOBJ))])
 
+(TEDIT.SEL.AS.STRING
+  [LAMBDA (TSTREAM SEL)                                      (* ; "Edited 17-Mar-2024 12:05 by rmk")
+                                                             (* ; "Edited 27-Jan-2024 22:57 by rmk")
+                                                             (* ; "Edited 23-May-2023 12:36 by rmk")
+                                                             (* ; "Edited  8-Sep-2022 23:35 by rmk")
+                                                             (* ; "Edited 22-Apr-93 16:44 by jds")
 
-
-(* ;; "SELPIECES")
-
-(DEFINEQ
-
-(\SELPIECES
-  [LAMBDA (SEL/FIRSTCHAR LASTCHAR TEXTOBJ)                   (* ; "Edited 16-Mar-2024 16:30 by rmk")
-                                                             (* ; "Edited  4-Mar-2024 22:47 by rmk")
-                                                             (* ; "Edited 12-Dec-2023 12:06 by rmk")
-                                                             (* ; "Edited 11-Dec-2023 10:05 by rmk")
-                                                             (* ; "Edited  2-Jun-2023 20:36 by rmk")
-                                                             (* ; "Edited 31-May-2023 10:27 by rmk")
-                                                             (* ; "Edited  5-Sep-2022 14:40 by rmk")
-
-    (* ;; "This converts a selection to the SELPIECES of the properly aligned pieces that SEL/FIRSTCHAR selects. .")
-
-    (* ;; "The first character of SPFIRST is the first character selected in TEXTOBJ and the last character of SPLAST is the last character of the last  selected piece in TEXTOBJ. The pieces maintain their chain-sequence pointers in TEXTOBJ.  The pieces must be copied and re-chained if they are going to be used in any way that is inconsistent with where they may still be linked into the text.")
-
-    (* ;; "")
-
-    (* ;; "A prefix of the piece containing FIRSTCHAR in TEXTOBJ may be split off, to provide a properly aligned suffix.")
-
-    (* ;; "LIkewise, a suffix of the piece containing  LASTCHAR may be split off, to povide a properly aligned prefix.")
-
-    (* ;; "SPLEN is the sum of the lengths of the selected pieces.")
-
-    (* ;; "The I.S.OPR inselpieces iterates over the pieces in SELPIECES.")
-
-    (* ;; "")
-
-    (* ;; "For convenience the %"selection%" can be specified by FIRSTCHAR and LASTCHAR parameters, plus TEXTOBJ.  ")
-
-    (LET (FIRSTCHAR LEFTPC RIGHTPC)
-         (if (type? SELECTION SEL/FIRSTCHAR)
-             then (SETQ TEXTOBJ (FGETSEL SEL/FIRSTCHAR SELTEXTOBJ))
-                  (SETQ FIRSTCHAR (FGETSEL SEL/FIRSTCHAR CH#))
-                  [SETQ LASTCHAR (CL:IF (EQ 0 (FGETSEL SEL/FIRSTCHAR DCH))
-                                     FIRSTCHAR
-                                     (SUB1 (FGETSEL SEL/FIRSTCHAR CHLIM)))]
-           elseif (type? TEDITHISTORYEVENT SEL/FIRSTCHAR)
-             then (SETQ FIRSTCHAR (GETTH SEL/FIRSTCHAR THCH#))
-                  (SETQ LASTCHAR (SUB1 (GETTH SEL/FIRSTCHAR THCHLIM)))
-           else (SETQ FIRSTCHAR SEL/FIRSTCHAR))
-
-         (* ;; "Do the right first so that we retain the center piece when FIRTCHAR and LASTCHAR are in the same original piece.")
-
-         (SETQ RIGHTPC (\ALIGNEDPIECE (ADD1 LASTCHAR)
-                              TEXTOBJ))
-         (SETQ LEFTPC (\ALIGNEDPIECE FIRSTCHAR TEXTOBJ))
-         (create SELPIECES
-                SPFIRST _ LEFTPC
-                SPLAST _ (PREVPIECE RIGHTPC)
-                SPLEN _ (ADD1 (IDIFFERENCE LASTCHAR FIRSTCHAR))
-                SPFIRSTCHAR _ FIRSTCHAR
-                SPLASTCHAR _ LASTCHAR])
-
-(\SELPIECES.COPY
-  [LAMBDA (SELPIECES OPERATION TOTEXTOBJ FROMTEXTOBJ)        (* ; "Edited 11-Dec-2023 08:16 by rmk")
-                                                             (* ; "Edited  2-Jun-2023 11:21 by rmk")
-                                                             (* ; "Edited 26-May-2023 00:28 by rmk")
-                                                             (* ; "Edited 21-May-2023 23:01 by rmk")
-                                                             (* ; "Edited  7-May-2023 17:26 by rmk")
-
-    (* ;; "Produces a copy of SELPIECES where the pieces from first to last are chained-together copies of the original pieces so that later inpieces can run from first to last.  OPERATION determines which imageobject functions will be invoked, if any.")
-
-    (* ;; "FROMTEXTOBJ is optional.  Providing a FROMTEXTOBJ that is different from TOTEXTOBJ is a signal that this is a cross-copy needing to create private copies of strings and files.  ")
-
-    (CL:UNLESS FROMTEXTOBJ (SETQ FROMTEXTOBJ TOTEXTOBJ))
-    (for PC NPC PREVPC NEWFIRSTPIECE inselpieces SELPIECES
-       do (SETQ NPC (\TEDIT.COPYPIECE PC FROMTEXTOBJ TOTEXTOBJ NIL OPERATION))
-          (CL:UNLESS NPC                                     (* ; "Was an object-copy disallowed?")
-              (RETURN)) 
-
-          (* ;; "Linke the new pieces together")
-
-          (if PREVPC
-              then (replace (PIECE NEXTPIECE) of PREVPC with NPC)
-            else (SETQ NEWFIRSTPIECE NPC))
-          (replace (PIECE PREVPIECE) of NPC with PREVPC)
-          (SETQ PREVPC NPC) finally (RETURN (create SELPIECES
-                                               using SELPIECES SPFIRST _ NEWFIRSTPIECE SPLAST _ 
-                                                     PREVPC])
-
-(\SELPIECES.CONCAT
-  [LAMBDA (SP1 SP2 TEXTOBJ)                                  (* ; "Edited  3-Mar-2024 12:24 by rmk")
-                                                             (* ; "Edited 11-Dec-2023 23:03 by rmk")
-                                                             (* ; "Edited  3-Jun-2023 17:08 by rmk")
-                                                             (* ; "Edited  2-Jun-2023 12:09 by rmk")
-                                                             (* ; "Edited 21-May-2023 22:20 by rmk")
-
-    (* ;; "The returned SELPIECE concatenates the pieces in SP1 and SP2.  Probably only sensible if those pieces are consecutive with respect to some textobj or some operation. ")
-
-    (* ;; "NOTE:  This modifies the actual pieces to connect them together.  Caller is responsible for insuring that this is safe.")
-
-    (if (NULL (fetch (SELPIECES SPFIRST) of SP1))
-        then SP2
-      elseif (NULL (fetch (SELPIECES SPFIRST) of SP2))
-        then SP1
-      else (freplace (PIECE NEXTPIECE) of (ffetch (SELPIECES SPLAST) of SP1)
-              with (ffetch (SELPIECES SPFIRST) of SP2))
-           (freplace (PIECE PREVPIECE) of (ffetch (SELPIECES SPFIRST) of SP2)
-              with (ffetch (SELPIECES SPLAST) of SP1))
-           (create SELPIECES
-                  SPFIRST _ (ffetch (SELPIECES SPFIRST) of SP1)
-                  SPLAST _ (ffetch (SELPIECES SPLAST) of SP2)
-                  SPLEN _ (IPLUS (ffetch (SELPIECES SPLEN) of SP1)
-                                 (ffetch (SELPIECES SPLEN) of SP2))
-                  SPFIRSTCHAR _ (ffetch (SELPIECES SPFIRSTCHAR) of SP1)
-                  SPLASTCHAR _ (ffetch (SELPIECES SPLASTCHAR) of SP2])
-
-(\SELPIECES.CHARTRANSFORM
-  [LAMBDA (SELPIECES CHARFN OBJECTSTOO TEXTOBJ)              (* ; "Edited  3-Mar-2024 12:28 by rmk")
-                                                             (* ; "Edited 24-May-2023 13:04 by rmk")
-
-    (* ;; "This transforms the characters in SELPIECES according to CHARFN, skipping image objects unless OBJECTSTOO.  The purpose is to allow for character transformations (e.g. case switching) without depending on strings (TEDIT.SELAS.STRING) and character insertion (\INSERTCH) as intermediaries.  Strings can't hold image objects.")
+    (* ;; "RMK:  WHAT IF THE STREAM CONTAINS AN OBJECT?")
 
     (* ;; 
-    "This smashes the pieces, use crosscopy \SELPIECES.COPY first to protect the document pieces.")
+    "Given a text stream, go to the TEXTOBJ, get the current selection, and return it as a string.")
 
-    (for PC PCONTENTS inselpieces SELPIECES
-       do (SETQ PCONTENTS (PCONTENTS PC))
-          (SELECTC (PTYPE PC)
-              (STRING.PTYPES (for I CH (STR _ PCONTENTS) from 1 while (SETQ CH (NTHCHARCODE STR I))
-                                do (RPLCHARCODE STR I (APPLY* CHARFN CH TEXTOBJ))))
-              (FILE.PTYPES (SETFILEPTR PCONTENTS (PFPOS PC))
-                           [if (AND NIL (\IOMODEP PCONTENTS 'BOTH T))
-                               then 
+    (SETQ TSTREAM (TEXTSTREAM TSTREAM))
+    (CL:UNLESS SEL
+        (SETQ SEL (GETTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
+                         SEL)))
+    (LET (RESULT (LEN (GETSEL SEL DCH)))
+         (COND
+            ((ZEROP LEN)                                     (* ; 
+                                              "There is no selection, or it's zero-width.  Return ''")
+             (CONCAT ""))
+            (T (SETQ RESULT (ALLOCSTRING LEN (CHARCODE SPACE)))
+                                                             (* ; "The resulting string")
+               (\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 (GETSEL SEL CH#)))
+                                                             (* ; 
+                                               "Starting point for the string is start of selection.")
+               (for I from 1 to LEN do (RPLCHARCODE RESULT I (BIN TSTREAM)))
+               RESULT])
 
-                                 (* ;; "Not clear whether \TEDIT.COPYPIECeS has set things up to allow us to actually smash the underlying stream. So for now, copy into string space.")
+(TEDIT.SEL.AS.SEXPR
+  [LAMBDA (TSTREAM SEL RDTBL FLG)                            (* ; "Edited 17-Mar-2024 12:05 by rmk")
+                                                             (* ; "Edited 25-Dec-2023 18:52 by rmk")
+                                                             (* ; "Edited  9-Jul-2023 09:37 by rmk")
+                                                             (* ; "Edited 22-Apr-93 16:44 by jds")
 
-                                    (for I from 1 to (PLEN PC)
-                                       do (\OUTCHAR PCONTENTS (APPLY* CHARFN (\PEEKCCODE PCONTENTS T)
-                                                                     TEXTOBJ)))
-                             else 
+    (* ;; "Return an s-expression from the characters defined by SEL's point position.")
 
-                                 (* ;; "This assumes that no file piece has a PLEN greater than \MaxArrayLen characters. We rely on the piece-table reader and writer to guarantee this.  If not, ALLOCSTRING will cause an error.")
+    (* ;; "This backs up to the beginning of the word that precedes the caret, then READ's from there.  A little tricky to point to the paren in front of an atom, to get a complete list structure and not just the initial atom.")
 
-                                  (LET ((FATP (NEQ THINFILE.PTYPE (PTYPE PC)))
-                                        STR)
-                                       (SETQ STR (ALLOCSTRING (PLEN PC)
-                                                        NIL NIL FATP))
-                                       (for I from 1 to (PLEN PC)
-                                          do (RPLCHARCODE STR I (APPLY* CHARFN (\INCCODE PCONTENTS)
-                                                                       TEXTOBJ)))
-                                       (FSETPC PC PCONTENTS STR)
-                                       (FSETPC PC PTYPE (CL:IF FATP
-                                                            FATSTRING.PTYPE
-                                                            THINSTRING.PTYPE)])
-              (OBJECT.PTYPE (CL:WHEN OBJECTSTOO
-                                (FSETPC PC PCONTENTS (APPLY* CHARFN PCONTENTS TEXTOBJ))))
-              (SUBSTREAM.PTYPE 
-                   (HELP "SUBSTREAM PIECE ?"))
-              (SHOULDNT)))
-    SELPIECES])
+    (SETQ TSTREAM (TEXTSTREAM TSTREAM))
+    [\TEDIT.TEXTSETFILEPTR TSTREAM (SUB1 (\TEDIT.WORD.FIRST (TEXTOBJ TSTREAM)
+                                                (TEDIT.GETPOINT TSTREAM SEL)
+                                                (TEDIT.ATOMBOUND.READTABLE (OR RDTBL *READTABLE*]
+    (READ TSTREAM RDTBL FLG])
 
-(\SELPIECES.FROM.STRING
-  [LAMBDA (STRING TEXTOBJ CHECKFOREOL CHARLOOKS PARALOOKS)   (* ; "Edited  3-Mar-2024 13:00 by rmk")
-                                                             (* ; "Edited 28-Jan-2024 08:28 by rmk")
-                                                             (* ; "Edited 11-Dec-2023 08:12 by rmk")
-                                                             (* ; "Edited 25-Nov-2023 15:22 by rmk")
-                                                             (* ; "Edited 11-Nov-2023 15:49 by rmk")
-                                                             (* ; "Edited  2-Jun-2023 11:59 by rmk")
-                                                             (* ; "Edited 24-May-2023 15:26 by rmk")
-
-    (* ;; "Creates SELPIECES with pieces representing STRING.  If CHECKFOREOL and the string contains a paragraph-breaking character, then the string will be coded as a sequence of pieces with EOL-terminated pieces (but not necessarily the last piece) marked as PPARALAST. ")
-
-    (\DTEST TEXTOBJ 'TEXTOBJ)
-    (CL:UNLESS CHARLOOKS
-        (SETQ CHARLOOKS (FGETTOBJ TEXTOBJ DEFAULTCHARLOOKS)))
-    (CL:UNLESS PARALOOKS
-        (SETQ PARALOOKS (FGETTOBJ TEXTOBJ FMTSPEC)))
-    (CL:WHEN (AND TEXTOBJ (FGETTOBJ TEXTOBJ FORMATTEDP))
-           (SETQ CHECKFOREOL T))
-    (LET (FIRSTPIECE EOLPOS (BYTESPERCHAR 1)
-                (PTYPE THINSTRING.PTYPE)
-                (PBINABLE T))
-         (SETQ STRING (CONCAT STRING))
-         (CL:WHEN (fetch (STRINGP FATSTRINGP) of STRING)
-             (SETQ PTYPE FATSTRING.PTYPE)
-             (SETQ PBINABLE NIL)
-             (SETQ BYTESPERCHAR 2))
-         (if (AND CHECKFOREOL (SETQ EOLPOS (STRPOS (CONSTANT (CHARACTER (CHARCODE EOL)))
-                                                  STRING)))
-             then 
-                  (* ;; "Break it up into PPARALAST pieces")
-
-                  [bind PC STR PREVPC (NCHARS _ (NCHARS STRING))
-                        (LASTEOLPOS _ 0)
-                     collect (SETQ STR (SUBSTRING STRING (ADD1 LASTEOLPOS)
-                                              (SETQ LASTEOLPOS EOLPOS)))
-                           (PROG1 
-                               (SETQ PC
-                                (create PIECE
-                                       PTYPE _ PTYPE
-                                       PCONTENTS _ STR
-                                       PLEN _ (NCHARS STR)
-                                       PBYTELEN _ (ITIMES (NCHARS STR)
-                                                         BYTESPERCHAR)
-                                       PLOOKS _ CHARLOOKS
-                                       PPARALOOKS _ PARALOOKS
-                                       PPARALAST _ T
-                                       PREVPIECE _ PC
-                                       PBINABLE _ PBINABLE))
-                               (CL:WHEN PREVPC (FSETPC PREVPC NEXTPIECE PC))
-                               (SETQ PREVPC PC)
-                               (SETQ EOLPOS (OR (STRPOS (CONSTANT (CHARACTER (CHARCODE EOL)))
-                                                       STRING
-                                                       (ADD1 LASTEOLPOS))
-                                                NCHARS))) repeatuntil (IGEQ LASTEOLPOS NCHARS)
-                     finally (CL:UNLESS (EQ (CHARCODE EOL)
-                                            (NTHCHARCODE STR -1))
-                                                             (* ; "Last piece didn't end in EOL")
-                                 (FSETPC PC PPARALAST NIL))
-                           (RETURN (create SELPIECES
-                                          SPFIRST _ (CAR $$VAL)
-                                          SPLAST _ PC
-                                          SPLEN _ NCHARS
-                                          SPFIRSTCHAR _ 1
-                                          SPLASTCHAR _ (NCHARS STRING]
-           else (SETQ FIRSTPIECE (create PIECE
-                                        PTYPE _ PTYPE
-                                        PCONTENTS _ STRING
-                                        PLEN _ (NCHARS STRING)
-                                        PBYTELEN _ (ITIMES (NCHARS STRING)
-                                                          BYTESPERCHAR)
-                                        PBYTESPERCHAR _ BYTESPERCHAR
-                                        PBINABLE _ PBINABLE
-                                        PLOOKS _ CHARLOOKS
-                                        PPARALOOKS _ PARALOOKS))
-                (create SELPIECES
-                       SPFIRST _ FIRSTPIECE
-                       SPLAST _ FIRSTPIECE
-                       SPLEN _ (NCHARS STRING)
-                       SPFIRSTCHAR _ 1
-                       SPLASTCHAR _ (NCHARS STRING])
-
-(\SELPIECES.TO.STRING
-  [LAMBDA (SELPIECES OBJECTCHARCODE TEXTOBJ)                 (* ; "Edited  3-Mar-2024 12:24 by rmk")
-                                                             (* ; "Edited  2-Jun-2023 12:07 by rmk")
-                                                             (* ; "Edited 24-May-2023 20:00 by rmk")
-
-    (* ;; "Produce a string representing the contents of SELPIECES.  Optional OBJECTCHARCODE is a code to be used to represent an image object.  If it is a TEXTOBJ with an OBJECTBYTE property, then that code is used.  Otherwise, arbitrarily the escape character.")
-
-    (* ;; "Would it be better to take the chracters from the PREPRINTFN, if present?")
-
-    (for PC PCONTENTS (I _ 1)
-         (RESULT _ (ALLOCSTRING (fetch (SELPIECES SPLEN) of SELPIECES))) inselpieces SELPIECES
-       do (SETQ PCONTENTS (PCONTENTS PC))
-          (SELECTC (PTYPE PC)
-              (STRING.PTYPES (RPLSTRING RESULT I PCONTENTS)
-                             (add I (PLEN PC)))
-              (FILE.PTYPES (SETFILEPTR PCONTENTS (PFPOS PC))
-                           (for J from 1 to (PLEN PC) do (RPLCHARCODE RESULT I (\INCCODE PCONTENTS))
-                                                         (add I 1)))
-              (OBJECT.PTYPE                                  (* ; 
-                               "Could run the PREPRINTFN ?  But we then have to let the string grow.")
-                            (RPLCHARCODE RESULT I (OR (SMALLP OBJECTCHARCODE)
-                                                      [AND (SETQ OBJECTCHARCODE (GETTEXTPROP
-                                                                                 TEXTOBJ
-                                                                                 'OBJECTBYTE]
-                                                      (CHARCODE ESCAPE)))
-                            (add I 1))
-              (SUBSTREAM.PTYPE 
-                   (HELP "SUBSTREAM PIECE?"))
-              (SHOULDNT)) finally (RETURN RESULT])
+(TEDIT.SELECTALL
+  [LAMBDA (TEXTSTREAM TEXTOBJ SEL)                           (* ; "Edited 14-Jun-2023 16:58 by rmk")
+                                                            (* ; "Edited  3-May-2020 17:29 by rmk:")
+    (TEDIT.SETSEL TEXTSTREAM 0 (ADD1 (TEXTLEN (TEXTOBJ TEXTSTREAM)))
+           'LEFT])
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (12825 14690 (\TEDIT.SELECTION.DEFPRINT 12835 . 14688)) (14691 15812 (
-\TEDIT.SET.GLOBAL.SELECTIONS 14701 . 15810)) (15849 24084 (TEDIT.SEL.AS.STRING 15859 . 17446) (
-TEDIT.SEL.AS.SEXPR 17448 . 18434) (TEDIT.SELECTALL 18436 . 18766) (TEDIT.SELECTED.PIECES 18768 . 20112
-) (\TEDIT.FIND.PROTECTED.END 20114 . 21603) (\TEDIT.FIND.PROTECTED.START 21605 . 23419) (
-\TEDIT.WORD.BOUND 23421 . 24082)) (24218 55682 (\TEDIT.EXTEND.SEL 24228 . 31204) (\TEDIT.SELECT 31206
- . 32588) (\TEDIT.SCAN.LINE 32590 . 40591) (\TEDIT.SCAN.LINE.WORD 40593 . 44713) (
-\TEDIT.SELECT.LINE.SCANNER 44715 . 51764) (\TEDIT.SELECT.OBJECT 51766 . 55680)) (55683 70577 (\FIXSEL 
-55693 . 66215) (\TEDIT.CHTOX 66217 . 69204) (\TEDIT.COLLECTSELS 69206 . 70257) (\TEDIT.SELECTION.UNSET
- 70259 . 70575)) (70578 73717 (TEDIT.RESET.EXTEND.PENDING.DELETE 70588 . 71425) (\TEDIT.SET.SEL.LOOKS 
-71427 . 73715)) (73718 95099 (\SHOWSEL 73728 . 77446) (\TEDIT.SHOWSEL.HILIGHT 77448 . 80961) (
-\TEDIT.UPDATE.SHOWSEL 80963 . 87276) (\TEDIT.REFRESH.SHOWSEL 87278 . 89514) (\TEDIT.UPDATE.SEL 89516
- . 92638) (\TEDIT.SEL.L1 92640 . 92928) (\TEDIT.SEL.LN 92930 . 93218) (\TEDIT.SEL.DELETEDCHARS 93220
- . 95097)) (95100 98188 (\COPYSEL 95110 . 96798) (\TEDIT.SEL.CHANGED? 96800 . 98186)) (98241 109962 (
-TEDIT.XYTOCH 98251 . 99402) (TEDIT.GETPOINT 99404 . 100353) (TEDIT.GETSEL 100355 . 100675) (
-TEDIT.GETSEL.PARA 100677 . 101626) (TEDIT.MAKESEL 101628 . 102610) (TEDIT.SCANSEL 102612 . 103286) (
-TEDIT.SET.SEL.LOOKS 103288 . 104169) (TEDIT.SETSEL 104171 . 109137) (TEDIT.SHOWSEL 109139 . 109960)) (
-109990 126859 (\SELPIECES 110000 . 113093) (\SELPIECES.COPY 113095 . 114964) (\SELPIECES.CONCAT 114966
- . 116839) (\SELPIECES.CHARTRANSFORM 116841 . 119861) (\SELPIECES.FROM.STRING 119863 . 124778) (
-\SELPIECES.TO.STRING 124780 . 126857)))))
+  (FILEMAP (NIL (13044 14909 (\TEDIT.SELECTION.DEFPRINT 13054 . 14907)) (14910 16170 (
+\TEDIT.SET.GLOBAL.SELECTIONS 14920 . 16168)) (16207 22010 (\TEDIT.SELECTED.PIECES 16217 . 17725) (
+\TEDIT.FIND.PROTECTED.END 17727 . 19331) (\TEDIT.FIND.PROTECTED.START 19333 . 21345) (
+\TEDIT.WORD.BOUND 21347 . 22008)) (22144 54189 (\TEDIT.EXTEND.SEL 22154 . 29251) (\TEDIT.SELECT 29253
+ . 30744) (\TEDIT.SCAN.LINE 30746 . 38862) (\TEDIT.SCAN.LINE.WORD 38864 . 42984) (
+\TEDIT.SELECT.LINE.SCANNER 42986 . 50150) (\TEDIT.SELECT.OBJECT 50152 . 54187)) (54190 69409 (
+\TEDIT.FIXSEL 54200 . 64830) (\TEDIT.CHTOX 64832 . 67934) (\TEDIT.COLLECTSELS 67936 . 69089) (
+\TEDIT.SELECTION.UNSET 69091 . 69407)) (69410 72578 (\TEDIT.RESET.EXTEND.PENDING.DELETE 69420 . 70286)
+ (\TEDIT.SET.SEL.LOOKS 70288 . 72576)) (72579 94114 (\TEDIT.SHOWSEL 72589 . 75959) (
+\TEDIT.SHOWSEL.HILIGHT 75961 . 79474) (\TEDIT.UPDATE.SHOWSEL 79476 . 85910) (\TEDIT.REFRESH.SHOWSEL 
+85912 . 88414) (\TEDIT.UPDATE.SEL 88416 . 91653) (\TEDIT.SEL.L1 91655 . 91943) (\TEDIT.SEL.LN 91945 . 
+92233) (\TEDIT.SEL.DELETEDCHARS 92235 . 94112)) (94115 97209 (\TEDIT.COPYSEL 94125 . 95819) (
+\TEDIT.SEL.CHANGED? 95821 . 97207)) (97237 114256 (\TEDIT.SELPIECES 97247 . 100358) (
+\TEDIT.SELPIECES.COPY 100360 . 102235) (\TEDIT.SELPIECES.CONCAT 102237 . 104116) (
+\TEDIT.SELPIECES.CHARTRANSFORM 104118 . 107144) (\TEDIT.SELPIECES.FROM.STRING 107146 . 112169) (
+\TEDIT.SELPIECES.TO.STRING 112171 . 114254)) (114309 130569 (TEDIT.XYTOCH 114319 . 115470) (
+TEDIT.GETPOINT 115472 . 116421) (TEDIT.GETSEL 116423 . 116743) (TEDIT.GETSEL.PARA 116745 . 117694) (
+TEDIT.MAKESEL 117696 . 118938) (TEDIT.SCANSEL 118940 . 119888) (TEDIT.SET.SEL.LOOKS 119890 . 121059) (
+TEDIT.SETSEL 121061 . 126369) (TEDIT.SHOWSEL 126371 . 127416) (TEDIT.SEL.AS.STRING 127418 . 129120) (
+TEDIT.SEL.AS.SEXPR 129122 . 130235) (TEDIT.SELECTALL 130237 . 130567)))))
 STOP
diff --git a/library/tedit/TEDIT-SELECTION.LCOM b/library/tedit/TEDIT-SELECTION.LCOM
index 6dd6155e..e1c7e1c3 100644
Binary files a/library/tedit/TEDIT-SELECTION.LCOM and b/library/tedit/TEDIT-SELECTION.LCOM differ
diff --git a/library/tedit/TEDIT-STREAM b/library/tedit/TEDIT-STREAM
index 4edfbed5..a9c4d3a8 100644
--- a/library/tedit/TEDIT-STREAM
+++ b/library/tedit/TEDIT-STREAM
@@ -1,12 +1,10 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 4-Mar-2024 22:50:24" {WMEDLEY}<library>tedit>TEDIT-STREAM.;614 141190 
+(FILECREATED " 1-Apr-2024 09:45:47" {WMEDLEY}<library>TEDIT>TEDIT-STREAM.;690 150536 
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS \TEDIT.OPENTEXTSTREAM.PIECES \TEDIT.DELETE.SELPIECES \INSERTCH.HISTORY)
-
-      :PREVIOUS-DATE " 2-Mar-2024 07:10:22" {WMEDLEY}<library>tedit>TEDIT-STREAM.;613)
+      :PREVIOUS-DATE "31-Mar-2024 11:44:49" {WMEDLEY}<library>TEDIT>TEDIT-STREAM.;689)
 
 
 (PRETTYCOMPRINT TEDIT-STREAMCOMS)
@@ -19,55 +17,50 @@
                       (MACROS SETPC FSETPC GETPC FGETPC)
                       (MACROS THINPIECEP)
                       (MACROS VISIBLEPIECEP \NEXT.VISIBLE.PIECE \PREV.VISIBLE.PIECE)
-                      (MACROS GETTOBJ SETTOBJ FGETTOBJ FSETTOBJ TEXTLEN TEXTSEL)
-                      (CONSTANTS (THINFILE.PTYPE 0)
-                             (FATFILE1.PTYPE 1)
-                             (FATFILE2.PTYPE 2)
-                             (THINSTRING.PTYPE 3)
-                             (FATSTRING.PTYPE 4)
-                             (SUBSTREAM.PTYPE 5)
-                             (OBJECT.PTYPE 6)
-                             (LOOKS.PTYPE 7)
-                             (UTF8.PTYPE 11)
-                             (FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE 
-                                                UTF8.PTYPE))
-                             (STRING.PTYPES (LIST THINSTRING.PTYPE FATSTRING.PTYPE))
-                             (BINABLE.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE))
-                             (THIN.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE)))
+                      (MACROS GETTOBJ SETTOBJ FGETTOBJ FSETTOBJ TEXTLEN TEXTSEL TEXTOBJ!)
+                      (CONSTANTS * PTYPES)
                       (GLOBALVARS \TEXTIMAGEOPS \TEXTFDEV)))
         (INITRECORDS PIECE TEXTOBJ TEXTSTREAM)
         (COMS 
               (* ;; "The BIN-level functions")
 
-              (FNS \TEXTBIN \TEXTPEEKBIN \TEXTBACKFILEPTR \TEDIT.INSTALL.FILEBUFFER \TEXTBOUT)
+              (FNS \TEDIT.TEXTBIN \TEDIT.TEXTPEEKBIN \TEDIT.TEXTBACKFILEPTR \TEDIT.TEXTBOUT 
+                   \TEDIT.INSTALL.FILEBUFFER)
               (DECLARE%: EVAL@COMPILE DONTCOPY (MACROS \ENDOFPIECEP \STARTOFPIECEP \ENDOFBUFFERP 
                                                       \STARTOFBUFFERP)))
         
         (* ;; "External format functions:  equivalent to BIN-level except for COUNTP")
 
-        (FNS \TEXTSTREAM.OUTCHARFN \TEXTSTREAM.INCCCODEFN \TEXTSTREAM.BACKCCODEFN 
-             \TEXTSTREAM.FORMATBYTESTREAM)
+        (FNS \TEDIT.TEXTOUTCHARFN \TEDIT.TEXTINCCODEFN \TEDIT.TEXTBACKCCODEFN 
+             \TEDIT.TEXTFORMATBYTESTREAM \TEDIT.TEXTFORMATBYTESTRING)
         
         (* ;; "High-level stream operations")
 
-        (FNS OPENTEXTSTREAM COPYTEXTSTREAM TEDIT.STREAMCHANGEDP TEXTSTREAMP TXTFILE REOPENTEXTSTREAM)
-        (FNS \TEDIT.OPENTEXTSTREAM.PIECES \TEDIT.OPENTEXTSTREAM.PROPS \TEDIT.OPENTEXTSTREAM.SETUP.SEL
-             \TEDIT.OPENTEXTSTREAM.WINDOW \TEDIT.OPENTEXTSTREAM.DEFAULTLOOKS \TEDIT.OPENTEXTFILE 
-             \TEDIT.CREATE.TEXTSTREAM \TEDIT.REOPEN.STREAM \TEXTINIT \TEXTTTYBOUT)
+        (FNS OPENTEXTSTREAM COPYTEXTSTREAM TEDIT.STREAMCHANGEDP TXTFILE)
+        (FNS \TEDIT.REOPENTEXTSTREAM \TEDIT.OPENTEXTSTREAM.PIECES \TEDIT.OPENTEXTSTREAM.PROPS 
+             \TEDIT.OPENTEXTSTREAM.SETUP.SEL \TEDIT.OPENTEXTSTREAM.WINDOW 
+             \TEDIT.OPENTEXTSTREAM.DEFAULTLOOKS \TEDIT.OPENTEXTFILE \TEDIT.CREATE.TEXTSTREAM 
+             \TEDIT.REOPEN.STREAM \TEDIT.TEXTINIT)
+        
+        (* ;; "Is this being used:")
+
+        (FNS \TEDIT.TTYBOUT)
         [INITVARS (*TEDIT-EXTENSIONS* '(TEDIT TED TXT TEXT BRAVO NIL]
         
         (* ;; "Low-level generic stream operations")
 
-        (FNS \TEXTCLOSEF \TEXTDSPFONT \TEXTEOFP \TEXTGETEOFPTR \TEXTGETFILEPTR \TEXTOPENF \TEXTSETEOF
-             \TEXTSETFILEPTR \TEXTDSPXPOSITION \TEXTDSPYPOSITION \TEXTLEFTMARGIN \TEXTRIGHTMARGIN 
-             \TEXTDSPCHARWIDTH \TEXTDSPSTRINGWIDTH \TEXTDSPLINEFEED)
+        (FNS \TEDIT.TEXTCLOSEF \TEDIT.TEXTDSPFONT \TEDIT.TEXTEOFP \TEDIT.TEXTGETEOFPTR 
+             \TEDIT.TEXTGETFILEPTR \TEDIT.TEXTOPENF \TEDIT.TEXTSETEOF \TEDIT.TEXTSETFILEPTR 
+             \TEDIT.TEXTDSPXPOSITION \TEDIT.TEXTDSPYPOSITION \TEDIT.TEXTLEFTMARGIN 
+             \TEDIT.TEXTRIGHTMARGIN \TEDIT.TEXTDSPCHARWIDTH \TEDIT.TEXTDSPSTRINGWIDTH 
+             \TEDIT.TEXTDSPLINEFEED)
         (COMS 
               (* ;; "Editing support")
 
               (DECLARE%: EVAL@COMPILE DONTCOPY (CONSTANTS (INSERTSTRINGLENGTH 512))
                      (MACROS \INSERTCH.EXTENDABLE))
-              (FNS \TEDIT.DELETE.SELPIECES \INSERTCH \INSERTCH.HISTORY \INSERTEOL \INSERTCH.INSERTION
-                   \INSERTCH.EXTEND)
+              (FNS \TEDIT.DELETE.SELPIECES \TEDIT.INSERTCH \TEDIT.INSERTCH.HISTORY \TEDIT.INSERTEOL 
+                   \TEDIT.INSERTCH.INSERTION \TEDIT.INSERTCH.EXTEND)
               (FNS \SETUPGETCH))
                                                              (* ; 
                                                            "Deprecated, maybe still external callers")
@@ -78,7 +71,7 @@
               (* ;; "Support for error handling:  The old error handler for the stream-not-open error.  This is here, because you only want to do this ONCE, even if you load TEXT-STREAM multiple times (as, e.g., in development)")
 
               (INITVARS (*TEDIT-OLD-STREAM-ERROR-HANDLER* (CONDITION-HANDLER 'XCL:STREAM-NOT-OPEN]
-        (DECLARE%: DONTEVAL@LOAD DOCOPY (P (\TEXTINIT)))
+        (DECLARE%: DONTEVAL@LOAD DOCOPY (P (\TEDIT.TEXTINIT)))
         (DECLARE%: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS (ADDVARS (NLAMA)
                                                                              (NLAML)
                                                                              (LAMA TEXTPROP])
@@ -267,6 +260,8 @@
                                   "Function to be called at every piece change when line-formatting.")
             (STARTINGCOFFSET (fetch (STREAM F2) of DATUM)
                    (replace (STREAM F2) of DATUM with NEWVALUE)))
+           [TYPE? (AND (type? STREAM DATUM)
+                       (type? TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of DATUM]
            (CREATE (create STREAM
                           BINABLE _ NIL
                           BOUTABLE _ NIL
@@ -476,7 +471,28 @@
 
 (PUTPROPS TEXTSEL MACRO ((TOBJ)
                          (fetch (TEXTOBJ SEL) of TOBJ)))
+
+(PUTPROPS TEXTOBJ! MACRO ((TOBJ)
+                          (\DTEST TOBJ 'TEXTOBJ)))
 )
+
+(RPAQQ PTYPES
+       ((THINFILE.PTYPE 0)
+        (FATFILE1.PTYPE 1)
+        (FATFILE2.PTYPE 2)
+        (THINSTRING.PTYPE 3)
+        (FATSTRING.PTYPE 4)
+        (SUBSTREAM.PTYPE 5)
+        (OBJECT.PTYPE 6)
+        (LOOKS.PTYPE 7)
+        (UTF16BE.PTYPE 8)
+        (UTF16LE.PTYPE 9)
+        (UTF8.PTYPE 11)
+        (FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE UTF16BE.PTYPE 
+                           UTF16LE.PTYPE))
+        (STRING.PTYPES (LIST THINSTRING.PTYPE FATSTRING.PTYPE))
+        (BINABLE.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE))
+        (THIN.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE))))
 (DECLARE%: EVAL@COMPILE 
 
 (RPAQQ THINFILE.PTYPE 0)
@@ -495,9 +511,14 @@
 
 (RPAQQ LOOKS.PTYPE 7)
 
+(RPAQQ UTF16BE.PTYPE 8)
+
+(RPAQQ UTF16LE.PTYPE 9)
+
 (RPAQQ UTF8.PTYPE 11)
 
-(RPAQ FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE))
+(RPAQ FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE UTF16BE.PTYPE 
+                        UTF16LE.PTYPE))
 
 (RPAQ STRING.PTYPES (LIST THINSTRING.PTYPE FATSTRING.PTYPE))
 
@@ -514,8 +535,11 @@
        (SUBSTREAM.PTYPE 5)
        (OBJECT.PTYPE 6)
        (LOOKS.PTYPE 7)
+       (UTF16BE.PTYPE 8)
+       (UTF16LE.PTYPE 9)
        (UTF8.PTYPE 11)
-       (FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE))
+       (FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE UTF16BE.PTYPE 
+                          UTF16LE.PTYPE))
        (STRING.PTYPES (LIST THINSTRING.PTYPE FATSTRING.PTYPE))
        (BINABLE.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE))
        (THIN.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE)))
@@ -625,9 +649,11 @@
 
 (DEFINEQ
 
-(\TEXTBIN
+(\TEDIT.TEXTBIN
   [LAMBDA (TSTREAM)
 
+    (* ;; "Edited 18-Mar-2024 23:34 by rmk")
+
     (* ;; "Edited  3-Feb-2024 14:27 by rmk")
 
     (* ;; "Edited  1-Feb-2024 11:44 by rmk")
@@ -651,166 +677,179 @@
     (DECLARE (LOCALVARS . T))
     (LET ((PC (fetch (TEXTSTREAM PIECE) of TSTREAM))
           (PCCHARSLEFT (ffetch (TEXTSTREAM PCCHARSLEFT) of TSTREAM)))
-         (if (ffetch (STREAM BINABLE) of TSTREAM)
-             then 
-                  (* ;; "The BIN opcode detected a buffer overflow, move either to the next buffer for this piece, or the next piece. The opcode doesn't  manages only COFFSET, so here we have to figure out what4 PCCHARSOFFSET should have been.  NOTE: PCCHARSOFFSET cannot be changed in the stream unless the STARTINGCOFFSET is also bumped to the COFFSET.")
+         (PROG1 (if (ffetch (STREAM BINABLE) of TSTREAM)
+                    then 
+                         (* ;; "The BIN opcode detected a buffer overflow, move either to the next buffer for this piece, or the next piece. The opcode doesn't  manages only COFFSET, so here we have to figure out what4 PCCHARSOFFSET should have been.  NOTE: PCCHARSOFFSET cannot be changed in the stream unless the STARTINGCOFFSET is also bumped to the COFFSET.")
 
-                  (* ;; "The COFFSET goes from 0 to CBUFFSIZE--when it is = to CBUFSIZE we get an overflow.  That maps to 0 in the next buffer.  When we come here in that case, we haven't actually read that characte.")
+                         (* ;; "The COFFSET goes from 0 to CBUFFSIZE--when it is = to CBUFSIZE we get an overflow.  That maps to 0 in the next buffer.  When we come here in that case, we haven't actually read that characte.")
 
-                  [SETQ PCCHARSLEFT (IDIFFERENCE PCCHARSLEFT (IDIFFERENCE (ffetch (STREAM COFFSET)
-                                                                             of TSTREAM)
-                                                                    (ffetch (TEXTSTREAM 
-                                                                                   STARTINGCOFFSET)
-                                                                       of TSTREAM] 
+                         [SETQ PCCHARSLEFT (IDIFFERENCE PCCHARSLEFT (IDIFFERENCE (ffetch (STREAM
+                                                                                          COFFSET)
+                                                                                    of TSTREAM)
+                                                                           (ffetch (TEXTSTREAM 
+                                                                                      STARTINGCOFFSET
+                                                                                          )
+                                                                              of TSTREAM] 
                                                              (* ; "1-byte characters")
-                  (if (\ENDOFPIECEP TSTREAM PCCHARSLEFT)
-                      then 
-                           (* ;; "Move to next piece.  EOF handled below")
+                         (if (\ENDOFPIECEP PCCHARSLEFT)
+                             then 
+                                  (* ;; "Move to next piece.  EOF handled below")
 
-                           (SETQ PC (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE PC)
-                                           0))
-                    else 
-                         (* ;; "Set up for the next buffer in the same piece. We want to set it for the next unread character. We don't SUB1 because the character hasn't yet been read.")
+                                  (SETQ PC (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE PC)
+                                                  0))
+                           else 
+                                (* ;; "Set up for the next buffer in the same piece. We want to set it for the next unread character. We don't SUB1 because the character hasn't yet been read.")
 
-                         (\TEDIT.INSTALL.FILEBUFFER TSTREAM PCCHARSLEFT))
-                  (CL:IF PC
-                      (BIN TSTREAM)
-                      (STREAMOP 'ENDOFSTREAMOP TSTREAM TSTREAM))
-           else 
-                (* ;; 
+                                (\TEDIT.INSTALL.FILEBUFFER TSTREAM PCCHARSLEFT))
+                         (CL:IF PC
+                             (BIN TSTREAM)
+                             (STREAMOP 'ENDOFSTREAMOP TSTREAM TSTREAM))
+                  else 
+                       (* ;; 
  "Not binable, more complicated return values.  Opcode kicked out, didn't test for buffer overflow .")
 
-                (CL:WHEN (\ENDOFBUFFERP TSTREAM)
+                       (CL:WHEN (\ENDOFBUFFERP TSTREAM)
 
-                    (* ;; "Buffer overflow. Installers replace PCCHARSLET")
+                           (* ;; "Buffer overflow. Installers replace PCCHARSLET")
 
-                    [if (\ENDOFPIECEP TSTREAM PCCHARSLEFT)
-                        then (SETQ PC (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE PC)
-                                             0))
-                      else (AND NIL (\TEDIT.INSTALL.FILEBUFFER TSTREAM (SUB1 PCCHARSLEFT])
-                (if (NOT PC)
-                    then (STREAMOP 'ENDOFSTREAMOP TSTREAM TSTREAM)
-                  elseif (ffetch (STREAM BINABLE) of TSTREAM)
-                    then (BIN TSTREAM)
-                  else (ADD (ffetch (TEXTSTREAM PCCHARSLEFT) of TSTREAM)
-                            -1)                              (* ; 
+                           (if (\ENDOFPIECEP PCCHARSLEFT)
+                               then (SETQ PC (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE PC)
+                                                    0))
+                             else (\TEDIT.INSTALL.FILEBUFFER TSTREAM (SUB1 PCCHARSLEFT))))
+                       (if (NOT PC)
+                           then (STREAMOP 'ENDOFSTREAMOP TSTREAM TSTREAM)
+                         elseif (ffetch (STREAM BINABLE) of TSTREAM)
+                           then 
+                                (* ;; "We are here because BIN punted.  If it punted because it reached the end of a binable piece, then we have just advanced to the next piece.  If it's binnable, then try running the opcode on the new situation.  If it punted because we were not working on a binnable piece then and we are looking at one now, then again we must have advanced.")
+
+                                (BIN TSTREAM)
+                         else (ADD (ffetch (TEXTSTREAM PCCHARSLEFT) of TSTREAM)
+                                   -1)                       (* ; 
                                                       "Where we will be when the operation completes")
-                       (SELECTC (PTYPE PC)
-                           (FATSTRING.PTYPE                  (* ; 
+                              (SELECTC (PTYPE PC)
+                                  (FATSTRING.PTYPE           (* ; 
                                                         "This counts offset in characters, not bytes")
-                                (PROG1 (\GETBASEFAT (ffetch (STREAM CBUFPTR) of TSTREAM)
-                                              (ffetch (STREAM COFFSET) of TSTREAM))
-                                    (ADD (ffetch (STREAM COFFSET) of TSTREAM)
-                                         1)))
-                           (FATFILE2.PTYPE 
-                                (PROG1 (\WIN (PCONTENTS PC))
-                                    (ADD (ffetch (STREAM COFFSET) of TSTREAM)
-                                         2)))
-                           (OBJECT.PTYPE 
-                                         (* ;; 
+                                       (PROG1 (\GETBASEFAT (ffetch (STREAM CBUFPTR) of TSTREAM)
+                                                     (ffetch (STREAM COFFSET) of TSTREAM))
+                                           (ADD (ffetch (STREAM COFFSET) of TSTREAM)
+                                                1)))
+                                  (FATFILE2.PTYPE 
+                                       (PROG1 (create WORD
+                                                     HIBYTE _ (BIN (PCONTENTS PC))
+                                                     LOBYTE _ (BIN (PCONTENTS PC)))
+                                           (ADD (ffetch (STREAM COFFSET) of TSTREAM)
+                                                2)))
+                                  (OBJECT.PTYPE 
+                                                (* ;; 
               "Return the object as BIN's result, and make sure we'll go to the next page next time.")
 
-                                         (* ;; 
+                                                (* ;; 
                     "OBJECTBYTE is for callers (like COMPARETEXT) that can't deal with image objects")
 
-                                         (PROG1 (OR (GETTEXTPROP (ffetch (TEXTSTREAM TEXTOBJ)
-                                                                    of TSTREAM)
-                                                           'OBJECTBYTE)
-                                                    (PCONTENTS PC))
-                                             (ADD (ffetch (STREAM COFFSET) of TSTREAM)
-                                                  1)))
-                           (FATFILE1.PTYPE 
-                                (PROG1 (LOGOR (LLSH (PCHARSET PC)
-                                                    8)
-                                              (BIN (PCONTENTS PC)))
-                                    (ADD (ffetch (STREAM COFFSET) of TSTREAM)
-                                         1)))
-                           (UTF8.PTYPE (PROG1 (UTF8.BINCODE (PCONTENTS PC))
+                                                (PROG1 (OR (GETTEXTPROP (ffetch (TEXTSTREAM TEXTOBJ)
+                                                                           of TSTREAM)
+                                                                  'OBJECTBYTE)
+                                                           (PCONTENTS PC))
+                                                    (ADD (ffetch (STREAM COFFSET) of TSTREAM)
+                                                         1)))
+                                  (FATFILE1.PTYPE 
+                                       (PROG1 (create WORD
+                                                     HIBYTE _ (PCHARSET PC)
+                                                     LOBYTE _ (BIN (PCONTENTS PC)))
                                            (ADD (ffetch (STREAM COFFSET) of TSTREAM)
-                                                (PBYTESPERCHAR PC))))
-                           (THINFILE.PTYPE                   (* ; 
+                                                1)))
+                                  (UTF8.PTYPE (PROG1 (UTF8.BINCODE (PCONTENTS PC))
+                                                  (ADD (ffetch (STREAM COFFSET) of TSTREAM)
+                                                       (PBYTESPERCHAR PC))))
+                                  (THINFILE.PTYPE            (* ; 
                                              "Fall through when the underlying stream is not binable")
-                                (PROG1 (BIN (PCONTENTS PC))
-                                    (ADD (ffetch (STREAM COFFSET) of TSTREAM)
-                                         1)))
-                           (SUBSTREAM.PTYPE                  (* ; "A substream stored as an object")
-                                (BIN (IMAGEOBJPROP (PCONTENTS PC)
-                                            'SUBSTREAM)))
-                           (PROGN 
+                                       (PROG1 (BIN (PCONTENTS PC))
+                                           (ADD (ffetch (STREAM COFFSET) of TSTREAM)
+                                                1)))
+                                  (SUBSTREAM.PTYPE           (* ; "A substream stored as an object")
+                                       (BIN (IMAGEOBJPROP (PCONTENTS PC)
+                                                   'SUBSTREAM)))
+                                  (PROGN 
 
                                  (* ;; "For pieces not listed because they require more work. Assumes the function updates COFFSET and that multi-byte characters are safe: don't cross buffer boundaries.")
 
-                                  (HELP "\TEXTBIN UNKNOWN PTYPE" (PTYPE PC])
+                                         (HELP "\TEXTBIN UNKNOWN PTYPE" (PTYPE PC])
 
-(\TEXTPEEKBIN
-  [LAMBDA (TSTREAM NOERROR)                                  (* ; "Edited  1-Feb-2024 11:13 by rmk")
+(\TEDIT.TEXTPEEKBIN
+  [LAMBDA (TSTREAM NOERROR)                                  (* ; "Edited 19-Mar-2024 19:14 by rmk")
+                                                             (* ; "Edited 16-Mar-2024 12:44 by rmk")
+                                                             (* ; "Edited  1-Feb-2024 11:13 by rmk")
                                                              (* ; "Edited  9-Aug-2022 10:19 by rmk")
                                                              (* ; "Edited  7-Aug-2022 23:53 by rmk")
 
-    (* ;; "Return the next character (object) without advancing TSTREAM")
+    (* ;; "Return the next character (object) without advancing TSTREAM.  This may involve moving to the next file buffer or even the next piece.  But there is no need to back out that advance, the new position just anticipates what would happen with any following operations.  What is important, however, is to make sure that the backing stream for file pieces is left at its original position and thus remains consistent with TSTREAM's parameters.")
 
     (DECLARE (LOCALVARS . T))
-    (LET (ORIGPC BUFFERCHANGED (PC (fetch (TEXTSTREAM PIECE) of TSTREAM))
-                (PCCHARSLEFT (ffetch (TEXTSTREAM PCCHARSLEFT) of TSTREAM)))
-         (CL:WHEN (ffetch (STREAM BINABLE) of TSTREAM)       (* ; "See notes at \TEXTBIN")
-             [SETQ PCCHARSLEFT (IDIFFERENCE PCCHARSLEFT (IDIFFERENCE (ffetch (STREAM COFFSET)
-                                                                        of TSTREAM)
-                                                               (ffetch (TEXTSTREAM STARTINGCOFFSET)
-                                                                  of TSTREAM])
-         (CL:WHEN (\ENDOFBUFFERP TSTREAM)                    (* ; "Buffer overflow.")
-             (if (\ENDOFPIECEP TSTREAM PCCHARSLEFT)
-                 then (SETQ ORIGPC PC)
-                      (SETQ PC (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE PC)
-                                      0))
-               else (SETQ BUFFERCHANGED T)
-                    (\TEDIT.INSTALL.FILEBUFFER TSTREAM (SUB1 PCCHARSLEFT))))
-         (if (NOT PC)
-             then (CL:IF NOERROR
-                      NIL
-                      (STREAMOP 'ENDOFSTREAMOP TSTREAM TSTREAM))
-           else (PROG1 (SELECTC (PTYPE PC)
-                           (THINFILE.PTYPE 
-                                (\PEEKBIN (PCONTENTS PC)))
-                           (THINSTRING.PTYPE 
-                                (\GETBASEBYTE (ffetch (STREAM CBUFPTR) of TSTREAM)
-                                       (ffetch (STREAM COFFSET) of TSTREAM)))
-                           (FATSTRING.PTYPE 
-                                (\GETBASEFAT (ffetch (STREAM CBUFPTR) of TSTREAM)
-                                       (ffetch (STREAM COFFSET) of TSTREAM)))
-                           (FATFILE2.PTYPE 
-                                (PROG1 (LOGOR (LLSH (BIN (PCONTENTS PC))
-                                                    8)
-                                              (\PEEKBIN (PCONTENTS PC)))
-                                    (\BACKFILEPTR (PCONTENTS PC))))
-                           (OBJECT.PTYPE 
-                                         (* ;; 
+    (LET ((PC (fetch (TEXTSTREAM PIECE) of TSTREAM))
+          (PCCHARSLEFT (ffetch (TEXTSTREAM PCCHARSLEFT) of TSTREAM))
+          PCONTENTS)
+         (if (ffetch (STREAM BINABLE) of TSTREAM)
+             then 
+                  (* ;; "Buffered pieces:  thin file or thin string.  ")
+
+                  (CL:WHEN (\ENDOFBUFFERP TSTREAM)           (* ; 
+                                       "Buffer overflow. Recover piece status from buffer parameters")
+                      [SETQ PCCHARSLEFT (IDIFFERENCE PCCHARSLEFT (IDIFFERENCE (ffetch (STREAM COFFSET
+                                                                                             )
+                                                                                 of TSTREAM)
+                                                                        (ffetch (TEXTSTREAM 
+                                                                                      STARTINGCOFFSET
+                                                                                       ) of TSTREAM]
+                      (if (\ENDOFPIECEP PCCHARSLEFT)
+                          then (SETQ PC (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE PC)
+                                               0))           (* ; "Also at  piece end")
+                        else (\TEDIT.INSTALL.FILEBUFFER TSTREAM (SUB1 PCCHARSLEFT)))) 
+
+                  (* ;; "TSTREAM is now set up for the next character, possibly for the first byte of the next piece or buffer.  That's OK, no need to restore the old ones.")
+
+           elseif (\ENDOFPIECEP PCCHARSLEFT)
+             then 
+                  (* ;; "Not binnable so the BIN opcode always punts.  If no chars left, we advance the stream to the next piece, which may also set up the buffer for file pieces.  For file streams, the  backing stream is properly positioned, and we only have to restore it to its initial position .  For fat strings, the %"buffer%" covers the whole string.  ")
+
+                  (SETQ PC (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE PC)
+                                  0)))
+         (if PC
+             then (if (ffetch (STREAM BINABLE) of TSTREAM)
+                      then (\GETBASEBYTE (ffetch (STREAM CBUFPTR) of TSTREAM)
+                                  (ffetch (STREAM COFFSET) of TSTREAM))
+                    else (SETQ PCONTENTS (PCONTENTS PC))
+                         (SELECTC (PTYPE PC)
+                             (FATSTRING.PTYPE 
+                                  (\GETBASEFAT (ffetch (STREAM CBUFPTR) of TSTREAM)
+                                         (ffetch (STREAM COFFSET) of TSTREAM)))
+                             (FATFILE2.PTYPE 
+                                  (PROG1 (create WORD
+                                                HIBYTE _ (BIN PCONTENTS)
+                                                LOBYTE _ (\PEEKBIN PCONTENTS))
+                                         (\BACKFILEPTR PCONTENTS)))
+                             (OBJECT.PTYPE 
+                                           (* ;; 
               "Return the object as BIN's result, and make sure we'll go to the next page next time.")
 
-                                         (* ;; 
+                                           (* ;; 
                     "OBJECTBYTE is for callers (like COMPARETEXT) that can't deal with image objects")
 
-                                         (OR (GETTEXTPROP (ffetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
-                                                    'OBJECTBYTE)
-                                             (PCONTENTS PC)))
-                           (UTF8.PTYPE (UTF8.PEEKCCODEFN (PCONTENTS PC)))
-                           (FATFILE1.PTYPE 
-                                (LOGOR (LLSH (PCHARSET PC)
-                                             8)
-                                       (\PEEKBIN (PCONTENTS PC))))
-                           (SUBSTREAM.PTYPE                  (* ; "A substream stored as an object")
-                                (BIN (IMAGEOBJPROP (PCONTENTS PC)
-                                            'SUBSTREAM)))
-                           (SHOULDNT "UNKNOWN PIECE TYPE"))
+                                           (OR (GETTEXTPROP (ffetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
+                                                      'OBJECTBYTE)
+                                               PCONTENTS))
+                             (UTF8.PTYPE (UTF8.PEEKCCODEFN PCONTENTS))
+                             (FATFILE1.PTYPE 
+                                  (create WORD
+                                         HIBYTE _ (PCHARSET PC)
+                                         LOBYTE _ (\PEEKBIN PCONTENTS)))
+                             (SUBSTREAM.PTYPE                (* ; "A substream stored as an object")
+                                  (\PEEKBIN (IMAGEOBJPROP PCONTENTS 'SUBSTREAM)))
+                             (SHOULDNT "UNKNOWN PIECE TYPE")))
+           elseif NOERROR
+             then NIL
+           else (STREAMOP 'ENDOFSTREAMOP TSTREAM TSTREAM])
 
-                    (* ;; "If we had to advance, go back to where we were.")
-
-                    (if ORIGPC
-                        then (\TEDIT.INSTALL.PIECE TSTREAM ORIGPC (IDIFFERENCE (PLEN ORIGPC)
-                                                                         PCCHARSLEFT))
-                      elseif BUFFERCHANGED
-                        then (\TEDIT.INSTALL.FILEBUFFER TSTREAM PCCHARSLEFT)))])
-
-(\TEXTBACKFILEPTR
+(\TEDIT.TEXTBACKFILEPTR
   [LAMBDA (TSTREAM)                                          (* ; "Edited  1-Feb-2024 11:25 by rmk")
                                                              (* ; "Edited  5-Jan-2024 17:57 by rmk")
                                                              (* ; "Edited 28-Dec-2023 13:34 by rmk")
@@ -903,8 +942,49 @@
                                   'SUBSTREAM)))
                  (SHOULDNT "UNKNOWN PIECE TYPE")))])
 
+(\TEDIT.TEXTBOUT
+  [LAMBDA (TSTREAM CHAR)                                     (* ; "Edited 17-Mar-2024 11:59 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:38 by rmk")
+                                                             (* ; "Edited 23-Dec-2023 12:14 by rmk")
+                                                             (* ; "Edited 18-Oct-2023 21:14 by rmk")
+                                                             (* ; "Edited 15-Oct-2023 15:31 by rmk")
+                                                             (* ; "Edited 17-Jun-2023 12:18 by rmk")
+                                                             (* ; "Edited 23-Feb-2023 15:26 by rmk")
+                                                             (* ; "Edited 12-Aug-2022 23:26 by rmk")
+                                                             (* ; "Edited 10-May-93 16:59 by jds")
+
+    (* ;; "Do BOUT to a text stream, which is an insertion at the caret. Unlike EOL's that are typed in at \TEDIT.INSERT, EOL's here don't create paragraph breaks.  We would get a new piece after every line of an image stream")
+
+    (* ;; "ADD1 to convert from %"byte%" indexing to TEDIT selection-indexing.")
+
+    (* ;; "Seems foolish to use \TEXTGETFILEPTR here to map from the current piece to the absolute character index, just so \INSERTCH can map backwards from the character number to the piece.")
+
+    (CL:UNLESS (\CHARCODEP CHAR)
+           (\ILLEGAL.ARG CHAR))
+    (LET ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM))
+          (CH# (ADD1 (\TEDIT.TEXTGETFILEPTR TSTREAM)))
+          INSERTPC WINDOW)
+         (CL:UNLESS (FGETTOBJ TEXTOBJ TXTREADONLY)           (* ; 
+                                                      "Maybe should cause an error--stream not open?")
+             (CL:WHEN (SETQ WINDOW (FGETTOBJ TEXTOBJ \WINDOW))
+                    (\TEDIT.MARK.LINES.DIRTY TEXTOBJ CH# CH#))
+             (CL:WHEN (SETQ INSERTPC (\TEDIT.INSERTCH CHAR CH# TEXTOBJ))
+
+                 (* ;; "We inserted 1 char.  Whether or not we introduced a new piece or extended an old one, we want to be positioned at the first character of the next piece. ")
+
+                 (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE INSERTPC)
+                        0)
+                 (CL:WHEN WINDOW
+                     (\TEDIT.UPDATE.SCREEN TEXTOBJ)
+                     (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE INSERTPC)
+                            0))))                            (* ; 
+                                        "Reformatting advances the stream, go back to the insertion.")
+         CHAR])
+
 (\TEDIT.INSTALL.FILEBUFFER
-  [LAMBDA (TSTREAM PCCHARSLEFT)                              (* ; "Edited 28-Dec-2023 17:53 by rmk")
+  [LAMBDA (TSTREAM PCCHARSLEFT)                              (* ; "Edited 18-Mar-2024 22:01 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 19:37 by rmk")
+                                                             (* ; "Edited 28-Dec-2023 17:53 by rmk")
                                                              (* ; "Edited  7-Dec-2023 16:10 by rmk")
                                                              (* ; "Edited  8-Sep-2023 10:40 by rmk")
                                                              (* ; "Edited  8-Sep-2022 14:17 by rmk")
@@ -914,8 +994,6 @@
 
     (* ;; "Sets up the buffer and buffering parameters ofTSTREAM and the underlying PFILE of its piece so that the next BIN wlil return the character PCCHARSLEFT away from the end of the piece.  PCCHARSLEFT is piecewise, STARTINGCOFFSET and other buffering parameters are bufferwise.")
 
-    (* ;; "The buffer may overflow even when the piece itself is not exhausted.")
-
     (* ;; "Called on buffer overflow when the piece itself is not exhausted.  .")
 
     (* ;; "A binable stream doesn't track the number of 1-byte chars left in this piece, but COFFSET minus STARTINGCOFFSET enables the PCCHARSLEFT to be determined at the end of the buffer.   ")
@@ -925,7 +1003,7 @@
            PCBYTESLEFT)
           (CL:UNLESS (MEMB (PTYPE PC)
                            FILE.PTYPES)
-                 (HELP "FILE BUFFER FOR NON-FILE PIECE" PC))
+              [HELP "FILE BUFFER FOR NON-FILE PIECE" (LIST PC (\TEDIT.PCTOCH PC (TEXTOBJ TSTREAM])
           (CL:UNLESS (AND PFILE (\GETSTREAM PFILE 'INPUT T)) (* ; 
                                                    "The file was closed for some reason;  reopen it.")
               (SETQ PFILE (\TEDIT.REOPEN.STREAM TSTREAM PFILE)))
@@ -959,49 +1037,12 @@
           (freplace (STREAM COFFSET) of TSTREAM with (ffetch (STREAM COFFSET) of PFILE))
           (freplace (TEXTSTREAM STARTINGCOFFSET) of TSTREAM with (fetch (STREAM COFFSET) of TSTREAM))
           (freplace (TEXTSTREAM PCCHARSLEFT) of TSTREAM with PCCHARSLEFT])
-
-(\TEXTBOUT
-  [LAMBDA (TSTREAM CHAR)                                     (* ; "Edited 23-Dec-2023 12:14 by rmk")
-                                                             (* ; "Edited 18-Oct-2023 21:14 by rmk")
-                                                             (* ; "Edited 15-Oct-2023 15:31 by rmk")
-                                                             (* ; "Edited 17-Jun-2023 12:18 by rmk")
-                                                             (* ; "Edited 23-Feb-2023 15:26 by rmk")
-                                                             (* ; "Edited 12-Aug-2022 23:26 by rmk")
-                                                             (* ; "Edited 10-May-93 16:59 by jds")
-
-    (* ;; "Do BOUT to a text stream, which is an insertion at the caret. Unlike EOL's that are typed in at \TEDIT.INSERT, EOL's here don't create paragraph breaks.  We would get a new piece after every line of an image stream")
-
-    (* ;; "ADD1 to convert from %"byte%" indexing to TEDIT selection-indexing.")
-
-    (* ;; "Seems foolish to use \TEXTGETFILEPTR here to map from the current piece to the absolute character index, just so \INSERTCH can map backwards from the character number to the piece.")
-
-    (CL:UNLESS (\CHARCODEP CHAR)
-           (\ILLEGAL.ARG CHAR))
-    (LET ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM))
-          (CH# (ADD1 (\TEXTGETFILEPTR TSTREAM)))
-          INSERTPC WINDOW)
-         (CL:UNLESS (FGETTOBJ TEXTOBJ TXTREADONLY)           (* ; 
-                                                      "Maybe should cause an error--stream not open?")
-             (CL:WHEN (SETQ WINDOW (FGETTOBJ TEXTOBJ \WINDOW))
-                    (\TEDIT.MARK.LINES.DIRTY TEXTOBJ CH# CH#))
-             (CL:WHEN (SETQ INSERTPC (\INSERTCH CHAR CH# TEXTOBJ))
-
-                 (* ;; "We inserted 1 char.  Whether or not we introduced a new piece or extended an old one, we want to be positioned at the first character of the next piece. ")
-
-                 (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE INSERTPC)
-                        0)
-                 (CL:WHEN WINDOW
-                     (TEDIT.UPDATE.SCREEN TEXTOBJ)
-                     (\TEDIT.INSTALL.PIECE TSTREAM (NEXTPIECE INSERTPC)
-                            0))))                            (* ; 
-                                        "Reformatting advances the stream, go back to the insertion.")
-         CHAR])
 )
 (DECLARE%: EVAL@COMPILE DONTCOPY 
 (DECLARE%: EVAL@COMPILE 
 
-(PUTPROPS \ENDOFPIECEP MACRO ((TSTREAM PCLEFT)
-                              (EQ 0 PCLEFT)))
+(PUTPROPS \ENDOFPIECEP MACRO ((PCLEFT)
+                              (ILEQ PCLEFT 0)))
 
 (PUTPROPS \STARTOFPIECEP MACRO ((TSTREAM PCLEFT)
                                 (IEQP (PLEN (ffetch (TEXTSTREAM PIECE) of TSTREAM))
@@ -1023,8 +1064,9 @@
 
 (DEFINEQ
 
-(\TEXTSTREAM.OUTCHARFN
-  [LAMBDA (TSTREAM CHARCODE)                                 (* ; "Edited 18-Oct-2023 21:05 by rmk")
+(\TEDIT.TEXTOUTCHARFN
+  [LAMBDA (TSTREAM CHARCODE)                                 (* ; "Edited 17-Mar-2024 11:12 by rmk")
+                                                             (* ; "Edited 18-Oct-2023 21:05 by rmk")
                                                              (* ; "Edited 22-Jul-2022 19:05 by rmk")
                                                             (* ; "Edited 12-Oct-2021 15:38 by rmk:")
 
@@ -1032,9 +1074,9 @@
 
     (COND
        ((EQ CHARCODE (CHARCODE EOL))
-        (\TEXTBOUT TSTREAM (CHARCODE CR))
+        (\TEDIT.TEXTBOUT TSTREAM (CHARCODE CR))
         (freplace (STREAM CHARPOSITION) of TSTREAM with 0))
-       (T (\TEXTBOUT TSTREAM CHARCODE)
+       (T (\TEDIT.TEXTBOUT TSTREAM CHARCODE)
           (freplace (STREAM CHARPOSITION) of TSTREAM with (PROGN 
                                                              (* ; "Ugh.  Don't overflow")
                                                                  (IPLUS16 (ffetch (STREAM 
@@ -1043,7 +1085,7 @@
                                                                              of TSTREAM)
                                                                         1])
 
-(\TEXTSTREAM.INCCCODEFN
+(\TEDIT.TEXTINCCODEFN
   [LAMBDA (STREAM COUNTP)                                    (* ; "Edited 31-Jan-2024 16:34 by rmk")
                                                              (* ; "Edited  7-Aug-2022 22:25 by rmk")
                                                              (* ; "Edited 22-Jul-2022 18:47 by rmk")
@@ -1057,17 +1099,30 @@
     (CL:WHEN COUNTP (SETQ *BYTECOUNTER* 1))
     (BIN STREAM])
 
-(\TEXTSTREAM.BACKCCODEFN
-  [LAMBDA (STREAM COUNTP)                                    (* ; "Edited 22-Jul-2022 19:01 by rmk")
+(\TEDIT.TEXTBACKCCODEFN
+  [LAMBDA (STREAM COUNTP)                                    (* ; "Edited 17-Mar-2024 11:11 by rmk")
+                                                             (* ; "Edited 22-Jul-2022 19:01 by rmk")
                                                              (* ; "Edited 19-Jul-2022 17:12 by rmk")
                                                             (* ; "Edited 13-Aug-2021 14:08 by rmk:")
     (DECLARE (USEDFREE *BYTECOUNTER*))
     (CL:WHEN COUNTP (SETQ *BYTECOUNTER* -1))
-    (\TEXTBACKFILEPTR STREAM])
+    (\TEDIT.TEXTBACKFILEPTR STREAM])
 
-(\TEXTSTREAM.FORMATBYTESTREAM
-  [LAMBDA (STREAM BYTESTREAM)                               (* ; "Edited 24-Jun-2021 16:47 by rmk:")
+(\TEDIT.TEXTFORMATBYTESTREAM
+  [LAMBDA (STREAM BYTESTREAM)                                (* ; "Edited 19-Mar-2024 16:13 by rmk")
+                                                            (* ; "Edited 24-Jun-2021 16:47 by rmk:")
+
+    (* ;; "BYTESTREAM might come in with a textstream external format, but that's presumably a mistake.  If STREAM is a text stream, then it traffics in XCCS characters, it's format should be relatively vanilla.")
+
+    (HELP)
     (REPLACE (STREAM CHARSET) OF BYTESTREAM WITH (FETCH (STREAM CHARSET) OF STREAM])
+
+(\TEDIT.TEXTFORMATBYTESTRING
+  [LAMBDA (TSTREAM STRING SCRATCHSTREAM)                     (* ; "Edited 19-Mar-2024 18:22 by rmk")
+
+    (* ;; "The FORMATBYTESTRINGFN for Text streams.  STRING is presumably in internal XCCS character codes, and those are the codes that TSTREAM will match against, independent of however its backing stream characters might be encoded.  So we can just return STRING")
+
+    (MKSTRING STRING])
 )
 
 
@@ -1079,6 +1134,14 @@
 (OPENTEXTSTREAM
   [LAMBDA (TEXT WINDOW START END PROPS)
 
+    (* ;; "Edited 31-Mar-2024 11:43 by rmk")
+
+    (* ;; "Edited 17-Mar-2024 12:05 by rmk")
+
+    (* ;; "Edited 15-Mar-2024 14:23 by rmk")
+
+    (* ;; "Edited 10-Mar-2024 22:10 by rmk")
+
     (* ;; "Edited 21-Jan-2024 10:31 by rmk")
 
     (* ;; "Edited 20-Dec-2023 10:47 by rmk")
@@ -1115,34 +1178,41 @@
 
     (* ;; " Finally, WINDOW is passed as T (e.g. from TEDIT) to say that a region must be obtained for a required window.")
 
+    (CL:WHEN (EQ 0 (NCHARS TEXT))                            (* ; 
+                                           "Empty string means empty document, not illegal file name")
+        (SETQ TEXT NIL))
     (RESETLST
-        (LET ((TSTREAM (TEXTSTREAMP TEXT))
-              TEXTOBJ TEDIT.GET.FINISHEDFORMS)
+        (LET ((TSTREAM (TEXTSTREAMP TEXT))
+              TEXTOBJ TEDIT.GET.FINISHEDFORMS PRIMARYW)
              (DECLARE (SPECVARS TEDIT.GET.FINISHEDFORMS))    (* ; 
                  "Undocumented, but available for special-purpose actions specified somewhere below.")
              (if TSTREAM
                  then (SETQ TEXTOBJ (TEXTOBJ TSTREAM))
                       (CL:WHEN (OR START END)                (* ; "Do the end first")
                           (CL:WHEN (AND END (ILESSP END (TEXTLEN TEXTOBJ)))
-                              (\DELETEPIECES (\SELPIECES (ADD1 END)
-                                                    (TEXTLEN TEXTOBJ)
-                                                    TEXTOBJ)
+                              (\TEDIT.DELETEPIECES (\TEDIT.SELPIECES (ADD1 END)
+                                                          (TEXTLEN TEXTOBJ)
+                                                          TEXTOBJ)
                                      TEXTOBJ))
                           (CL:WHEN (AND START (IGREATERP START 1))
-                              (\DELETEPIECES (\SELPIECES 1 (SUB1 START)
-                                                    TEXTOBJ)
+                              (\TEDIT.DELETEPIECES (\TEDIT.SELPIECES 1 (SUB1 START)
+                                                          TEXTOBJ)
                                      TEXTOBJ)))
                       (\TEDIT.OPENTEXTSTREAM.PROPS TEXTOBJ PROPS)
-                      (if (\TEDIT.PRIMARYW TSTREAM)
-                          then                               (* ; 
-                             "If there is an existing window, clean and reuse it, and ignore WINDOW.")
-                               (\TEDIT.MARK.LINES.DIRTY TEXTOBJ 1 -1)
-                               (TEDIT.UPDATE.SCREEN TEXTOBJ)
-                               (SETTOBJ TEXTOBJ \DIRTY NIL)
-                               (SETQ WINDOW NIL)
-                        else (SETQ WINDOW (\TEDIT.CREATEW WINDOW TSTREAM PROPS)) 
+                      (SETQ PRIMARYW (WINDOWP (\TEDIT.PRIMARYW TSTREAM)))
+                      (if [AND WINDOW (NEQ WINDOW PRIMARYW)
+                               (NEQ WINDOW (CAR (WINDOWPROP PRIMARYW 'TYPED-REGION]
+                          then (SETQ WINDOW (\TEDIT.CREATEW WINDOW TSTREAM PROPS)) 
                                                              (* ; "Set up a new window")
-                             (\TEDIT.OPENTEXTSTREAM.WINDOW WINDOW TSTREAM PROPS))
+                               (\TEDIT.OPENTEXTSTREAM.WINDOW WINDOW TSTREAM PROPS)
+                        elseif PRIMARYW
+                          then (OPENW PRIMARYW)
+                               (\TEDIT.MARK.LINES.DIRTY TEXTOBJ 1 -1) 
+                                                             (* ; 
+                                                             "Clean and reuse the existing window")
+                               (\TEDIT.UPDATE.SCREEN TEXTOBJ)
+                               (SETTOBJ TEXTOBJ \DIRTY NIL))
+                      (\TEDIT.REOPENTEXTSTREAM TSTREAM)
                else (SETQ TSTREAM (\TEDIT.CREATE.TEXTSTREAM PROPS))
                     (SETQ TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM))
                     (CL:WHEN TEXT                            (* ; 
@@ -1153,7 +1223,7 @@
                     (* ;; "Get the window before populating pieces, so that the local promptwindow is availabe for messages and queries")
 
                     (CL:WHEN WINDOW                          (* ; 
-                                          "If NIL, don't create a window.  It's T on call from TEDIT")
+                                      "If NIL, don't create a window.  It's Tedit on call from TEDIT")
                         (SETQ WINDOW (\TEDIT.CREATEW WINDOW TSTREAM PROPS)))
                     (CL:WHEN TEXT
 
@@ -1164,14 +1234,16 @@
                     (* ;; "We now have all the pieces, even for TEXT=NIL (empty document) case.")
 
                     (CL:WHEN WINDOW                          (* ; "Connect to the window")
-                        (\TEDIT.OPENTEXTSTREAM.WINDOW WINDOW TSTREAM PROPS)))
-             (\TEDIT.OPENTEXTSTREAM.SETUP.SEL TSTREAM)
+                        (\TEDIT.OPENTEXTSTREAM.WINDOW WINDOW TSTREAM PROPS))
+                    (\TEDIT.OPENTEXTSTREAM.SETUP.SEL TSTREAM))
              (for FORM in TEDIT.GET.FINISHEDFORMS do (EVAL FORM))
-             (\TEXTSETFILEPTR TSTREAM 0)
+             (\TEDIT.TEXTSETFILEPTR TSTREAM 0)
              TSTREAM))])
 
 (COPYTEXTSTREAM
-  [LAMBDA (ORIGINAL CROSSCOPY)                               (* ; "Edited 16-Jan-2024 12:27 by rmk")
+  [LAMBDA (ORIGINAL CROSSCOPY)                               (* ; "Edited 17-Mar-2024 12:41 by rmk")
+                                                             (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited 16-Jan-2024 12:27 by rmk")
                                                              (* ; "Edited 22-Sep-2023 20:48 by rmk")
                                                              (* ; "Edited 18-Sep-2023 08:21 by rmk")
                                                              (* ; "Edited 16-Sep-2023 13:06 by rmk")
@@ -1189,9 +1261,10 @@
                                    "Create an empty textstream into which the pieces can be hammered")
          [SETQ NEWSTREAM (OPENTEXTSTREAM NIL NIL NIL NIL (COPY (FGETTOBJ TEXTOBJ EDITPROPS]
          (SETQ NEWTEXTOBJ (TEXTOBJ NEWSTREAM))
-         (for PC inpieces (\FIRSTPIECE TEXTOBJ) do (\INSERTPIECE (\TEDIT.COPYPIECE PC TEXTOBJ 
-                                                                        NEWTEXTOBJ NIL 'COPY)
-                                                          NIL NEWTEXTOBJ))
+         (for PC inpieces (\TEDIT.FIRSTPIECE TEXTOBJ) do (\TEDIT.INSERTPIECE (\TEDIT.COPYPIECE
+                                                                              PC TEXTOBJ NEWTEXTOBJ 
+                                                                              NIL 'COPY)
+                                                                NIL NEWTEXTOBJ))
          (FSETTOBJ NEWTEXTOBJ FORMATTEDP (FGETTOBJ TEXTOBJ FORMATTEDP))
          (FSETTOBJ NEWTEXTOBJ DEFAULTCHARLOOKS (FGETTOBJ TEXTOBJ DEFAULTCHARLOOKS))
          (FSETTOBJ NEWTEXTOBJ FMTSPEC (FGETTOBJ TEXTOBJ FMTSPEC))
@@ -1210,14 +1283,6 @@
         (COND
            (RESET? (replace (TEXTOBJ \DIRTY) of (TEXTOBJ STREAM) with NIL))))])
 
-(TEXTSTREAMP
-  [LAMBDA (STREAM)                                           (* jds " 3-Apr-84 14:34")
-                                                             (* Returns the stream if it is a text 
-                                                             stream, else NIL)
-    (AND (STREAMP STREAM)
-         (type? TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of STREAM))
-         STREAM])
-
 (TXTFILE
   [LAMBDA (TEXTOBJ)                                          (* ; "Edited 13-Jul-2023 19:49 by rmk")
                                                              (* ; "Edited 31-May-91 13:58 by jds")
@@ -1225,23 +1290,33 @@
     (* ;; "This function is for compiled access to the TXTFILE field in RESETSAVE expressions.  But maybe user functions should be able to call it, hence the call to TEXTOBJ")
 
     (fetch (TEXTOBJ TXTFILE) of (TEXTOBJ TEXTOBJ])
-
-(REOPENTEXTSTREAM
-  [LAMBDA (STREAM)                                           (* ; "Edited 22-Jan-2024 10:20 by rmk")
-
-    (* ;; "RMK:  Not sure whether this should operate on any stream, or just (by virtue of its name) a text stream.  I put in the TEXTSTREAMP test.")
-                                                             (* ; "Edited 31-May-91 14:18 by jds")
-    (CL:WHEN (TEXTSTREAMP STREAM)
-        (replace (STREAM ACCESS) of STREAM with 'BOTH)
-        (replace (STREAM BINABLE) of STREAM with T)
-        (replace (STREAM STRMBINFN) of STREAM with (FUNCTION \TEXTBIN))
-        (replace (STREAM STRMBOUTFN) of STREAM with (FUNCTION \TEXTBOUT)))
-    STREAM])
 )
 (DEFINEQ
 
+(\TEDIT.REOPENTEXTSTREAM
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 17-Mar-2024 11:12 by rmk")
+                                                             (* ; "Edited 10-Mar-2024 00:36 by rmk")
+                                                             (* ; "Edited 22-Jan-2024 10:20 by rmk")
+
+    (* ;; "RMK:  Not sure whether this should operate on any stream, or just (by virtue of its name) a text stream.  I put in the TEXTSTREAMP test.")
+                                                             (* ; "Edited 31-May-91 14:18 by jds")
+    (SETQ TSTREAM (TEXTSTREAM TSTREAM T))
+    (CL:WHEN TSTREAM
+        (LET ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)))
+             (SETTOBJ TEXTOBJ EDITFINISHEDFLG NIL)
+             (replace (STREAM ACCESS) of TSTREAM with (CL:IF (GETTOBJ TEXTOBJ TXTREADONLY)
+                                                          'INPUT
+                                                          'BOTH))
+
+             (* ;; "Not sure why these are needed, and not the rest of the Text external format")
+
+             (replace (STREAM STRMBINFN) of TSTREAM with (FUNCTION \TEDIT.TEXTBIN))
+             (replace (STREAM STRMBOUTFN) of TSTREAM with (FUNCTION \TEDIT.TEXTBOUT))))
+    TSTREAM])
+
 (\TEDIT.OPENTEXTSTREAM.PIECES
-  [LAMBDA (TEXT TSTREAM START END PROPS)                     (* ; "Edited 27-Dec-2023 13:33 by rmk")
+  [LAMBDA (TEXT TSTREAM START END PROPS)                     (* ; "Edited 20-Mar-2024 10:58 by rmk")
+                                                             (* ; "Edited 27-Dec-2023 13:33 by rmk")
                                                              (* ; "Edited 23-Oct-2023 13:47 by rmk")
                                                              (* ; "Edited 28-Sep-2023 10:17 by rmk")
                                                              (* ; "Edited 27-Sep-2023 00:13 by rmk")
@@ -1255,8 +1330,7 @@
     (* ;; "The intent is that the window's promptwindow is available for local messages during the fetch, and the RESETSAVE of PROMPTWINDOW would make even messages to the global promptwindow appear locally.  An example is the mouseconfirm in READIMAGEOBJ that asks whether the imageobj code should be loaded from a given file.  The problem is that the Tedit prompt window is usually just 1 line hight and doesn't automatically grow to show multiple lines, so key information may not be displayed.  If the Tedit prompt grows (and it can be determined when/if it should later shrink), then this feature can be enabled.")
 
     (RESETLST
-        (LET* [(TEXTOBJ (\DTEST (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
-                               'TEXTOBJ))
+        (LET* [(TEXTOBJ (TEXTOBJ! (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)))
                (PWINDOW (GETTOBJ TEXTOBJ PROMPTWINDOW))
                (READONLY (GETTEXTPROP TEXTOBJ 'READONLY]     (* ; 
                                                          "READONLY only after creation, if specified")
@@ -1316,7 +1390,8 @@
         (TEDIT.PAGEFORMAT TEXTOBJ (GETTEXTPROP TEXTOBJ 'PAGEFORMAT)))])
 
 (\TEDIT.OPENTEXTSTREAM.SETUP.SEL
-  [LAMBDA (TSTREAM)                                          (* ; "Edited 15-Dec-2023 23:05 by rmk")
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 15-Mar-2024 13:38 by rmk")
+                                                             (* ; "Edited 15-Dec-2023 23:05 by rmk")
                                                              (* ; "Edited 12-Oct-2023 22:48 by rmk")
                                                              (* ; "Edited 17-Sep-2023 12:52 by rmk")
                                                              (* ; "Edited 12-Sep-2023 11:26 by rmk")
@@ -1332,12 +1407,12 @@
                                                    (FSETSEL S SET NIL))
          (SETQ SEL (FGETTOBJ TEXTOBJ SEL))
          (FSETSEL SEL SET T)
-         (\SHOWSEL SEL NIL)
+         (\TEDIT.SHOWSEL SEL NIL)
          (CL:UNLESS (EQ SELPROP 'DON'T)
              (if (type? SELECTION SELPROP)
                  then                                        (* ; 
                                          "We came in with an explicit initial selection.  Set it up.")
-                      (\COPYSEL SELPROP SEL)
+                      (\TEDIT.COPYSEL SELPROP SEL)
                       (FSETSEL SEL SELTEXTOBJ TEXTOBJ)
                elseif (LISTP SELPROP)
                  then 
@@ -1367,11 +1442,13 @@
              (CL:WHEN (FGETTOBJ TEXTOBJ TXTREADONLY)         (* ; 
                                                      "Don't blink for read-only, but do highlighting")
                  (FSETSEL SEL HASCARET NIL))
-             (\SHOWSEL SEL T))
+             (\TEDIT.SHOWSEL SEL T))
          SEL])
 
 (\TEDIT.OPENTEXTSTREAM.WINDOW
-  [LAMBDA (WINDOW TSTREAM PROPS)                             (* ; "Edited 26-Oct-2023 11:02 by rmk")
+  [LAMBDA (WINDOW TSTREAM PROPS)                             (* ; "Edited 17-Mar-2024 12:06 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 14:38 by rmk")
+                                                             (* ; "Edited 26-Oct-2023 11:02 by rmk")
                                                              (* ; "Edited 18-Sep-2023 23:22 by rmk")
                                                              (* ; "Edited 17-Sep-2023 11:53 by rmk")
 
@@ -1379,15 +1456,15 @@
     "Associates WINDOW with TSTREAM.  Brute force, doesn't let this window stuff change the fileptr ")
 
     (LET ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM))
-          (FILEPTR (\TEXTGETFILEPTR TSTREAM)))
+          (FILEPTR (\TEDIT.TEXTGETFILEPTR TSTREAM)))
          (if WINDOW
              then (\TEDIT.WINDOW.SETUP WINDOW TSTREAM PROPS)
-                  (TEDIT.UPDATE.SCREEN TEXTOBJ)
+                  (\TEDIT.UPDATE.SCREEN TEXTOBJ)
                   (SETTOBJ TEXTOBJ \DIRTY NIL)
                   (CL:IF (FGETTOBJ TEXTOBJ TXTREADONLY)
                       (for CARET in (GETTOBJ TEXTOBJ CARET) do (\TEDIT.UPCARET CARET))
                       (TEDIT.NORMALIZECARET TEXTOBJ))
-                  (\TEXTSETFILEPTR TSTREAM FILEPTR)
+                  (\TEDIT.TEXTSETFILEPTR TSTREAM FILEPTR)
            elseif (GETTEXTPROP TEXTOBJ 'PROMPTWINDOW)
              then 
                   (* ;; "There is no window for the session, but he has passed in a promptwindow to use, install it in the textobj")
@@ -1452,7 +1529,8 @@
                TEXT))])
 
 (\TEDIT.CREATE.TEXTSTREAM
-  [LAMBDA (PROPS)                                            (* ; "Edited 21-Jan-2024 15:16 by rmk")
+  [LAMBDA (PROPS)                                            (* ; "Edited 16-Mar-2024 09:52 by rmk")
+                                                             (* ; "Edited 21-Jan-2024 15:16 by rmk")
                                                              (* ; "Edited 17-Sep-2023 00:38 by rmk")
                                                              (* ; "Edited 12-Sep-2023 11:27 by rmk")
 
@@ -1463,13 +1541,14 @@
                               TEXTOBJ _ TEXTOBJ))
          (SETTOBJ TEXTOBJ STREAMHINT TSTREAM)
          (\TEDIT.OPENTEXTSTREAM.PROPS TEXTOBJ PROPS)
-         (\MAKEPCTB TEXTOBJ)
+         (\TEDIT.MAKEPCTB TEXTOBJ)
          (\TEDIT.INSTALL.PIECE TSTREAM (FGETTOBJ TEXTOBJ LASTPIECE)
                 0)
          TSTREAM])
 
 (\TEDIT.REOPEN.STREAM
-  [LAMBDA (TSTREAM PIECESTREAM)                              (* ; "Edited 23-Jan-2024 00:28 by rmk")
+  [LAMBDA (TSTREAM PIECESTREAM)                              (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited 23-Jan-2024 00:28 by rmk")
                                                              (* ; "Edited  9-Nov-2023 17:05 by rmk")
                                                              (* ; "Edited  8-Sep-2023 00:23 by rmk")
                                                              (* ; "Edited 15-Sep-2022 22:56 by rmk")
@@ -1488,8 +1567,8 @@
 
          (* ;; "Run thru the pieces, correcting any that used this stream to use the new one:")
 
-         (for PC inpieces (\FIRSTPIECE TEXTOBJ) when (EQ (PCONTENTS PC)
-                                                         PIECESTREAM)
+         (for PC inpieces (\TEDIT.FIRSTPIECE TEXTOBJ) when (EQ (PCONTENTS PC)
+                                                               PIECESTREAM)
             do (FSETPC PC PCONTENTS NEWSTREAM))
 
          (* ;; "Check the TXTFILE, and if it uses the closed stream, fix it as well:")
@@ -1502,8 +1581,11 @@
 
          NEWSTREAM])
 
-(\TEXTINIT
-  [LAMBDA NIL                                                (* ; "Edited  7-Mar-2023 15:01 by rmk")
+(\TEDIT.TEXTINIT
+  [LAMBDA NIL                                                (* ; "Edited 19-Mar-2024 18:16 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 12:25 by rmk")
+                                                             (* ; "Edited 10-Mar-2024 13:50 by rmk")
+                                                             (* ; "Edited  7-Mar-2023 15:01 by rmk")
                                                              (* ; "Edited 28-Aug-2022 22:19 by rmk")
                                                              (* ; "Edited 22-Jul-2022 20:02 by rmk")
                                                              (* ; "Edited  3-Jul-2022 00:34 by rmk")
@@ -1534,36 +1616,36 @@
 
     [SETQ \TEXTIMAGEOPS (create IMAGEOPS
                                IMAGETYPE _ 'TEXT
-                               IMXPOSITION _ (FUNCTION \TEXTDSPXPOSITION)
-                               IMYPOSITION _ (FUNCTION \TEXTDSPYPOSITION)
-                               IMLEFTMARGIN _ (FUNCTION \TEXTLEFTMARGIN)
-                               IMRIGHTMARGIN _ (FUNCTION \TEXTRIGHTMARGIN)
-                               IMFONT _ (FUNCTION \TEXTDSPFONT)
+                               IMXPOSITION _ (FUNCTION \TEDIT.TEXTDSPXPOSITION)
+                               IMYPOSITION _ (FUNCTION \TEDIT.TEXTDSPYPOSITION)
+                               IMLEFTMARGIN _ (FUNCTION \TEDIT.TEXTLEFTMARGIN)
+                               IMRIGHTMARGIN _ (FUNCTION \TEDIT.TEXTRIGHTMARGIN)
+                               IMFONT _ (FUNCTION \TEDIT.TEXTDSPFONT)
                                IMCLOSEFN _ (FUNCTION NILL)
                                IMFONTCREATE _ 'DISPLAY
-                               IMLINEFEED _ (FUNCTION \TEXTDSPLINEFEED)
-                               IMCHARWIDTH _ (FUNCTION \TEXTDSPCHARWIDTH)
-                               IMSTRINGWIDTH _ (FUNCTION \TEXTDSPSTRINGWIDTH)
+                               IMLINEFEED _ (FUNCTION \TEDIT.TEXTDSPLINEFEED)
+                               IMCHARWIDTH _ (FUNCTION \TEDIT.TEXTDSPCHARWIDTH)
+                               IMSTRINGWIDTH _ (FUNCTION \TEDIT.TEXTDSPSTRINGWIDTH)
                                IMSCALE _ (FUNCTION (LAMBDA NIL 1]
 
     (* ;; "Maybe more functions later. The INCODE and BACK functions possibly need to count.  If \TEXTBACKFILEPTR takes a count variable, the extra level wouldn't be needed.  But INCCODE wants to go through the BIN opcode")
 
-    (MAKE-EXTERNALFORMAT :TEXTSTREAM (FUNCTION \TEXTSTREAM.INCCCODEFN)
-           (FUNCTION \TEXTPEEKBIN)
-           (FUNCTION \TEXTSTREAM.BACKCCODEFN)
-           (FUNCTION \TEXTSTREAM.OUTCHARFN)
-           (FUNCTION \TEXTSTREAM.FORMATBYTESTREAM)
-           'CR)
+    (MAKE-EXTERNALFORMAT :TEXTSTREAM (FUNCTION \TEDIT.TEXTINCCODEFN)
+           (FUNCTION \TEDIT.TEXTPEEKBIN)
+           (FUNCTION \TEDIT.TEXTBACKCCODEFN)
+           (FUNCTION \TEDIT.TEXTOUTCHARFN)
+           (FUNCTION \TEDIT.TEXTFORMATBYTESTREAM)
+           'CR NIL (FUNCTION \TEDIT.TEXTFORMATBYTESTRING))
     (SETQ \TEXTFDEV (create FDEV
                            DEVICENAME _ 'TEXT
                            RESETABLE _ T
                            RANDOMACCESSP _ T
                            PAGEMAPPED _ NIL
                            GETFILENAME _ (FUNCTION NILL)
-                           BIN _ (FUNCTION \TEXTBIN)
-                           BOUT _ (FUNCTION \TEXTBOUT)
-                           CLOSEFILE _ (FUNCTION \TEXTCLOSEF)
-                           OPENFILE _ (FUNCTION \TEXTOPENF)
+                           BIN _ (FUNCTION \TEDIT.TEXTBIN)
+                           BOUT _ (FUNCTION \TEDIT.TEXTBOUT)
+                           CLOSEFILE _ (FUNCTION \TEDIT.TEXTCLOSEF)
+                           OPENFILE _ (FUNCTION \TEDIT.TEXTOPENF)
                            DELETEFILE _ (FUNCTION NILL)
                            DIRECTORYNAMEP _ (FUNCTION NILL)
                            EVENTFN _ (FUNCTION NILL)
@@ -1576,12 +1658,12 @@
                                                        with 'BOTH)
                                                     STREAM]
                            SETFILEINFO _ (FUNCTION NILL)
-                           BACKFILEPTR _ (FUNCTION \TEXTBACKFILEPTR)
-                           SETFILEPTR _ (FUNCTION \TEXTSETFILEPTR)
-                           PEEKBIN _ (FUNCTION \TEXTPEEKBIN)
-                           GETEOFPTR _ (FUNCTION \TEXTGETEOFPTR)
-                           GETFILEPTR _ (FUNCTION \TEXTGETFILEPTR)
-                           EOFP _ (FUNCTION \TEXTEOFP)
+                           BACKFILEPTR _ (FUNCTION \TEDIT.TEXTBACKFILEPTR)
+                           SETFILEPTR _ (FUNCTION \TEDIT.TEXTSETFILEPTR)
+                           PEEKBIN _ (FUNCTION \TEDIT.TEXTPEEKBIN)
+                           GETEOFPTR _ (FUNCTION \TEDIT.TEXTGETEOFPTR)
+                           GETFILEPTR _ (FUNCTION \TEDIT.TEXTGETFILEPTR)
+                           EOFP _ (FUNCTION \TEDIT.TEXTEOFP)
                            FDBINABLE _ T
                            FDBOUTABLE _ NIL
                            FDEXTENDABLE _ NIL
@@ -1595,7 +1677,7 @@
                                [(AND (BOUNDP 'ERRORPOS)
                                      (TEXTSTREAMP STREAM))   (* ; 
              "This happened in the error handler, and it happened to a TEdit stream, so try the fix:")
-                                (LET ((XCL::RESULT (REOPENTEXTSTREAM STREAM)))
+                                (LET ((XCL::RESULT (\TEDIT.REOPENTEXTSTREAM STREAM)))
                                      (CL:WHEN XCL::RESULT
                                          (ENVAPPLY (STKNAME ERRORPOS)
                                                 (SUBST XCL::RESULT STREAM (STKARGS ERRORPOS))
@@ -1605,27 +1687,31 @@
                                                              (* ; 
                            "Some other kind of stream, so punt to the old handler (if there is one):")
                                       (APPLY* *TEDIT-OLD-STREAM-ERROR-HANDLER* CONDITION])
+)
 
-(\TEXTTTYBOUT
-  [LAMBDA (STREAM BYTE)                                      (* ; "Edited 18-Mar-2023 20:08 by rmk")
+
+
+(* ;; "Is this being used:")
+
+(DEFINEQ
+
+(\TEDIT.TTYBOUT
+  [LAMBDA (TSTREAM BYTE)                                     (* ; "Edited 17-Mar-2024 11:39 by rmk")
+                                                             (* ; "Edited 18-Mar-2023 20:08 by rmk")
                                                              (* ; "Edited 31-May-91 14:18 by jds")
-                                                             (* Do BOUT to a text stream, which is 
-                                                             an insertion at the caret.)
-    (PROG ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of STREAM)))
-          (COND
-             ((EQ BYTE ERASECHARCODE)
-              (\TEDIT.CHARDELETE TEXTOBJ (fetch (TEXTOBJ SEL) of TEXTOBJ)))
-             ((EQ IGNORE.CCE (fetch CCECHO of (\SYNCODE (OR (fetch (TEXTOBJ TXTTERMSA) of TEXTOBJ)
-                                                            \PRIMTERMSA)
-                                                     BYTE))) (* Nothing, ignore it)
-              )
-             (T (SELCHARQ BYTE
-                     ((EOL CR LF) 
-                          (\TEXTBOUT STREAM BYTE)
-                          (replace (STREAM CHARPOSITION) of STREAM with 0))
-                     (PROGN (\TEXTBOUT STREAM BYTE)
-                            (add (fetch (STREAM CHARPOSITION) of STREAM)
-                                 1])
+
+    (* ;; "Do BOUT to a text stream, which is an insertion at the caret.")
+
+    (* ;; "IS THIS BEING USED ??  INSTEAD, SPECIAL CASES IN \TEDIT.TEXTOUTCHARFN")
+
+    (LET ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)))
+         (if (EQ BYTE ERASECHARCODE)
+             then (\TEDIT.CHARDELETE TEXTOBJ (fetch (TEXTOBJ SEL) of TEXTOBJ))
+           elseif (EQ IGNORE.CCE (fetch CCECHO of (\SYNCODE (OR (fetch (TEXTOBJ TXTTERMSA)
+                                                                   of TEXTOBJ)
+                                                                \PRIMTERMSA)
+                                                         BYTE)))
+           else (\TEDIT.TEXTOUTCHARFN TSTREAM BYTE])
 )
 
 (RPAQ? *TEDIT-EXTENSIONS* '(TEDIT TED TXT TEXT BRAVO NIL))
@@ -1636,8 +1722,9 @@
 
 (DEFINEQ
 
-(\TEXTCLOSEF
-  [LAMBDA (TSTREAM)                                          (* ; "Edited 28-Aug-2023 13:12 by rmk")
+(\TEDIT.TEXTCLOSEF
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited 28-Aug-2023 13:12 by rmk")
                                                              (* ; "Edited 26-Oct-2022 11:17 by rmk")
                                                              (* ; "Edited 22-Aug-2022 14:18 by rmk")
                                                              (* ; "Edited  8-Aug-2022 14:56 by rmk")
@@ -1645,31 +1732,32 @@
                                                              (* ; 
                                                              "Close the files underlying a stream")
     (LET ((TEXTOBJ (TEXTOBJ TSTREAM)))
-         (for PC inpieces (\FIRSTPIECE TEXTOBJ) when (AND (MEMB (PTYPE PC)
-                                                                FILE.PTYPES)
-                                                          (PCONTENTS PC))
+         (for PC inpieces (\TEDIT.FIRSTPIECE TEXTOBJ) when (AND (MEMB (PTYPE PC)
+                                                                      FILE.PTYPES)
+                                                                (PCONTENTS PC))
             do (CLOSEF? (PCONTENTS PC)))
 
          (* ;; "And close the REAL file as well, in case we'd made a local cache.")
 
          (CLOSEF? (GETTOBJ TEXTOBJ TXTFILE])
 
-(\TEXTDSPFONT
-  [LAMBDA (STREAM NEWFONT)                                   (* ; "Edited 15-Oct-2023 17:13 by rmk")
+(\TEDIT.TEXTDSPFONT
+  [LAMBDA (TSTREAM NEWFONT)                                  (* ; "Edited 17-Mar-2024 11:49 by rmk")
+                                                             (* ; "Edited 15-Oct-2023 17:13 by rmk")
                                                              (* ; "Edited  8-Sep-2022 14:16 by rmk")
                                                              (* ; "Edited 31-May-91 14:02 by jds")
 
     (* ;; "Set the font for a TEdit window.  Need change the caret looks, for character insertion, and the WINDOW's looks, so that TEXEC type-out to the window does the right thing.")
 
-    (LET ((TEXTOBJ (TEXTOBJ STREAM)))
+    (LET ((TEXTOBJ (TEXTOBJ TSTREAM)))
          (PROG1 (fetch (CHARLOOKS CLFONT) of (FGETTOBJ TEXTOBJ CARETLOOKS))
-             (CL:WHEN NEWFONT                                (* ; 
-                                                         "Only do this if there's a new font to set:")
-                 (TEDIT.CARETLOOKS STREAM (\GETFONTDESC NEWFONT 'DISPLAY))
+             (CL:WHEN NEWFONT
+                 (TEDIT.CARETLOOKS TSTREAM (\GETFONTDESC NEWFONT 'DISPLAY))
                  (for PANE inpanes (PROGN TEXTOBJ) do (DSPFONT NEWFONT PANE))))])
 
-(\TEXTEOFP
-  [LAMBDA (TSTREAM)                                          (* ; "Edited 23-Dec-2023 11:53 by rmk")
+(\TEDIT.TEXTEOFP
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 18-Mar-2024 22:43 by rmk")
+                                                             (* ; "Edited 23-Dec-2023 11:53 by rmk")
                                                              (* ; "Edited  1-Jun-2023 17:07 by rmk")
                                                              (* ; "Edited 10-Aug-2022 12:41 by rmk")
                                                              (* ; "Edited  5-Aug-2022 16:37 by rmk")
@@ -1677,7 +1765,8 @@
 
     (* ;; "Test for EOF on a text stream: At end of a piece, and there are no more pieces (visible or not).  This assumes that there are no zero-length pieces.")
 
-    (OR (ZEROP (TEXTLEN (TEXTOBJ TSTREAM)))
+    (OR (ZEROP (FGETTOBJ (TEXTOBJ TSTREAM)
+                      TEXTLEN))
         (CL:WHEN (\ENDOFBUFFERP TSTREAM)
             [LET ((PCCHARSLEFT (ffetch (TEXTSTREAM PCCHARSLEFT) of TSTREAM)))
                  (CL:WHEN (ffetch (STREAM BINABLE) of TSTREAM)
@@ -1686,15 +1775,19 @@
                                                                        (ffetch (TEXTSTREAM 
                                                                                       STARTINGCOFFSET
                                                                                       ) of TSTREAM])
-                 (AND (\ENDOFPIECEP TSTREAM PCCHARSLEFT)
+                 (AND (\ENDOFPIECEP PCCHARSLEFT)
                       (NULL (NEXTPIECE (fetch (TEXTSTREAM PIECE) of TSTREAM])])
 
-(\TEXTGETEOFPTR
-  [LAMBDA (STREAM)                                           (* ; "Edited 31-May-91 13:58 by jds")
-    (fetch (TEXTOBJ TEXTLEN) of (fetch (TEXTSTREAM TEXTOBJ) of STREAM])
+(\TEDIT.TEXTGETEOFPTR
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 17-Mar-2024 12:27 by rmk")
+                                                             (* ; "Edited 31-May-91 13:58 by jds")
+    (GETTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
+           TEXTLEN])
 
-(\TEXTGETFILEPTR
-  [LAMBDA (TSTREAM)                                          (* ; "Edited 21-Oct-2023 20:57 by rmk")
+(\TEDIT.TEXTGETFILEPTR
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 19-Mar-2024 14:19 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 00:25 by rmk")
+                                                             (* ; "Edited 21-Oct-2023 20:57 by rmk")
                                                              (* ; "Edited  2-Sep-2022 17:45 by rmk")
                                                              (* ; "Edited 30-Jul-2022 00:07 by rmk")
                                                              (* ; "Edited 28-Mar-94 15:32 by jds")
@@ -1702,8 +1795,8 @@
     (* ;; "GETFILEPTR fn for text streams.  Measured in characters (and objects), not 8-bit bytes.")
 
     (LET ((TEXTOBJ (ffetch (TEXTSTREAM TEXTOBJ) of TSTREAM))
-          PC PCCHARSLEFT)
-         (SETQ PC (ffetch (TEXTSTREAM PIECE) of TSTREAM))
+          (PC (ffetch (TEXTSTREAM PIECE) of TSTREAM))
+          PCCHARSLEFT)
          (if (OR (NULL PC)
                  (\LASTPIECEP PC TEXTOBJ))
              then 
@@ -1724,32 +1817,36 @@
 
                 (* ;; "-1 to go from TEDIT-selection character-indexing back to nominal %"byte%" positions. SETFILEPTR goes the other way.")
 
-                (IPLUS -1 (\PCTOCH PC TEXTOBJ)
+                (IPLUS -1 (\TEDIT.PCTOCH PC TEXTOBJ)
                        (IDIFFERENCE (PLEN PC)
                               PCCHARSLEFT])
 
-(\TEXTOPENF
-  [LAMBDA (TSTREAM ACCESS)                                   (* ; "Edited  7-Dec-2023 21:01 by rmk")
+(\TEDIT.TEXTOPENF
+  [LAMBDA (TSTREAM ACCESS)                                   (* ; "Edited 16-Mar-2024 10:03 by rmk")
+                                                             (* ; "Edited  7-Dec-2023 21:01 by rmk")
                                                              (* ; "Edited 22-Aug-2022 15:16 by rmk")
                                                              (* ; "Edited 31-May-91 13:58 by jds")
                                                              (* ; 
                                                              "Return the stream, opened for input")
-    (for PC inpieces (\FIRSTPIECE (TEXTOBJ TSTREAM)) when [AND (MEMB (PTYPE PC)
-                                                                     FILE.PTYPES)
-                                                               (EQ NoBits (fetch (STREAM ACCESSBITS)
-                                                                             of (PCONTENTS PC]
+    (for PC inpieces (\TEDIT.FIRSTPIECE (TEXTOBJ TSTREAM))
+       when [AND (MEMB (PTYPE PC)
+                       FILE.PTYPES)
+                 (EQ NoBits (fetch (STREAM ACCESSBITS) of (PCONTENTS PC]
        DO (\TEDIT.REOPEN.STREAM TSTREAM (PCONTENTS PC)))
     TSTREAM])
 
-(\TEXTSETEOF
-  [LAMBDA (STREAM EOFPTR)                                    (* ; "Edited 31-May-91 14:19 by jds")
-                                                             (* Set the EPAGE/EOFFSET of the stream 
-                                                             to be (SUB1 of EOFPTR))
-    (replace (STREAM EPAGE) of STREAM with (fetch (BYTEPTR PAGE) of EOFPTR))
-    (replace (STREAM EOFFSET) of STREAM with (fetch (BYTEPTR OFFSET) of EOFPTR])
+(\TEDIT.TEXTSETEOF
+  [LAMBDA (TSTREAM EOFPTR)                                   (* ; "Edited 17-Mar-2024 12:28 by rmk")
+                                                             (* ; "Edited 31-May-91 14:19 by jds")
+                                                             (* ; 
+                                         "Set the EPAGE/EOFFSET of the stream to be (SUB1 of EOFPTR)")
+    (replace (STREAM EPAGE) of TSTREAM with (fetch (BYTEPTR PAGE) of EOFPTR))
+    (replace (STREAM EOFFSET) of TSTREAM with (fetch (BYTEPTR OFFSET) of EOFPTR])
 
-(\TEXTSETFILEPTR
-  [LAMBDA (TSTREAM FILEPOS)                                  (* ; "Edited 23-Dec-2023 12:14 by rmk")
+(\TEDIT.TEXTSETFILEPTR
+  [LAMBDA (TSTREAM FILEPOS)                                  (* ; "Edited 20-Mar-2024 10:58 by rmk")
+                                                             (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 23-Dec-2023 12:14 by rmk")
                                                              (* ; "Edited 22-Oct-2023 16:14 by rmk")
                                                              (* ; "Edited  2-Sep-2022 11:34 by rmk")
                                                              (* ; "Edited  8-Aug-2022 23:55 by rmk")
@@ -1759,8 +1856,7 @@
 
     (* ;; "FILEPOS is known to be a positive number.  For other filedevices there is no error if the ptr is set beyond the EOF, and GETFILEPTR will return the new position.  But the length of an input file doesn't change and a BIN at any position after the EOF causes the error.  An output file grows.  Filepos is a %"byte%" position, have to add 1 to get to the notion of character in a Tedit selection.")
 
-    (LET ((TEXTOBJ (\DTEST (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)
-                          'TEXTOBJ))
+    (LET ((TEXTOBJ (TEXTOBJ! (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM)))
           START-OF-PIECE PC CH#)
          (DECLARE (SPECVARS START-OF-PIECE))
          (CL:WHEN (IGREATERP FILEPOS (FGETTOBJ TEXTOBJ TEXTLEN))
@@ -1769,48 +1865,46 @@
              (\ILLEGAL.ARG FILEPOS))
          (CL:UNLESS (ZEROP (FGETTOBJ TEXTOBJ TEXTLEN))
              (SETQ CH# (ADD1 FILEPOS))
-             (SETQ PC (\CHTOPC CH# TEXTOBJ T))
+             (SETQ PC (\TEDIT.CHTOPC CH# TEXTOBJ T))
              (\TEDIT.INSTALL.PIECE TSTREAM PC (- CH# START-OF-PIECE)))])
 
-(\TEXTDSPXPOSITION
-  [LAMBDA (STREAM XPOSITION)                                (* ; "Edited  3-Jan-2001 17:27 by rmk:")
+(\TEDIT.TEXTDSPXPOSITION
+  [LAMBDA (TSTREAM XPOSITION)                                (* ; "Edited 17-Mar-2024 12:15 by rmk")
+                                                            (* ; "Edited  3-Jan-2001 17:27 by rmk:")
                                                   (* ; 
                                      "Edited 24-Oct-88 23:09 by rmk:; Edited 26-Sep-85 16:30 by ajb:")
 
     (* ;; 
   "Simply returns the XPOSITION of the primary window's display stream, this is a read-only function")
 
-    (LET [(WINDOW (CAR (fetch \WINDOW of (TEXTOBJ STREAM]
-         (COND
-            (WINDOW (DSPXPOSITION NIL WINDOW))
-            (T                                               (* ; 
+    (LET ((WINDOW (\TEDIT.PRIMARYW TSTREAM)))                (* ; 
                                             "If there is no window, estimate from character position")
-               (TIMES (CHARWIDTH (CHARCODE SPACE)
-                             STREAM)
-                      (POSITION STREAM])
+         (CL:IF WINDOW
+             (DSPXPOSITION NIL WINDOW)
+             (TIMES (CHARWIDTH (CHARCODE SPACE)
+                           TSTREAM)
+                    (POSITION TSTREAM)))])
 
-(\TEXTDSPYPOSITION
-  [LAMBDA (STREAM YPOSITION)                                 (* ; "Edited 31-May-91 13:59 by jds")
+(\TEDIT.TEXTDSPYPOSITION
+  [LAMBDA (TSTREAM YPOSITION)                                (* ; "Edited 17-Mar-2024 12:15 by rmk")
+                                                             (* ; "Edited 31-May-91 13:59 by jds")
 
-         (* Simply returns the XPOSITION of the primary window's display stream, this is a 
-         read-only function)
+    (* ;; 
+  "Simply returns the YPOSITION of the primary window's display stream, this is a read-only function")
 
-    (LET [(WINDOW (CAR (fetch (TEXTOBJ \WINDOW) of (TEXTOBJ STREAM]
+    (LET ((WINDOW (\TEDIT.PRIMARYW TSTREAM)))
          (IF WINDOW
              THEN (DSPYPOSITION NIL WINDOW)
-           ELSE (AND \#DISPLAYLINES (NEQ \CURRENTDISPLAYLINE -1)
-                     (DIFFERENCE \#DISPLAYLINES \CURRENTDISPLAYLINE])
+           ELSEIF (AND \#DISPLAYLINES (NEQ \CURRENTDISPLAYLINE -1))
+             THEN (DIFFERENCE \#DISPLAYLINES \CURRENTDISPLAYLINE])
 
-(\TEXTLEFTMARGIN
-  [LAMBDA (STREAM XPOSITION)                                 (* ; "Edited 31-May-91 14:03 by jds")
+(\TEDIT.TEXTLEFTMARGIN
+  [LAMBDA (TSTREAM XPOSITION)                                (* ; "Edited 17-Mar-2024 12:30 by rmk")
+                                                             (* ; "Edited 31-May-91 14:03 by jds")
+    (IPLUS 8 (fetch (FMTSPEC LEFTMAR) of (FGETTOBJ (TEXTOBJ TSTREAM)
+                                                FMTSPEC])
 
-(* ;;; "Returns the left margin of the textstream.  This is a read-only function")
-
-    (IF (CAR (fetch (TEXTOBJ \WINDOW) of (TEXTOBJ STREAM)))
-        THEN [IPLUS 8 (fetch (FMTSPEC LEFTMAR) of (fetch (TEXTOBJ FMTSPEC) of (TEXTOBJ STREAM]
-      ELSE 0])
-
-(\TEXTRIGHTMARGIN
+(\TEDIT.TEXTRIGHTMARGIN
   [LAMBDA (TSTREAM XPOSITION)                                (* ; "Edited 21-Sep-2023 12:38 by rmk")
                                                              (* ; "Edited 31-May-91 14:03 by jds")
 
@@ -1857,17 +1951,22 @@
                               TSTREAM)
                        (LINELENGTH NIL TSTREAM])
 
-(\TEXTDSPCHARWIDTH
-  [LAMBDA (STREAM CHARCODE)                                 (* ; "Edited  9-Feb-99 12:59 by kaplan")
-    (CHARWIDTH CHARCODE (DSPFONT NIL STREAM])
+(\TEDIT.TEXTDSPCHARWIDTH
+  [LAMBDA (TSTREAM CHARCODE)                                 (* ; "Edited 17-Mar-2024 12:23 by rmk")
+                                                            (* ; "Edited  9-Feb-99 12:59 by kaplan")
+    (CHARWIDTH CHARCODE (\TEDIT.TEXTDSPFONT TSTREAM])
 
-(\TEXTDSPSTRINGWIDTH
-  [LAMBDA (STREAM STRING)                                   (* ; "Edited  9-Feb-99 13:00 by kaplan")
-    (STRINGWIDTH STRING (DSPFONT NIL STREAM])
+(\TEDIT.TEXTDSPSTRINGWIDTH
+  [LAMBDA (TSTREAM STRING)                                   (* ; "Edited 17-Mar-2024 12:32 by rmk")
+                                                            (* ; "Edited  9-Feb-99 13:00 by kaplan")
+    (STRINGWIDTH STRING (\TEDIT.TEXTDSPFONT TSTREAM])
 
-(\TEXTDSPLINEFEED
-  [LAMBDA (STREAM VALUE)
-    (FONTPROP (DSPFONT NIL STREAM)
+(\TEDIT.TEXTDSPLINEFEED
+  [LAMBDA (TSTREAM VALUE)                                    (* ; "Edited 17-Mar-2024 12:25 by rmk")
+
+    (* ;; "Read only")
+
+    (FONTPROP (\TEDIT.TEXTDSPFONT TSTREAM)
            'HEIGHT])
 )
 
@@ -1903,7 +2002,8 @@
 (DEFINEQ
 
 (\TEDIT.DELETE.SELPIECES
-  [LAMBDA (TEXTOBJ TARGETSEL)                                (* ; "Edited 13-Feb-2024 00:13 by rmk")
+  [LAMBDA (TEXTOBJ TARGETSEL)                                (* ; "Edited 17-Mar-2024 00:22 by rmk")
+                                                             (* ; "Edited 13-Feb-2024 00:13 by rmk")
                                                              (* ; "Edited 11-Dec-2023 09:51 by rmk")
                                                              (* ; "Edited 21-Oct-2023 23:50 by rmk")
                                                              (* ; "Edited  3-Jun-2023 22:31 by rmk")
@@ -1915,16 +2015,16 @@
 
         (* ;; "Only delete characters if changes are permitted. ")
 
-        (BTVALIDATE '\TEDIT.DELETE.SELPIECES 'START TEXTOBJ)
+        (\TEDIT.BTVALIDATE '\TEDIT.DELETE.SELPIECES 'START TEXTOBJ)
         (LET (SELPIECES PREVPC)
-             (SETQ SELPIECES (\SELPIECES TARGETSEL))
+             (SETQ SELPIECES (\TEDIT.SELPIECES TARGETSEL))
              (CL:WHEN (AND (fetch (SELPIECES SPFIRST) of SELPIECES)
                            (for PC inselpieces SELPIECES always (OBJECT.ALLOWS PC 'DELETE TEXTOBJ)))
 
                  (* ;; "First deleted piece still points back into the TEXTOBJ sequence")
 
                  (SETQ PREVPC (PREVPIECE (ffetch (SELPIECES SPFIRST) of SELPIECES)))
-                 (\DELETEPIECES SELPIECES TEXTOBJ)
+                 (\TEDIT.DELETEPIECES SELPIECES TEXTOBJ)
                  (FSETTOBJ TEXTOBJ \DIRTY T)
 
                  (* ;; "If the the effect of the deletion is to concatenate a (non-empty) prefix of one paragraph with a (non-empty) suffix of another, propagate the prefix PARALOOKS all the way through to the end of the newly combined paragraph. All the pieces of a paragraph must have the same PARALOOKS.")
@@ -1937,7 +2037,7 @@
                         "(NEXTPIECE PREVPC) is the first retained piece linked in after the deletion")
 
                            (FSETPC PC PPARALOOKS PPLOOKS) repeatuntil (PPARALAST PC)))
-                 (BTVALIDATE '\TEDIT.DELETE.SELPIECES 'END TEXTOBJ)
+                 (\TEDIT.BTVALIDATE '\TEDIT.DELETE.SELPIECES 'END TEXTOBJ)
 
                  (* ;; "")
 
@@ -1950,8 +2050,9 @@
                                                    THDELETEDPIECES _ SELPIECES))
                  T)))])
 
-(\INSERTCH
-  [LAMBDA (CH CH# TEXTOBJ PARALAST)                          (* ; "Edited 21-Jan-2024 14:06 by rmk")
+(\TEDIT.INSERTCH
+  [LAMBDA (CH CH# TEXTOBJ PARALAST)                          (* ; "Edited 17-Mar-2024 12:41 by rmk")
+                                                             (* ; "Edited 21-Jan-2024 14:06 by rmk")
                                                              (* ; "Edited  9-Dec-2023 13:14 by rmk")
                                                              (* ; "Edited 18-Oct-2023 21:16 by rmk")
                                                              (* ; "Edited 15-Oct-2023 15:59 by rmk")
@@ -1981,7 +2082,7 @@
 
     (* ;; "")
 
-    (BTVALIDATE '\INSERTCH 'BEGIN TEXTOBJ)
+    (\TEDIT.BTVALIDATE '\TEDIT.INSERTCH 'BEGIN TEXTOBJ)
 
     (* ;; "")
 
@@ -1996,7 +2097,7 @@
 
      (* ;; "Step 1:  Construct the insertion string, presumably chomping the TEXTOBJ resource. May or may not be contiguous with last insertion.")
 
-          (SETQ INSERTION (\INSERTCH.INSERTION CH TEXTOBJ))
+          (SETQ INSERTION (\TEDIT.INSERTCH.INSERTION CH TEXTOBJ))
           (SETQ INSERTPTYPE (CL:IF (fetch (STRINGP FATSTRINGP) of INSERTION)
                                 FATSTRING.PTYPE
                                 THINSTRING.PTYPE))
@@ -2005,7 +2106,7 @@
 
      (* ;; "Step 2:  Find or create a piece with CH#at offset 0. This may involve splitting off an initial substring into a separate previous piece.")
 
-          (SETQ INSERTPC (\ALIGNEDPIECE CH# TEXTOBJ))
+          (SETQ INSERTPC (\TEDIT.ALIGNEDPIECE CH# TEXTOBJ))
 
      (* ;; "")
 
@@ -2021,7 +2122,7 @@
               then 
                    (* ;; "Heuristic optimization: avoid a new piece if it is clear that won't get us into trouble. We can't append to a paralast candidate piece, because the new material would become part of a new paragraph that may or may not eventually end a different paragraph.")
 
-                   (\INSERTCH.EXTEND PREVPC ILEN TEXTOBJ)
+                   (\TEDIT.INSERTCH.EXTEND PREVPC ILEN TEXTOBJ)
             else (SETQ PREVPC (create PIECE
                                      PTYPE _ INSERTPTYPE
                                      PCONTENTS _ INSERTION
@@ -2041,7 +2142,7 @@
                           (FSETPC PREVPC PBINABLE NIL)
                           (FSETPC PREVPC PCHARSET \NORUNCODE))
                      NIL)
-                 (\INSERTPIECE PREVPC INSERTPC TEXTOBJ))
+                 (\TEDIT.INSERTPIECE PREVPC INSERTPC TEXTOBJ))
 
      (* ;; "The insertion is done and the pieces are properly integrated into the stream. ")
 
@@ -2049,7 +2150,7 @@
 
      (* ;; " Register this event in the TEDIT history.")
 
-          (\INSERTCH.HISTORY TEXTOBJ PREVPC CH# ILEN)
+          (\TEDIT.INSERTCH.HISTORY TEXTOBJ PREVPC CH# ILEN)
 
      (* ;; "Finally, as a heuristic for continuous typing, set up the TEXTOBJ hint  to speed up the \CHTOPC piece search if  the next insertion comes just after this one (and this one is not PARALAST). This really doesn't matter for typing, but may make it noticeaby faster for programmatic insertions..")
 
@@ -2057,10 +2158,10 @@
               then (FSETPC PREVPC PPARALAST T)
             else (FSETTOBJ TEXTOBJ HINTPCSTARTCH# (IPLUS ILEN CH#))
                  (FSETTOBJ TEXTOBJ HINTPC INSERTPC))
-          (BTVALIDATE '\INSERTCH 'END TEXTOBJ)
+          (\TEDIT.BTVALIDATE '\TEDIT.INSERTCH 'END TEXTOBJ)
           (RETURN INSERTPC])
 
-(\INSERTCH.HISTORY
+(\TEDIT.INSERTCH.HISTORY
   [LAMBDA (TEXTOBJ PREVPC CH# ILEN)                          (* ; "Edited  8-Jun-2023 08:39 by rmk")
                                                              (* ; "Edited 28-May-2023 00:01 by rmk")
                                                              (* ; "Edited 25-May-2023 09:13 by rmk")
@@ -2104,8 +2205,9 @@
                                                          THFIRSTPIECE _ PREVPC
                                                          THPOINT _ 'RIGHT])
 
-(\INSERTEOL
-  [LAMBDA (CH CH# TEXTOBJ)                                   (* ; "Edited 11-Aug-2023 15:49 by rmk")
+(\TEDIT.INSERTEOL
+  [LAMBDA (CH CH# TEXTOBJ)                                   (* ; "Edited 17-Mar-2024 11:41 by rmk")
+                                                             (* ; "Edited 11-Aug-2023 15:49 by rmk")
                                                              (* ; "Edited  5-May-2023 17:00 by rmk")
                                                              (* ; "Edited 31-May-91 14:00 by jds")
 
@@ -2121,7 +2223,7 @@
                             (EQ (CHARCODE EOL)))             (* ; 
                "Inserting a meta-EOL into an unformatted document.  Start by setting up para breaks.")
                  (\TEDIT.CONVERT.TO.FORMATTED TEXTOBJ))
-             (SETQ INPC (\INSERTCH (CHARCODE EOL)
+             (SETQ INPC (\TEDIT.INSERTCH (CHARCODE EOL)
                                CH# TEXTOBJ))                 (* ; "Put the EOL in")
              (CL:WHEN (AND (EQ CH (CHARCODE EOL))
                            (PREVPIECE INPC))                 (* ; 
@@ -2130,7 +2232,7 @@
                  T)
              INPC))])
 
-(\INSERTCH.INSERTION
+(\TEDIT.INSERTCH.INSERTION
   [LAMBDA (CH TEXTOBJ)                                       (* ; "Edited 20-Oct-2023 23:57 by rmk")
                                                              (* ; "Edited 15-Oct-2023 14:45 by rmk")
                                                              (* ; "Edited 12-Apr-2023 16:55 by rmk")
@@ -2176,8 +2278,9 @@
              (RPLCHARCODE INSERTION 1 CH))
          INSERTION])
 
-(\INSERTCH.EXTEND
-  [LAMBDA (PC ILEN TEXTOBJ)                                  (* ; "Edited 21-Jan-2024 14:09 by rmk")
+(\TEDIT.INSERTCH.EXTEND
+  [LAMBDA (PC ILEN TEXTOBJ)                                  (* ; "Edited 16-Mar-2024 09:56 by rmk")
+                                                             (* ; "Edited 21-Jan-2024 14:09 by rmk")
                                                              (* ; "Edited 12-Apr-2023 09:37 by rmk")
                                                              (* ; "Edited  1-Sep-2022 08:26 by rmk")
                                                              (* ; "Edited 30-Aug-2022 11:13 by rmk")
@@ -2194,12 +2297,13 @@
     (add (ffetch (BTSLOT DLEN) of (\FINDSLOT (ffetch (PIECE PTREENODE) of PC)
                                          PC))
          ILEN)
-    (\UPDATEPCNODES PC ILEN TEXTOBJ])
+    (\TEDIT.UPDATEPCNODES PC ILEN TEXTOBJ])
 )
 (DEFINEQ
 
 (\SETUPGETCH
-  [LAMBDA (CH# TEXTOBJ)                                      (* ; "Edited 23-Dec-2023 12:14 by rmk")
+  [LAMBDA (CH# TEXTOBJ)                                      (* ; "Edited 17-Mar-2024 00:27 by rmk")
+                                                             (* ; "Edited 23-Dec-2023 12:14 by rmk")
                                                              (* ; "Edited 22-Aug-2022 13:04 by rmk")
                                                              (* ; "Edited 10-Aug-2022 17:20 by rmk")
                                                              (* ; "Edited  8-Aug-2022 15:07 by rmk")
@@ -2219,7 +2323,7 @@
                CH# 0))
        (T (LET (START-OF-PIECE PC)
                (DECLARE (SPECVARS START-OF-PIECE))
-               (SETQ PC (\CHTOPC CH# TEXTOBJ T))
+               (SETQ PC (\TEDIT.CHTOPC CH# TEXTOBJ T))
                (\TEDIT.INSTALL.PIECE (ffetch (TEXTOBJ STREAMHINT) of TEXTOBJ)
                       PC
                       (- CH# START-OF-PIECE])
@@ -2232,7 +2336,8 @@
 (DEFINEQ
 
 (\TEDIT.INSTALL.PIECE
-  [LAMBDA (TSTREAM PC CHOFFSET)                              (* ; "Edited  1-Feb-2024 00:23 by rmk")
+  [LAMBDA (TSTREAM PC CHOFFSET)                              (* ; "Edited 18-Mar-2024 22:26 by rmk")
+                                                             (* ; "Edited  1-Feb-2024 00:23 by rmk")
                                                              (* ; "Edited 21-Jan-2024 13:00 by rmk")
                                                              (* ; "Edited  5-Jan-2024 10:30 by rmk")
                                                              (* ; "Edited 28-Dec-2023 10:59 by rmk")
@@ -2274,13 +2379,10 @@
               (SETQ PCCHARSLEFT (IDIFFERENCE PLEN CHOFFSET))
               (freplace (STREAM COFFSET) of TSTREAM with 0)
               (SELECTC (PTYPE PC)
-                  (THINFILE.PTYPE                            (* ; "Sets up the buffers")
-                       (\TEDIT.INSTALL.FILEBUFFER TSTREAM PCCHARSLEFT))
-                  ((LIST FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE) 
+                  (FILE.PTYPES 
+                               (* ;; "Sets up the buffers and positions the underlying stream.  Unless thinfile, the BIN opcode punts everything.")
 
-                                 (* ;; "These don't really need a file buffer, offsets, etc, but the underlying file has to be positioned according to ffset, and maybe reopened")
-
-                       (\TEDIT.INSTALL.FILEBUFFER TSTREAM PCCHARSLEFT))
+                               (\TEDIT.INSTALL.FILEBUFFER TSTREAM PCCHARSLEFT))
                   (STRING.PTYPES (freplace (STREAM CPPTR) of TSTREAM with (ffetch (STRINGP BASE)
                                                                              of PCONTENTS))
                                  (freplace (STREAM COFFSET) of TSTREAM
@@ -2303,6 +2405,8 @@
               (freplace (TEXTSTREAM STARTINGCOFFSET) of TSTREAM with (ffetch (STREAM COFFSET)
                                                                         of TSTREAM))
               (freplace (TEXTSTREAM PCCHARSLEFT) of TSTREAM with PCCHARSLEFT)
+              (CL:WHEN (ILESSP PCCHARSLEFT 0)
+                     (HELP "INSTALL.PIECE PCCHARSLEFT LESS THAN 0"))
               (RETURN PC)))])
 )
 
@@ -2313,7 +2417,8 @@
 (DEFINEQ
 
 (GETTEXTPROP
-  [LAMBDA (TEXTOBJ PROP)                                     (* ; "Edited  2-Mar-2024 07:09 by rmk")
+  [LAMBDA (TEXTOBJ PROP)                                     (* ; "Edited 20-Mar-2024 10:58 by rmk")
+                                                             (* ; "Edited  2-Mar-2024 07:09 by rmk")
                                                              (* ; "Edited 14-Jan-2024 16:35 by rmk")
                                                              (* ; "Edited 31-Oct-2023 23:32 by rmk")
                                                              (* ; "Edited 21-Sep-2023 09:48 by rmk")
@@ -2321,7 +2426,7 @@
 
     (* ;; "Gets values for document properties.  Used by TEXTPROP.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (SELECTQ PROP
         ((READONLY READ-ONLY) 
              (FGETTOBJ TEXTOBJ TXTREADONLY))
@@ -2338,7 +2443,10 @@
                PROP])
 
 (PUTTEXTPROP
-  [LAMBDA (TEXTOBJ PROP VALUE)                               (* ; "Edited  2-Mar-2024 07:09 by rmk")
+  [LAMBDA (TEXTOBJ PROP VALUE)                               (* ; "Edited 20-Mar-2024 10:59 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 18:08 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 22:18 by rmk")
+                                                             (* ; "Edited  2-Mar-2024 07:09 by rmk")
                                                              (* ; "Edited 14-Jan-2024 16:35 by rmk")
                                                              (* ; "Edited 31-Oct-2023 23:33 by rmk")
                                                              (* ; "Edited 21-Sep-2023 09:48 by rmk")
@@ -2346,14 +2454,17 @@
 
     (* ;; "Put a value on prop list for a textobj.  Some properties affect the fields of TEXTOBJ, but all go into EDITPROPS so that they can be retrieved as a whole.")
 
-    (\DTEST TEXTOBJ 'TEXTOBJ)
+    (TEXTOBJ! TEXTOBJ)
     (CL:UNLESS (LISTP (FGETTOBJ TEXTOBJ EDITPROPS))          (* ; 
                                                  "Make sure we have a list to smash, no matter what.")
         (FSETTOBJ TEXTOBJ EDITPROPS (LIST PROP NIL)))
     (PROG1 (GETTEXTPROP TEXTOBJ PROP)
         (SELECTQ PROP
             ((READONLY READ-ONLY) 
-                 (FSETTOBJ TEXTOBJ TXTREADONLY VALUE))
+                 (FSETTOBJ TEXTOBJ TXTREADONLY VALUE)
+                 (CL:WHEN NIL                                (* ; 
+                                            "This has to be done after the file is initially read in")
+                     (replace (STREAM ACCESS) of (FGETTOBJ TEXTOBJ STREAMHINT) with 'INPUT)))
             ((BEING-EDITED ACTIVE) 
                  (FSETTOBJ TEXTOBJ TXTEDITING VALUE))
             (READTABLE (FSETTOBJ TEXTOBJ TXTRTBL VALUE))
@@ -2394,7 +2505,7 @@
 (RPAQ? *TEDIT-OLD-STREAM-ERROR-HANDLER* (CONDITION-HANDLER 'XCL:STREAM-NOT-OPEN))
 (DECLARE%: DONTEVAL@LOAD DOCOPY 
 
-(\TEXTINIT)
+(\TEDIT.TEXTINIT)
 )
 (DECLARE%: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 
 
@@ -2405,24 +2516,27 @@
 (ADDTOVAR LAMA TEXTPROP)
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (33424 57078 (\TEXTBIN 33434 . 40939) (\TEXTPEEKBIN 40941 . 45164) (\TEXTBACKFILEPTR 
-45166 . 50720) (\TEDIT.INSTALL.FILEBUFFER 50722 . 54553) (\TEXTBOUT 54555 . 57076)) (57982 60902 (
-\TEXTSTREAM.OUTCHARFN 57992 . 59428) (\TEXTSTREAM.INCCCODEFN 59430 . 60171) (\TEXTSTREAM.BACKCCODEFN 
-60173 . 60651) (\TEXTSTREAM.FORMATBYTESTREAM 60653 . 60900)) (60949 71557 (OPENTEXTSTREAM 60959 . 
-66450) (COPYTEXTSTREAM 66452 . 69617) (TEDIT.STREAMCHANGEDP 69619 . 69921) (TEXTSTREAMP 69923 . 70337)
- (TXTFILE 70339 . 70808) (REOPENTEXTSTREAM 70810 . 71555)) (71558 95310 (\TEDIT.OPENTEXTSTREAM.PIECES 
-71568 . 75877) (\TEDIT.OPENTEXTSTREAM.PROPS 75879 . 76935) (\TEDIT.OPENTEXTSTREAM.SETUP.SEL 76937 . 
-80304) (\TEDIT.OPENTEXTSTREAM.WINDOW 80306 . 81670) (\TEDIT.OPENTEXTSTREAM.DEFAULTLOOKS 81672 . 83519)
- (\TEDIT.OPENTEXTFILE 83521 . 85120) (\TEDIT.CREATE.TEXTSTREAM 85122 . 85941) (\TEDIT.REOPEN.STREAM 
-85943 . 87941) (\TEXTINIT 87943 . 93991) (\TEXTTTYBOUT 93993 . 95308)) (95428 110166 (\TEXTCLOSEF 
-95438 . 96629) (\TEXTDSPFONT 96631 . 97632) (\TEXTEOFP 97634 . 99251) (\TEXTGETEOFPTR 99253 . 99467) (
-\TEXTGETFILEPTR 99469 . 101570) (\TEXTOPENF 101572 . 102544) (\TEXTSETEOF 102546 . 103061) (
-\TEXTSETFILEPTR 103063 . 104907) (\TEXTDSPXPOSITION 104909 . 105769) (\TEXTDSPYPOSITION 105771 . 
-106318) (\TEXTLEFTMARGIN 106320 . 106742) (\TEXTRIGHTMARGIN 106744 . 109700) (\TEXTDSPCHARWIDTH 109702
- . 109879) (\TEXTDSPSTRINGWIDTH 109881 . 110060) (\TEXTDSPLINEFEED 110062 . 110164)) (111213 130292 (
-\TEDIT.DELETE.SELPIECES 111223 . 114190) (\INSERTCH 114192 . 121250) (\INSERTCH.HISTORY 121252 . 
-124332) (\INSERTEOL 124334 . 126294) (\INSERTCH.INSERTION 126296 . 129127) (\INSERTCH.EXTEND 129129 . 
-130290)) (130293 131686 (\SETUPGETCH 130303 . 131684)) (131744 136844 (\TEDIT.INSTALL.PIECE 131754 . 
-136842)) (136882 140661 (GETTEXTPROP 136892 . 138137) (PUTTEXTPROP 138139 . 140159) (TEXTPROP 140161
- . 140659)))))
+  (FILEMAP (NIL (33937 60490 (\TEDIT.TEXTBIN 33947 . 42725) (\TEDIT.TEXTPEEKBIN 42727 . 48164) (
+\TEDIT.TEXTBACKFILEPTR 48166 . 53726) (\TEDIT.TEXTBOUT 53728 . 56486) (\TEDIT.INSTALL.FILEBUFFER 56488
+ . 60488)) (61388 65319 (\TEDIT.TEXTOUTCHARFN 61398 . 62954) (\TEDIT.TEXTINCCODEFN 62956 . 63695) (
+\TEDIT.TEXTBACKCCODEFN 63697 . 64289) (\TEDIT.TEXTFORMATBYTESTREAM 64291 . 64877) (
+\TEDIT.TEXTFORMATBYTESTRING 64879 . 65317)) (65366 75866 (OPENTEXTSTREAM 65376 . 71602) (
+COPYTEXTSTREAM 71604 . 75089) (TEDIT.STREAMCHANGEDP 75091 . 75393) (TXTFILE 75395 . 75864)) (75867 
+100813 (\TEDIT.REOPENTEXTSTREAM 75877 . 77229) (\TEDIT.OPENTEXTSTREAM.PIECES 77231 . 81611) (
+\TEDIT.OPENTEXTSTREAM.PROPS 81613 . 82669) (\TEDIT.OPENTEXTSTREAM.SETUP.SEL 82671 . 86165) (
+\TEDIT.OPENTEXTSTREAM.WINDOW 86167 . 87762) (\TEDIT.OPENTEXTSTREAM.DEFAULTLOOKS 87764 . 89611) (
+\TEDIT.OPENTEXTFILE 89613 . 91212) (\TEDIT.CREATE.TEXTSTREAM 91214 . 92148) (\TEDIT.REOPEN.STREAM 
+92150 . 94269) (\TEDIT.TEXTINIT 94271 . 100811)) (100851 101970 (\TEDIT.TTYBOUT 100861 . 101968)) (
+102088 118131 (\TEDIT.TEXTCLOSEF 102098 . 103422) (\TEDIT.TEXTDSPFONT 103424 . 104394) (
+\TEDIT.TEXTEOFP 104396 . 106151) (\TEDIT.TEXTGETEOFPTR 106153 . 106476) (\TEDIT.TEXTGETFILEPTR 106478
+ . 108802) (\TEDIT.TEXTOPENF 108804 . 109735) (\TEDIT.TEXTSETEOF 109737 . 110353) (
+\TEDIT.TEXTSETFILEPTR 110355 . 112396) (\TEDIT.TEXTDSPXPOSITION 112398 . 113306) (
+\TEDIT.TEXTDSPYPOSITION 113308 . 113937) (\TEDIT.TEXTLEFTMARGIN 113939 . 114316) (
+\TEDIT.TEXTRIGHTMARGIN 114318 . 117280) (\TEDIT.TEXTDSPCHARWIDTH 117282 . 117586) (
+\TEDIT.TEXTDSPSTRINGWIDTH 117588 . 117894) (\TEDIT.TEXTDSPLINEFEED 117896 . 118129)) (119178 138817 (
+\TEDIT.DELETE.SELPIECES 119188 . 122290) (\TEDIT.INSERTCH 122292 . 129521) (\TEDIT.INSERTCH.HISTORY 
+129523 . 132609) (\TEDIT.INSERTEOL 132611 . 134692) (\TEDIT.INSERTCH.INSERTION 134694 . 137531) (
+\TEDIT.INSERTCH.EXTEND 137533 . 138815)) (138818 140326 (\SETUPGETCH 138828 . 140324)) (140384 145479 
+(\TEDIT.INSTALL.PIECE 140394 . 145477)) (145517 150001 (GETTEXTPROP 145527 . 146874) (PUTTEXTPROP 
+146876 . 149499) (TEXTPROP 149501 . 149999)))))
 STOP
diff --git a/library/tedit/TEDIT-STREAM.LCOM b/library/tedit/TEDIT-STREAM.LCOM
index 6fa7572e..93369ffe 100644
Binary files a/library/tedit/TEDIT-STREAM.LCOM and b/library/tedit/TEDIT-STREAM.LCOM differ
diff --git a/library/tedit/TEDIT-STRESS b/library/tedit/TEDIT-STRESS
index 9c3ce7af..fc0b15f6 100644
--- a/library/tedit/TEDIT-STRESS
+++ b/library/tedit/TEDIT-STRESS
@@ -1,31 +1,31 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "14-Mar-2024 15:16:05" {WMEDLEY}<library>tedit>TEDIT-STRESS.;49 12388  
+(FILECREATED "19-Mar-2024 21:34:32" {WMEDLEY}<library>TEDIT>TEDIT-STRESS.;70 15296  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS STRESSHC)
+      :CHANGES-TO (FNS STRESSHC STRESSRAND STRESSPUT STRESSOPEN STRESSREAD STRESSPEEK)
+                  (VARS TEDIT-STRESSCOMS)
 
-      :PREVIOUS-DATE "13-Mar-2024 00:24:06" {WMEDLEY}<library>tedit>TEDIT-STRESS.;48)
+      :PREVIOUS-DATE "17-Mar-2024 19:46:53" {WMEDLEY}<library>TEDIT>TEDIT-STRESS.;54)
 
 
 (PRETTYCOMPRINT TEDIT-STRESSCOMS)
 
 (RPAQQ TEDIT-STRESSCOMS (                                    (* ; "Preload typical image objects")
-                         (FILES SKETCH DATEFORMAT-EDITOR)
-                         (FNS STRESSHC STRESSRAND STRESSPUT STRESSOPEN STRESSREAD)
+                         (FNS STRESSHC STRESSRAND STRESSPUT STRESSOPEN STRESSREAD STRESSGREP 
+                              STRESSPEEK)
                          (FNS EQTEXTSTREAM SYSOUTRING COPYTOCORE)))
 
 
 
 (* ; "Preload typical image objects")
 
-
-(FILESLOAD SKETCH DATEFORMAT-EDITOR)
 (DEFINEQ
 
 (STRESSHC
-  [LAMBDA (FILES NSYSOUTS REPS NOERROR SEPARATEOUT PDF SYSOUTNAME SINGLESTEP)
+  [LAMBDA (FILES NSYSOUTS REPS ERROR SEPARATEOUT PDF SYSOUTNAME SINGLESTEP)
+                                                             (* ; "Edited 19-Mar-2024 21:33 by rmk")
                                                              (* ; "Edited 14-Mar-2024 15:15 by rmk")
                                                              (* ; "Edited 13-Mar-2024 00:23 by rmk")
     (DECLARE (SPECVARS SINGLESTEP))
@@ -34,10 +34,7 @@
 
     (CL:UNLESS FILES
         (SETQ FILES (FILDIR '*.TEDIT;)))
-    (SETQ REPS (SELECTQ REPS
-                   (NIL MAX.SMALLP)
-                   REPS))
-    (SETQ NOERROR T)
+    (CL:UNLESS REPS (SETQ REPS MAX.SMALLP))
     (CL:UNLESS NSYSOUTS
         (SETQ NSYSOUTS 'SAVEVM))
     [SETQ SYSOUTNAME (PACKFILENAME 'VERSION NIL 'BODY (OR SYSOUTNAME (PACKFILENAME 'DIRECTORY 
@@ -64,34 +61,35 @@
           (if (EQ NSYSOUTS 'SAVEVM)
               then (SAVEVM)
             else (SETQ SYSOUTS (SYSOUTRING NSYSOUTS SYSOUTNAME SYSOUTS)))
-          [for F TS HCFILE inside FILES
+          [for F TSTRM HCFILE inside FILES
              do (PROMPTPRINT F)
                 (SETQ HCFILE (CL:IF SEPARATEOUT
                                  (OUTFILEP (PACKFILENAME 'EXTENSION ITYPE 'VERSION 1 'BODY F))
                                  (CL:IF PDF
                                      "{CORE}FOO.PDF;1"
                                      "{CORE}FOO.PS;1")))
-                (if [if NOERROR
-                        then [NLSETQ (SETQ TS (OPENTEXTSTREAM F))
-                                    (TEDIT.FORMAT.HARDCOPY TS HCFILE T NIL NIL NIL
-                                           (CL:IF PDF
-                                               'PDF
-                                               'POSTSCRIPT)]
-                      else (SETQ TS (OPENTEXTSTREAM F))
-                           (TEDIT.FORMAT.HARDCOPY TS HCFILE T NIL NIL NIL (CL:IF PDF
-                                                                              'PDF
-                                                                              'POSTSCRIPT)]
+                (if [if ERROR
+                        then (SETQ TSTRM (OPENTEXTSTREAM F))
+                             (TEDIT.FORMAT.HARDCOPY TSTRM HCFILE T NIL NIL NIL (CL:IF PDF
+                                                                                   'PDF
+                                                                                   'POSTSCRIPT))
+                      else (NLSETQ (SETQ TSTRM (OPENTEXTSTREAM F))
+                                  (TEDIT.FORMAT.HARDCOPY TSTRM HCFILE T NIL NIL NIL
+                                         (CL:IF PDF
+                                             'PDF
+                                             'POSTSCRIPT)]
                     then (add N 1)
                   else (PRINTOUT T "  Error for " (PACKFILENAME 'HOST NIL 'DIRECTORY NIL 'BODY F)
                               T))
-                (CLOSEF? TS)
+                (CLOSEF? TSTRM)
                 (CL:WHEN SINGLESTEP
                     (HELP (CONCAT "Just hardcopied " F " to " HCFILE)))]
           (PRINTOUT T "  Hardcopied " N " files without failure" T)
        finally (RETURN (LIST R N])
 
 (STRESSRAND
-  [LAMBDA (FILES REPS NOERROR PROBESPERFILE)                 (* ; "Edited 12-Mar-2024 09:47 by rmk")
+  [LAMBDA (FILES REPS ERROR PROBESPERFILE)                   (* ; "Edited 19-Mar-2024 21:33 by rmk")
+                                                             (* ; "Edited 12-Mar-2024 09:47 by rmk")
 
     (* ;; "Opens, fetches random characters")
 
@@ -106,21 +104,25 @@
            " files with " PROBESPERFILE " probes per file" T)
     (for R (N _ 0) from 1 to REPS
        do (PRINTOUT T R " ")
-          (for F TS inside FILES
-             do (if [if NOERROR
-                        then [NLSETQ (SETQ TS (OPENTEXTSTREAM F))
-                                    (for I (LEN _ (TEDIT.NCHARS TS)) from 1 to PROBESPERFILE
-                                       do (TEDIT.NTHCHARCODE TS (RAND 1 LEN]
-                      else (SETQ TS (OPENTEXTSTREAM F))
-                           (for I (LEN _ (TEDIT.NCHARS TS)) from 1 to PROBESPERFILE
-                              do (TEDIT.NTHCHARCODE TS (RAND 1 LEN]
-                    then (CLOSEF TS)
+          (for F TSTRM inside FILES
+             do (if (if ERROR
+                        then (SETQ TSTRM (OPENTEXTSTREAM F))
+                             (for I (LEN _ (TEDIT.NCHARS TSTRM)) from 1 to PROBESPERFILE
+                                do (TEDIT.NTHCHARCODE TSTRM (RAND 1 LEN)))
+                             T
+                      else (CAR (NLSETQ (SETQ TSTRM (OPENTEXTSTREAM F))
+                                       (for I (LEN _ (TEDIT.NCHARS TSTRM)) from 1 to PROBESPERFILE
+                                          do (TEDIT.NTHCHARCODE TSTRM (RAND 1 LEN)))
+                                       T)))
+                    then (CLOSEF TSTRM)
                          (add N 1)
-                  else (PRINTOUT T T "Error for " (PACKFILENAME 'HOST NIL 'DIRECTORY NIL 'BODY F)
-                              T))) finally (RETURN (LIST R N])
+                  else (PRINTOUT T "  Error for " (PACKFILENAME 'HOST NIL 'DIRECTORY NIL 'BODY F)
+                              T)) repeatwhile (PROGN (CLOSEF? TSTRM)
+                                                     T)) finally (RETURN (LIST R N])
 
 (STRESSPUT
-  [LAMBDA (FILES REPS NOERROR CHECKEQUIV STOP)               (* ; "Edited 12-Mar-2024 09:48 by rmk")
+  [LAMBDA (FILES REPS NOERROR CHECKEQUIV STOP)               (* ; "Edited 19-Mar-2024 21:34 by rmk")
+                                                             (* ; "Edited 12-Mar-2024 09:48 by rmk")
 
     (* ;; "Opens, puts, reopens and tests for equivalence")
 
@@ -134,27 +136,28 @@
            " files" T)
     (for R (N _ 0) from 1 to REPS
        do (PRINTOUT T R " ")
-          (for F TS TSP inside FILES
+          (for F TSTRM TSP inside FILES
              do (if (if NOERROR
-                        then (NLSETQ (SETQ TS (OPENTEXTSTREAM F))
-                                    (TEDIT.PUT TS "{CORE}FOO.TEDIT;1")
+                        then (NLSETQ (SETQ TSTRM (OPENTEXTSTREAM F))
+                                    (TEDIT.PUT TSTRM "{CORE}FOO.TEDIT;1")
                                     (SETQ TSP (OPENTEXTSTREAM "{CORE}FOO.TEDIT;1"))
-                                    (CL:WHEN (AND CHECKEQUIV (NOT (EQTEXTSTREAM TS TSP STOP)))
+                                    (CL:WHEN (AND CHECKEQUIV (NOT (EQTEXTSTREAM TSTRM TSP STOP)))
                                            (HELP "Get of put not equivalent" F))
                                     (CLOSEF TSP))
-                      else (SETQ TS (OPENTEXTSTREAM F))
-                           (TEDIT.PUT TS "{CORE}FOO.TEDIT;1")
+                      else (SETQ TSTRM (OPENTEXTSTREAM F))
+                           (TEDIT.PUT TSTRM "{CORE}FOO.TEDIT;1")
                            (SETQ TSP (OPENTEXTSTREAM "{CORE}FOO.TEDIT;1"))
-                           (CL:WHEN (AND CHECKEQUIV (NOT (EQTEXTSTREAM TS TSP STOP)))
+                           (CL:WHEN (AND CHECKEQUIV (NOT (EQTEXTSTREAM TSTRM TSP STOP)))
                                   (HELP "Get of put not equivalent" F))
                            (CLOSEF TSP))
-                    then (CLOSEF TS)
+                    then (CLOSEF TSTRM)
                          (add N 1)
                   else (PRINTOUT T T "Error for " (PACKFILENAME 'HOST NIL 'DIRECTORY NIL 'BODY F)
                               T))) finally (RETURN (LIST R N])
 
 (STRESSOPEN
-  [LAMBDA (FILES REPS NOERROR)                               (* ; "Edited 12-Mar-2024 09:48 by rmk")
+  [LAMBDA (FILES REPS NOERROR)                               (* ; "Edited 19-Mar-2024 21:34 by rmk")
+                                                             (* ; "Edited 12-Mar-2024 09:48 by rmk")
                                                              (* ; "Edited 11-Mar-2024 09:15 by rmk")
     (CL:UNLESS FILES
         (SETQ FILES (FILDIR '*.TEDIT;)))
@@ -166,18 +169,20 @@
            " files" T)
     (for R (N _ 0) from 1 to REPS
        do (PRINTOUT T R " ")
-          (for F TS inside FILES do (if (if NOERROR
-                                            then (NLSETQ (SETQ TS (OPENTEXTSTREAM F)))
-                                          else (SETQ TS (OPENTEXTSTREAM F)))
-                                        then (CLOSEF TS)
-                                             (add N 1)
-                                      else (PRINTOUT T T "Error for " (PACKFILENAME 'HOST NIL
-                                                                             'DIRECTORY NIL
-                                                                             'BODY F)
-                                                  T))) finally (RETURN (LIST R N])
+          (for F TSTRM inside FILES do (if (if NOERROR
+                                               then (NLSETQ (SETQ TSTRM (OPENTEXTSTREAM F)))
+                                             else (SETQ TSTRM (OPENTEXTSTREAM F)))
+                                           then (CLOSEF TSTRM)
+                                                (add N 1)
+                                         else (PRINTOUT T T "Error for " (PACKFILENAME 'HOST NIL
+                                                                                'DIRECTORY NIL
+                                                                                'BODY F)
+                                                     T))) finally (RETURN (LIST R N])
 
 (STRESSREAD
-  [LAMBDA (FILES REPS NOERROR)                               (* ; "Edited 12-Mar-2024 09:48 by rmk")
+  [LAMBDA (FILES REPS NOERROR)                               (* ; "Edited 19-Mar-2024 21:34 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 15:19 by rmk")
+                                                             (* ; "Edited 12-Mar-2024 09:48 by rmk")
                                                              (* ; "Edited 11-Mar-2024 09:13 by rmk")
     (CL:UNLESS FILES
         (SETQ FILES (FILDIR '*.TEDIT;)))
@@ -189,16 +194,50 @@
            " files" T)
     (for R (N _ 0) from 1 to REPS
        do (PRINTOUT T R " ")
-          (for F TS inside FILES
+          (for F TSTRM inside FILES
              do (if (if NOERROR
-                        then (NLSETQ (SETQ TS (OPENTEXTSTREAM F))
-                                    (for I from 1 while (TEDIT.NTHCHARCODE TS I)))
-                      else (SETQ TS (OPENTEXTSTREAM F))
-                           (for I from 1 while (TEDIT.NTHCHARCODE TS I)))
-                    then (CLOSEF TS)
+                        then (NLSETQ (SETQ TSTRM (OPENTEXTSTREAM F))
+                                    (for I from 1 while (TEDIT.NTHCHARCODE TSTRM I)))
+                      else (SETQ TSTRM (OPENTEXTSTREAM F))
+                           (for I from 1 while (TEDIT.NTHCHARCODE TSTRM I))
+                           T)
+                    then (CLOSEF TSTRM)
                          (add N 1)
                   else (PRINTOUT T T "Error for " (PACKFILENAME 'HOST NIL 'DIRECTORY NIL 'BODY F)
-                              T))) finally (RETURN (LIST R N])
+                              T))) finally (RETURN (LIST (SUB1 R)
+                                                         N])
+
+(STRESSGREP
+  [LAMBDA (FILES NOERROR TARGET)                             (* ; "Edited 17-Mar-2024 19:46 by rmk")
+
+    (* ;; "GREP does forward bins and peekbins.  If it hits on something, it also runs the backfileptr function.  FOO appears in quite a few lispusers/ Tedit files.")
+
+    (CL:UNLESS FILES
+        (SETQ FILES (FILDIR '*.TEDIT;)))
+    (CL:UNLESS TARGET (SETQ TARGET "FOO"))
+    (FILESLOAD GREP)
+    (for F inside FILES unless (if NOERROR
+                                   then (NLSETQ (GREP TARGET F))
+                                 else (GREP TARGET F)
+                                      T) do (PRINTOUT T T "Error for " (PACKFILENAME 'HOST NIL
+                                                                              'DIRECTORY NIL
+                                                                              'BODY F)
+                                                   T])
+
+(STRESSPEEK
+  [LAMBDA (FILES ERROR)                                      (* ; "Edited 19-Mar-2024 21:33 by rmk")
+    (CL:UNLESS FILES
+        (SETQ FILES (FILDIR '*.TEDIT;)))
+    (for F TSTRM inside FILES eachtime (SETQ TSTRM (OPENTEXTSTREAM F))
+       unless [if ERROR
+                  then (bind P while (SETQ P (PEEKCCODE TSTRM T)) always (EQ P (BIN TSTRM)))
+                else (NLSETQ (bind P while (SETQ P (PEEKCCODE TSTRM T))
+                                always (EQ P (BIN TSTRM] do (PRINTOUT T "Error for "
+                                                                   (PACKFILENAME 'HOST NIL
+                                                                          'DIRECTORY NIL 'BODY F)
+                                                                   T)
+       repeatwhile (PROGN (CLOSEF? TSTRM)
+                          T])
 )
 (DEFINEQ
 
@@ -254,7 +293,7 @@
        finally (CL:UNLESS NORECLAIM (RECLAIM])
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (742 9789 (STRESSHC 752 . 4159) (STRESSRAND 4161 . 5577) (STRESSPUT 5579 . 7289) (
-STRESSOPEN 7291 . 8579) (STRESSREAD 8581 . 9787)) (9790 12365 (EQTEXTSTREAM 9800 . 10851) (SYSOUTRING 
-10853 . 11733) (COPYTOCORE 11735 . 12363)))))
+  (FILEMAP (NIL (795 12697 (STRESSHC 805 . 4271) (STRESSRAND 4273 . 6009) (STRESSPUT 6011 . 7854) (
+STRESSOPEN 7856 . 9289) (STRESSREAD 9291 . 10826) (STRESSGREP 10828 . 11771) (STRESSPEEK 11773 . 12695
+)) (12698 15273 (EQTEXTSTREAM 12708 . 13759) (SYSOUTRING 13761 . 14641) (COPYTOCORE 14643 . 15271)))))
 STOP
diff --git a/library/tedit/TEDIT-STRESS.LCOM b/library/tedit/TEDIT-STRESS.LCOM
index 3436fc4a..3b9adf97 100644
Binary files a/library/tedit/TEDIT-STRESS.LCOM and b/library/tedit/TEDIT-STRESS.LCOM differ
diff --git a/library/tedit/TEDIT-TFBRAVO b/library/tedit/TEDIT-TFBRAVO
index 99b16b1a..98f2b06d 100644
--- a/library/tedit/TEDIT-TFBRAVO
+++ b/library/tedit/TEDIT-TFBRAVO
@@ -1,12 +1,15 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "17-Jan-2024 12:12:29" {WMEDLEY}<library>TEDIT>TEDIT-TFBRAVO.;150 90820  
+(FILECREATED "17-Mar-2024 18:27:18" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-TFBRAVO.;153 91304  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS TEDITFROMBRAVO)
+      :CHANGES-TO (VARS TEDIT-TFBRAVOCOMS)
+                  (FNS \TEDIT.NAMEDTAB.INIT)
 
-      :PREVIOUS-DATE "16-Jan-2024 18:30:43" {WMEDLEY}<library>TEDIT>TEDIT-TFBRAVO.;149)
+      :PREVIOUS-DATE "17-Mar-2024 12:41:56" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>TEDIT-TFBRAVO.;152)
 
 
 (PRETTYCOMPRINT TEDIT-TFBRAVOCOMS)
@@ -59,10 +62,10 @@
                   'BREAKCHAR PROFILE.PARA.RDTBL))
         (COMS                                                (* ; "Named tabs. To be removed")
               (FNS \TFBRAVO.ADD.NAMEDTAB \TFBRAVO.COPY.NAMEDTAB \TFBRAVO.PUT.NAMEDTAB 
-                   \TFBRAVO.GET.NAMEDTAB \NAMEDTABNYET \NAMEDTABSIZE \NAMEDTABPREPRINT \NAMEDTAB.INIT
-                   )
+                   \TFBRAVO.GET.NAMEDTAB \NAMEDTABNYET \NAMEDTABSIZE \NAMEDTABPREPRINT 
+                   \TEDIT.NAMEDTAB.INIT)
               (GLOBALVARS \NAMEDTAB.IMAGEFNS)
-              (DECLARE%: DONTEVAL@LOAD DOCOPY (P (AND NIL (\NAMEDTAB.INIT])
+              (DECLARE%: DONTEVAL@LOAD DOCOPY (P (AND NIL (\TEDIT.NAMEDTAB.INIT])
 (DECLARE%: EVAL@COMPILE DONTCOPY 
 
 (FILESLOAD TEDIT-EXPORTS.ALL)
@@ -936,7 +939,8 @@
                                                   (\TFBRAVO.INSERT.RUN RUN BSTREAM PFMTSPEC TEXTOBJ])
 
 (\TFBRAVO.INSERT.RUN
-  [LAMBDA (RUN BSTREAM PARAFMTSPEC TEXTOBJ)                  (* ; "Edited 16-Jan-2024 18:28 by rmk")
+  [LAMBDA (RUN BSTREAM PARAFMTSPEC TEXTOBJ)                  (* ; "Edited 17-Mar-2024 12:41 by rmk")
+                                                             (* ; "Edited 16-Jan-2024 18:28 by rmk")
                                                              (* ; "Edited 29-Dec-2023 11:50 by rmk")
                                                              (* ; "Edited 23-Sep-2023 12:11 by rmk")
                                                              (* ; "Edited 23-Aug-2023 08:31 by rmk")
@@ -980,7 +984,7 @@
                           (SETQ PBYTESPERCHAR 1)
                           (SETQ PBYTELEN NCHARS)
                           (SETQ PUTF8BYTESPERCHAR 2)))
-             (\INSERTPIECE PC NIL TEXTOBJ)
+             (\TEDIT.INSERTPIECE PC NIL TEXTOBJ)
              PC))])
 
 (\TFBRAVO.SPLIT.PARA
@@ -1083,7 +1087,8 @@
          NEWPARAS])
 
 (\TFBRAVO.RUN.TABSPEC
-  [LAMBDA (RUN PARAFMTSPEC)                                  (* ; "Edited 22-Aug-2023 16:54 by rmk")
+  [LAMBDA (RUN PARAFMTSPEC)                                  (* ; "Edited 15-Mar-2024 19:42 by rmk")
+                                                             (* ; "Edited 22-Aug-2023 16:54 by rmk")
                                                              (* ; "Edited 19-Aug-2023 15:47 by rmk")
 
     (* ;; "The CLUSERINFO contains a list of named tabs specified for this and presumably defined in the paragraph-wide PARAFMTSPEC. This returns a FMTSPEC for this run that only includes the named tabs that this run calls for.")
@@ -1127,7 +1132,7 @@
                                                         (RETURN (CDR (CADR TDTAIL]
                                       else (GO $$ITERATE]
 
-             (* ;; "This asserts that the tabdefs are constant across a paragraph, that the right number of tabs are on each line in a paragraph.  That assumption is mostly reasonable, given the paragraph splitting. The code above allows each run (piece) to have its own tab settings.  Although \FORMATLINE.UPDATELOOKS can easily be modified to allow the pieces on a line to change their tab definitions, the paragraph-looks menu assumes that tabs are constant across a paragraph.  So things would go bonkers.")
+             (* ;; "This asserts that the tabdefs are constant across a paragraph, that the right number of tabs are on each line in a paragraph.  That assumption is mostly reasonable, given the paragraph splitting. The code above allows each run (piece) to have its own tab settings.  Although \TEDIT.FORMATLINE.UPDATELOOKS can easily be modified to allow the pieces on a line to change their tab definitions, the paragraph-looks menu assumes that tabs are constant across a paragraph.  So things would go bonkers.")
 
              [SETQ TABSPEC (SORT (for TAB in TABDEFS collect (CDR TAB))
                                  (FUNCTION (LAMBDA (T1 T2)
@@ -1419,8 +1424,9 @@
     (CONCAT "[TAB" (IMAGEOBJPROP TABOBJ 'TABNAME)
            "]"])
 
-(\NAMEDTAB.INIT
-  [LAMBDA NIL                                                (* ; "Edited  6-Aug-2023 18:59 by rmk")
+(\TEDIT.NAMEDTAB.INIT
+  [LAMBDA NIL                                                (* ; "Edited 17-Mar-2024 18:26 by rmk")
+                                                             (* ; "Edited  6-Aug-2023 18:59 by rmk")
                                                              (* jds "22-Aug-84 14:49")
     (SETQ \NAMEDTAB.IMAGEFNS (IMAGEFNSCREATE 'NILL (FUNCTION \NAMEDTABSIZE)
                                     (FUNCTION \TFBRAVO.PUT.NAMEDTAB)
@@ -1428,7 +1434,7 @@
                                     (FUNCTION \TFBRAVO.COPY.NAMEDTAB)
                                     (FUNCTION NILL)
                                     (FUNCTION NILL)
-                                    (FUNCTION MOVE.NAMED.TAB)
+                                    (FUNCTION NILL)
                                     (FUNCTION NILL)
                                     (FUNCTION NILL)
                                     (FUNCTION NILL)
@@ -1441,21 +1447,21 @@
 )
 (DECLARE%: DONTEVAL@LOAD DOCOPY 
 
-(AND NIL (\NAMEDTAB.INIT))
+(AND NIL (\TEDIT.NAMEDTAB.INIT))
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (6652 13034 (TEDIT.BRAVOFILE? 6662 . 8392) (TEDITFROMBRAVO 8394 . 13032)) (13145 28131 (
-\TFBRAVO.GET.USER.CM 13155 . 15965) (\TFBRAVO.USER.CM.LOOKS 15967 . 17142) (\TFBRAVO.READ.USER.CM 
-17144 . 21481) (\TFBRAVO.INIT.PARALOOKS 21483 . 23244) (\TFBRAVO.INIT.PAGEFORMAT 23246 . 24126) (
-\TFBRAVO.GETPARAMS 24128 . 26982) (\TFBRAVO.FIND.LAST.TRAILER 26984 . 28129)) (28173 48186 (
-\TFBRAVO.PARSE.PARA 28183 . 31870) (\TFBRAVO.READ.PARALOOKS 31872 . 38506) (\TFBRAVO.CREATE.RUNS 38508
- . 39896) (\TFBRAVO.READ.CHARLOOKS 39898 . 44916) (\TFBRAVO.FONT.FROM.CHARLOOKS 44918 . 46287) (
-\TFBRAVO.READNUM? 46289 . 48184)) (48223 58974 (\TFBRAVO.HANDLE.HEADING 48233 . 50865) (
-\TFBRAVO.PARSE.PROFILE.PARA 50867 . 58972)) (59017 79934 (\TFBRAVO.INSERT.PARA 59027 . 59680) (
-\TFBRAVO.INSERT.RUN 59682 . 62764) (\TFBRAVO.SPLIT.PARA 62766 . 70008) (\TFBRAVO.RUN.TABSPEC 70010 . 
-74239) (\TFBRAVO.INSTALL.PAGEFORMAT 74241 . 79932)) (79935 83895 (\TFBRAVO.ASSERT 79945 . 80292) (
-\TEST.CHARACTER.LOOKS 80294 . 82180) (\TEST.PARAGRAPH.LOOKS 82182 . 83893)) (84380 90660 (
-\TFBRAVO.ADD.NAMEDTAB 84390 . 87723) (\TFBRAVO.COPY.NAMEDTAB 87725 . 88173) (\TFBRAVO.PUT.NAMEDTAB 
-88175 . 88455) (\TFBRAVO.GET.NAMEDTAB 88457 . 88834) (\NAMEDTABNYET 88836 . 88996) (\NAMEDTABSIZE 
-88998 . 89513) (\NAMEDTABPREPRINT 89515 . 89713) (\NAMEDTAB.INIT 89715 . 90658)))))
+  (FILEMAP (NIL (6795 13177 (TEDIT.BRAVOFILE? 6805 . 8535) (TEDITFROMBRAVO 8537 . 13175)) (13288 28274 (
+\TFBRAVO.GET.USER.CM 13298 . 16108) (\TFBRAVO.USER.CM.LOOKS 16110 . 17285) (\TFBRAVO.READ.USER.CM 
+17287 . 21624) (\TFBRAVO.INIT.PARALOOKS 21626 . 23387) (\TFBRAVO.INIT.PAGEFORMAT 23389 . 24269) (
+\TFBRAVO.GETPARAMS 24271 . 27125) (\TFBRAVO.FIND.LAST.TRAILER 27127 . 28272)) (28316 48329 (
+\TFBRAVO.PARSE.PARA 28326 . 32013) (\TFBRAVO.READ.PARALOOKS 32015 . 38649) (\TFBRAVO.CREATE.RUNS 38651
+ . 40039) (\TFBRAVO.READ.CHARLOOKS 40041 . 45059) (\TFBRAVO.FONT.FROM.CHARLOOKS 45061 . 46430) (
+\TFBRAVO.READNUM? 46432 . 48327)) (48366 59117 (\TFBRAVO.HANDLE.HEADING 48376 . 51008) (
+\TFBRAVO.PARSE.PROFILE.PARA 51010 . 59115)) (59160 80307 (\TFBRAVO.INSERT.PARA 59170 . 59823) (
+\TFBRAVO.INSERT.RUN 59825 . 63022) (\TFBRAVO.SPLIT.PARA 63024 . 70266) (\TFBRAVO.RUN.TABSPEC 70268 . 
+74612) (\TFBRAVO.INSTALL.PAGEFORMAT 74614 . 80305)) (80308 84268 (\TFBRAVO.ASSERT 80318 . 80665) (
+\TEST.CHARACTER.LOOKS 80667 . 82553) (\TEST.PARAGRAPH.LOOKS 82555 . 84266)) (84753 91138 (
+\TFBRAVO.ADD.NAMEDTAB 84763 . 88096) (\TFBRAVO.COPY.NAMEDTAB 88098 . 88546) (\TFBRAVO.PUT.NAMEDTAB 
+88548 . 88828) (\TFBRAVO.GET.NAMEDTAB 88830 . 89207) (\NAMEDTABNYET 89209 . 89369) (\NAMEDTABSIZE 
+89371 . 89886) (\NAMEDTABPREPRINT 89888 . 90086) (\TEDIT.NAMEDTAB.INIT 90088 . 91136)))))
 STOP
diff --git a/library/tedit/TEDIT-TFBRAVO.LCOM b/library/tedit/TEDIT-TFBRAVO.LCOM
index 4f2b7355..bf118a3a 100644
Binary files a/library/tedit/TEDIT-TFBRAVO.LCOM and b/library/tedit/TEDIT-TFBRAVO.LCOM differ
diff --git a/library/tedit/TEDIT-WINDOW b/library/tedit/TEDIT-WINDOW
index 742cbb7c..ae2d8e49 100644
--- a/library/tedit/TEDIT-WINDOW
+++ b/library/tedit/TEDIT-WINDOW
@@ -1,14 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "21-Mar-2024 21:48:49" 
-{DSK}<Users>kaplan>Local>medley3.5>git-medley>library>tedit>TEDIT-WINDOW.;69 195813 
+(FILECREATED "27-Mar-2024 15:23:52" {WMEDLEY}<library>tedit>TEDIT-WINDOW.;407 201953 
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS TEDIT.NORMALIZECARET)
+      :CHANGES-TO (FNS \TEDIT.PROCEXITFN \TEDIT.BUTTONEVENTFN)
 
-      :PREVIOUS-DATE "17-Mar-2024 23:43:56" 
-{DSK}<Users>kaplan>Local>medley3.5>git-medley>library>tedit>TEDIT-WINDOW.;68)
+      :PREVIOUS-DATE "21-Mar-2024 21:27:34" {WMEDLEY}<library>TEDIT>TEDIT-WINDOW.;405)
 
 
 (PRETTYCOMPRINT TEDIT-WINDOWCOMS)
@@ -140,10 +138,10 @@
                               (PUTWINDOWPROP DATUM 'TEDIT-NEXT-PANE-DOWN NEWVALUE))
                        (WTEXTSTREAM (GETWINDOWPROP DATUM 'TEXTSTREAM)
                               (PUTWINDOWPROP DATUM 'TEXTSTREAM NEWVALUE))
-                       (WTEXTOBJ (GETWINDOWPROP DATUM 'TEXTOBJ)
-                              (PUTWINDOWPROP DATUM 'TEXTOBJ NEWVALUE))
-                       (PTEXTOBJ (GETWINDOWPROP DATUM 'TEXTOBJ)
-                              (PUTWINDOWPROP DATUM 'TEXTOBJ NEWVALUE))
+                       (WTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of (fetch (TEXTWINDOW WTEXTSTREAM)
+                                                                   of DATUM)))
+                       (PTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of (fetch (TEXTWINDOW WTEXTSTREAM)
+                                                                   of DATUM)))
                        (WLINES (GETWINDOWPROP DATUM 'LINES)
                               (PUTWINDOWPROP DATUM 'LINES NEWVALUE))
                        (CURSORREGION (GETWINDOWPROP DATUM 'TEDIT.CURSORREGION)
@@ -236,7 +234,8 @@
 (DEFINEQ
 
 (\TEDIT.CREATEW
-  [LAMBDA (WINDOW TSTREAM PROPS)                             (* ; "Edited 14-Jan-2024 22:13 by rmk")
+  [LAMBDA (WINDOW TSTREAM PROPS)                             (* ; "Edited 20-Mar-2024 09:57 by rmk")
+                                                             (* ; "Edited 14-Jan-2024 22:13 by rmk")
                                                              (* ; "Edited 18-Dec-2023 23:01 by rmk")
                                                              (* ; "Edited 25-Nov-2023 10:37 by rmk")
                                                              (* ; "Edited 23-Oct-2023 22:11 by rmk")
@@ -257,9 +256,8 @@
     (LET ((TEXTOBJ (TEXTOBJ TSTREAM))
           (PHEIGHT 0)
           TITLE REGIONTYPE PROMPTPROP REGION FILE PWINDOW PREPROMPT WTEXTOBJ)
-         (CL:WHEN (AND (WINDOWP WINDOW))
-             (CL:WHEN (SETQ WTEXTOBJ (fetch (TEXTWINDOW WTEXTOBJ)
-                                            WINDOW))
+         (CL:WHEN (WINDOWP WINDOW)
+             (CL:WHEN (SETQ WTEXTOBJ (fetch (TEXTWINDOW WTEXTOBJ) of WINDOW))
 
                  (* ;; "Reusing an existing Tedit window, undo its splits.")
 
@@ -334,7 +332,8 @@
          WINDOW])
 
 (\TEDIT.WINDOW.SETUP
-  [LAMBDA (PANE TSTREAM PROPS AFTERPANE FIRSTLINE)           (* ; "Edited  9-Feb-2024 10:51 by rmk")
+  [LAMBDA (PANE TSTREAM PROPS AFTERPANE FIRSTLINE)           (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited  9-Feb-2024 10:51 by rmk")
                                                              (* ; "Edited 29-Jan-2024 17:10 by rmk")
                                                              (* ; "Edited 11-Jan-2024 19:33 by rmk")
                                                              (* ; "Edited  2-Jan-2024 19:15 by rmk")
@@ -369,13 +368,14 @@
          (SETQ PLINE (\TEDIT.CREATEPLINE TEXTOBJ PANE FIRSTLINE))
          (\TEDIT.ADD.CARET TEXTOBJ PANE AFTERPANE)
          (SETQ SEL (TEXTSEL TEXTOBJ))
-         (\SHOWSEL SEL NIL (AND AFTERPANE PANE))
-         (\FIXSEL SEL TEXTOBJ NIL (AND AFTERPANE PANE))
+         (\TEDIT.SHOWSEL SEL NIL (AND AFTERPANE PANE))
+         (\TEDIT.FIXSEL SEL TEXTOBJ NIL (AND AFTERPANE PANE))
          (FSETSEL SEL HASCARET (NOT (FGETTOBJ TEXTOBJ TXTREADONLY)))
-         (\SHOWSEL SEL T (AND AFTERPANE PANE])
+         (\TEDIT.SHOWSEL SEL T (AND AFTERPANE PANE])
 
 (\TEDIT.MINIMAL.WINDOW.SETUP
-  [LAMBDA (WINDOW TSTREAM PROPS AFTERPANE)                   (* ; "Edited 22-Feb-2024 23:14 by rmk")
+  [LAMBDA (WINDOW TSTREAM PROPS AFTERPANE)                   (* ; "Edited 20-Mar-2024 11:22 by rmk")
+                                                             (* ; "Edited 22-Feb-2024 23:14 by rmk")
                                                              (* ; "Edited 26-Jan-2024 13:14 by rmk")
                                                              (* ; "Edited 20-Jan-2024 23:24 by rmk")
                                                              (* ; "Edited  2-Jan-2024 17:27 by rmk")
@@ -395,7 +395,7 @@
     (* ;; "If AFTERPANE is non-NIL, the new pnae will be placed after AFTERPANE in the TEXTOBJ's pane list.  This maintains an ordering of panes, for splitting and unsplitting.")
 
     (\DTEST WINDOW 'WINDOW)
-    (LET ((TEXTOBJ (TEXTOBJ TSTREAM))
+    (LET ((TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TSTREAM))
           DS PROP OLDPANES)                                  (* ; 
                                                            "The displaystream for flashing the caret")
          (FSETTOBJ TEXTOBJ PANES (CONS (create PANE
@@ -406,8 +406,6 @@
                                                            "For the moment, this pane has no process")
          (replace (TEXTWINDOW WTEXTSTREAM) of WINDOW with TSTREAM)
                                                              (* ; "TSTREAM is accessible from WINDOW")
-         (replace (TEXTWINDOW WTEXTOBJ) of WINDOW with TEXTOBJ)
-                                                             (* ; "TEXTOBJ is accessible from WINDOW")
          (replace (TEXTWINDOW CURSORREGION) of WINDOW with (CREATEREGION 0 0 0 0))
                                                              (* ; "Used by CursorMovedFn")
          (SETQ DS (WINDOWPROP WINDOW 'DSP))
@@ -481,7 +479,8 @@
          WINDOW])
 
 (\TEDIT.ADD.CARET
-  [LAMBDA (TEXTOBJ PANE AFTERPANE)                           (* ; "Edited  2-Jan-2024 19:21 by rmk")
+  [LAMBDA (TEXTOBJ PANE AFTERPANE)                           (* ; "Edited 10-Mar-2024 15:01 by rmk")
+                                                             (* ; "Edited  2-Jan-2024 19:21 by rmk")
                                                              (* ; "Edited  9-Oct-2023 22:40 by rmk")
                                                              (* ; "Edited  4-Oct-2023 23:38 by rmk")
                                                              (* ; "Edited 30-Sep-2023 23:57 by rmk")
@@ -490,17 +489,16 @@
 
     (* ;; "The OR handles the case where the CARET list has not yet been set up for the first pane.")
 
-    (CL:UNLESS (AND AFTERPANE (for P inpanes (PROGN TEXTOBJ) as CTAIL on (FGETTOBJ TEXTOBJ CARET)
-                                 when (EQ P AFTERPANE)
-                                 do [PUSH (CDR CTAIL)
-                                          (create TEDITCARET
-                                                 TCFORCEUP _ T
-                                                 TCCARETDS _ (WINDOWPROP PANE 'DSP]
-                                    (RETURN T)))
-        [change (FGETTOBJ TEXTOBJ CARET)
-               (NCONC1 DATUM (create TEDITCARET
-                                    TCFORCEUP _ T
-                                    TCCARETDS _ (WINDOWPROP PANE 'DSP])])
+    (if AFTERPANE
+        then (for P inpanes (PROGN TEXTOBJ) as CTAIL on (FGETTOBJ TEXTOBJ CARET)
+                when (EQ P AFTERPANE) do [PUSH (CDR CTAIL)
+                                               (create TEDITCARET
+                                                      TCFORCEUP _ T
+                                                      TCCARETDS _ (WINDOWPROP PANE 'DSP]
+                                         (RETURN T))
+      else (FSETTOBJ TEXTOBJ CARET (CONS (create TEDITCARET
+                                                TCFORCEUP _ T
+                                                TCCARETDS _ (WINDOWPROP PANE 'DSP])
 
 (\TEDIT.CLEARPANE
   [LAMBDA (PANE PBOTTOM)                                     (* ; "Edited  2-Jan-2024 11:13 by rmk")
@@ -519,15 +517,15 @@
 (DEFINEQ
 
 (\TEDIT.CURSORMOVEDFN
-  [LAMBDA (PANE)                                             (* ; "Edited 26-Jan-2024 12:48 by rmk")
+  [LAMBDA (PANE)                                             (* ; "Edited 20-Mar-2024 11:00 by rmk")
+                                                             (* ; "Edited 26-Jan-2024 12:48 by rmk")
                                                              (* ; "Edited  1-Oct-2022 16:07 by rmk")
 
     (* ;; "Watch the mouse and change the cursor to reflect the region of the pane it's in (line select, pane split eventually?)")
 
     (PROG ((X (LASTMOUSEX PANE))
            (Y (LASTMOUSEY PANE))
-           (TEXTOBJ (\DTEST (fetch (TEXTWINDOW WTEXTOBJ) of PANE)
-                           'TEXTOBJ))
+           (TEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW WTEXTOBJ) of PANE)))
            (CURSORREG (fetch (TEXTWINDOW CURSORREGION) of PANE))
            LINE LEFT)
           (CL:UNLESS (INSIDE? (DSPCLIPPINGREGION NIL PANE)
@@ -595,22 +593,19 @@
            'TEXT])
 
 (\TEDIT.ACTIVE.WINDOWP
-  [LAMBDA (W)                                                (* ; "Edited 11-Sep-2023 00:22 by rmk")
+  [LAMBDA (W)                                                (* ; "Edited 20-Mar-2024 09:38 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 18:37 by rmk")
+                                                             (* ; "Edited 11-Sep-2023 00:22 by rmk")
                                                              (* ; "Edited 30-May-91 23:33 by jds")
 
     (* ;; "RMK:  Not sure that TEXTOBJ is ever T. Or that windows ever have a TEXTSTREAM property (vs TEXTOBJ).")
 
     (* ;; "Decides whether a TEdit window is really in use.  The function TEDIT will set the TEXTOBJ prop of the window to T pro tem, to reserve a window.  Once the TEdit has really started, the TEXTOBJ property will be a real textobj.")
 
-    (LET [(TEXTOBJ (OR (WINDOWPROP W 'TEXTOBJ)
-                       (AND (WINDOWPROP W 'TEXTSTREAM)
-                            (TEXTOBJ (WINDOWPROP W 'TEXTSTREAM]
-         (COND
-            ((EQ TEXTOBJ T)                                  (* ; 
-                                        "Can have a TEXTOBJ of T as a placeholder during creation...")
-             T)
-            (TEXTOBJ (AND (NOT (fetch (TEXTOBJ EDITFINISHEDFLG) of TEXTOBJ))
-                          (PROCESSP (WINDOWPROP W 'PROCESS])
+    (LET ((TEXTOBJ (fetch (TEXTWINDOW WTEXTOBJ) of W)))
+         (AND (type? TEXTOBJ TEXTOBJ)
+              (NOT (fetch (TEXTOBJ EDITFINISHEDFLG) of TEXTOBJ))
+              (PROCESSP (WINDOWPROP W 'PROCESS])
 
 (\TEDIT.EXPANDFN
   [LAMBDA (W)                                                (* jds " 7-May-85 15:56")
@@ -767,7 +762,8 @@
                                                  LEFT _ 0)))))])
 
 (\TEDIT.SHRINK.ICONCREATE
-  [LAMBDA (W ICON ICON-POSITION)                             (* ; "Edited 20-Dec-2023 23:44 by rmk")
+  [LAMBDA (W ICON ICON-POSITION)                             (* ; "Edited 15-Mar-2024 18:28 by rmk")
+                                                             (* ; "Edited 20-Dec-2023 23:44 by rmk")
                                                              (* ; "Edited 10-Apr-2023 09:44 by rmk")
                                                              (* ; "Edited 25-Apr-88 23:53 by jds")
 
@@ -777,7 +773,7 @@
            (ICONTITLE (WINDOWPROP W 'TEDIT.ICON.TITLE))
            (SHRINKFN (WINDOWPROP W 'SHRINKFN]
           (COND
-             ((NOT (WINDOWPROP W 'TEXTOBJ))                  (* ; 
+             ((NOT (fetch (TEXTWINDOW WTEXTOBJ) of W))       (* ; 
                                       "This isn't really a TEdit window any more.  Don't do anything")
               NIL)
              ((TEDITMENUP W)                                 (* ; 
@@ -858,7 +854,11 @@
 (DEFINEQ
 
 (\TEDIT.BUTTONEVENTFN
-  [LAMBDA (PANE)                                             (* ; "Edited 24-Feb-2024 15:29 by rmk")
+  [LAMBDA (PANE)                                             (* ; "Edited 27-Mar-2024 12:25 by rmk")
+                                                             (* ; "Edited 20-Mar-2024 11:01 by rmk")
+                                                             (* ; "Edited 16-Mar-2024 00:22 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:59 by rmk")
+                                                             (* ; "Edited 24-Feb-2024 15:29 by rmk")
                                                              (* ; "Edited 22-Feb-2024 14:57 by rmk")
                                                              (* ; "Edited 19-Feb-2024 14:50 by rmk")
                                                              (* ; "Edited 17-Feb-2024 15:40 by rmk")
@@ -886,12 +886,12 @@
                    SOURCESEL SELOPERATION SELFN)
                   (CL:UNLESS TEXTOBJ                         (* ; "Not a Tedit window")
                       (RETURN))
-                  (\DTEST TEXTOBJ 'TEXTOBJ)
+                  (TEXTOBJ! TEXTOBJ)
 
              (* ;; "Pick off and return from a bunch of peripheral situations, then fall through to the complexities of normal text selection.")
 
                   (CL:WHEN (OR (\TEDIT.BUTTONEVENTFN.INTITLE Y PANE TEXTOBJ)
-                               (\TEDIT.BUTTONEVENTFN.INACTIVE TEXTOBJ)
+                               (\TEDIT.BUTTONEVENTFN.INACTIVE TEXTOBJ PANE)
                                (\TEDIT.PANE.SPLIT TEXTOBJ PANE))
                          (RETURN))
 
@@ -921,15 +921,17 @@
                                                              (* ; "Get the storage and looks")
                                              (SETQ OSEL (FGETTOBJ TEXTOBJ SCRATCHSEL2))
                                              (AND T (SETQ OSEL (create SELECTION
-                                                                      SELTEXTOBJ _ TEXTOBJ)))
+                                                                      SELTEXTOBJ _ TEXTOBJ))) 
+                                                             (* ; 
+                                                             "TAKE THIS OUT WHEN SELTEXTOBJ GOES")
                                              (\TEDIT.SET.SEL.LOOKS OSEL SELOPERATION)
                                              (SELECTQ SELOPERATION
                                                  ((NORMAL DELETE) 
-                                                      (\COPYSEL (FGETTOBJ TEXTOBJ SEL)
+                                                      (\TEDIT.COPYSEL (FGETTOBJ TEXTOBJ SEL)
                                                              SOURCESEL)
-                                                      (\SHOWSEL (FGETTOBJ TEXTOBJ SEL)
+                                                      (\TEDIT.SHOWSEL (FGETTOBJ TEXTOBJ SEL)
                                                              NIL)
-                                                      (\COPYSEL (FGETTOBJ TEXTOBJ SEL)
+                                                      (\TEDIT.COPYSEL (FGETTOBJ TEXTOBJ SEL)
                                                              OSEL))
                                                  (\TEDIT.SET.SEL.LOOKS SOURCESEL SELOPERATION))
                                              (FSETSEL OSEL CH# 0)
@@ -979,8 +981,8 @@
 
                                  (* ;; "Things changed since the last selection.  Grab the prior selection info, so that the extension is taken from the selection NOW being made, rather than the last existing old-type selection.")
 
-                                              (CL:WHEN OSEL (\COPYSEL OSEL SOURCESEL)))
-                                          (SETQ SOURCESEL (\COPYSEL SOURCESEL))
+                                              (CL:WHEN OSEL (\TEDIT.COPYSEL OSEL SOURCESEL)))
+                                          (SETQ SOURCESEL (\TEDIT.COPYSEL SOURCESEL))
                                           (CL:WHEN (AND TEDIT.EXTEND.PENDING.DELETE
                                                         (EQ SELOPERATION 'NORMAL))
 
@@ -989,9 +991,9 @@
 
                                               (SETQ SELOPERATION 'PENDINGDEL)
                                               (\TEDIT.SET.SEL.LOOKS SOURCESEL 'DELETE))
-                                          (SETQ SOURCESEL (\COPYSEL (\TEDIT.EXTEND.SEL X Y SOURCESEL
-                                                                           TEXTOBJ SELOPERATION PANE)
-                                                                 ))
+                                          (SETQ SOURCESEL (\TEDIT.COPYSEL (\TEDIT.EXTEND.SEL X Y 
+                                                                                 SOURCESEL TEXTOBJ 
+                                                                                 SELOPERATION PANE)))
                                           (SETQ EXTENDFLG T))
                                  (CL:WHEN [AND SELFN SOURCESEL (FGETSEL SOURCESEL SET)
                                                (EQ 'DON'T (APPLY* SELFN TEXTOBJ SOURCESEL 
@@ -1000,7 +1002,7 @@
                                      (* ;; 
               "The selfn vetoed this selection, so mark it un-set and break out of the polling loop.")
 
-                                     (\SHOWSEL SOURCESEL NIL)
+                                     (\TEDIT.SHOWSEL SOURCESEL NIL)
                                      (FSETSEL SOURCESEL SET NIL)
                                      (RETURN))
                                  (CL:WHEN OSEL
@@ -1022,10 +1024,10 @@
 
                                  (* ;; "There is an old selection around, but it is VOLATILE -- i.e., it shouldn't last longer than something is pointing at it.  Turn it off.")
 
-                                              (\SHOWSEL OSEL NIL)
+                                              (\TEDIT.SHOWSEL OSEL NIL)
                                               (FSETSEL OSEL SET NIL)))
                                  (CL:WHEN SOURCESEL          (* ; "Maybe clicked in the boonies?")
-                                     (SETQ OSEL (\COPYSEL SOURCESEL OSEL)))
+                                     (SETQ OSEL (\TEDIT.COPYSEL SOURCESEL OSEL)))
                           elseif (IN/SCROLL/BAR? PANE LASTMOUSEX LASTMOUSEY)
                             then                             (* ; "Mouse moved to scroll bar")
                                  (SCROLL.HANDLER PANE))
@@ -1044,10 +1046,10 @@
                   (CL:UNLESS (INSIDEP (DSPCLIPPINGREGION NIL PANE)
                                     X Y)                     (* ; 
                                                         "Didn't end inside the window, abort cleanly")
-                      (\SHOWSEL SOURCESEL NIL)
-                      (\SHOWSEL (FGETTOBJ TEXTOBJ SEL)
+                      (\TEDIT.SHOWSEL SOURCESEL NIL)
+                      (\TEDIT.SHOWSEL (FGETTOBJ TEXTOBJ SEL)
                              NIL)
-                      (\SHOWSEL (FGETTOBJ TEXTOBJ SEL)
+                      (\TEDIT.SHOWSEL (FGETTOBJ TEXTOBJ SEL)
                              T)
                       (RETURN))
                   (CL:UNLESS (FGETTOBJ TEXTOBJ MENUFLG)      (* ; 
@@ -1057,7 +1059,7 @@
 
                       (* ;; "If this is a normal selection, then the display now corresponds to SOURCESEL and is now correctly displayed. Otherwise, the selection in this TEXTOBJ is only a transient for this operation, turn it off here. ")
 
-                      (\SHOWSEL SOURCESEL NIL))
+                      (\TEDIT.SHOWSEL SOURCESEL NIL))
 
              (* ;; "Execute the SELOPERATION in the TTY process (maybe here)")
 
@@ -1068,7 +1070,7 @@
                       (APPLY* (IMAGEOBJPROP (FGETSEL SOURCESEL SELOBJ)
                                      'WHENOPERATEDONFN)
                              (FGETSEL SOURCESEL SELOBJ)
-                             DS
+                             PANE
                              'SELECTED SOURCESEL (FGETTOBJ TEXTOBJ STREAMHINT)))
                   (CL:WHEN SELFN                             (* ; "Maybe for logging of selections?")
                       (APPLY* SELFN TEXTOBJ SOURCESEL SELOPERATION 'FINAL))]))])
@@ -1148,7 +1150,8 @@
        (T 'NORMAL])
 
 (\TEDIT.BUTTONEVENTFN.INACTIVE
-  [LAMBDA (TEXTOBJ)                                          (* ; "Edited  9-Feb-2024 00:00 by rmk")
+  [LAMBDA (TEXTOBJ PANE)                                     (* ; "Edited 16-Mar-2024 00:22 by rmk")
+                                                             (* ; "Edited  9-Feb-2024 00:00 by rmk")
                                                              (* ; "Edited 27-Jan-2024 11:40 by rmk")
 
     (* ;; "TEXTOBJ is the textobj associated with some window and presumably therefore has (or had) an associated editing process.  This returns T if the session is currently inactive or if this TEXTOBJ or TEXTOBJ cannot still be used as a source of information.  If inactive, this also either executes the generic window operations (if RIGHT is down, whether or not in the title region) or perhaps reestablishes the process.")
@@ -1172,15 +1175,14 @@
 
              (DOWINDOWCOM PANE)
              T
-      elseif (AND (\TEDIT.MOUSESTATE MIDDLE)
-                  (NOT (GETTEXTPROP TEXTOBJ 'READONLY))
+      elseif [AND (NOT (GETTEXTPROP TEXTOBJ 'READONLY))
                   (NOT (GETTEXTPROP TEXTOBJ 'SELECTONLY))
                   [NOT (PROCESSP (WINDOWPROP PANE 'PROCESS]
-                  (EQ (MENU TEDIT.RESTART.MENU)
-                      'NewEditProcess))
+                  (OR T (AND (\TEDIT.MOUSESTATE MIDDLE)
+                             (EQ 'NewEditProcess (MENU (CREATE MENU
+                                                              ITEMS _ '(NewEditProcess]
         then 
-             (* ;; 
-    "Middle button in a dead window gives a menu for re-starting TEDIT. Window is no longer inactive")
+             (* ;; "Why do we need a Middle-button menu to restart a dead window.  If it's clicked in, just restart it.")
 
              (SETTOBJ TEXTOBJ EDITOPACTIVE NIL)
              (TEDIT (GETTOBJ TEXTOBJ STREAMHINT)
@@ -1302,7 +1304,9 @@
         T)])
 
 (\TEDIT.SPLITW
-  [LAMBDA (OLDPANE Y)                                        (* ; "Edited  8-Feb-2024 23:38 by rmk")
+  [LAMBDA (OLDPANE Y)                                        (* ; "Edited 20-Mar-2024 11:01 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 22:00 by rmk")
+                                                             (* ; "Edited  8-Feb-2024 23:38 by rmk")
                                                              (* ; "Edited  2-Jan-2024 19:21 by rmk")
                                                              (* ; "Edited  4-Oct-2023 10:37 by rmk")
                                                              (* ; "Edited  1-Oct-2023 11:58 by rmk")
@@ -1315,8 +1319,7 @@
     (* ;; "Original code was goofy: after carefully setting things up, attached menus and prompts would move into the main-window space.  Setting and reseting the ATTACHEDWINDOWS property seems to fix that.")
 
     (LET ((WREG (WINDOWPROP OLDPANE 'REGION))
-          (TEXTOBJ (\DTEST (WINDOWPROP OLDPANE 'TEXTOBJ)
-                          'TEXTOBJ))
+          (TEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW WTEXTOBJ) of OLDPANE)))
           (NEXTPANE (fetch (TEXTWINDOW NEXTPANE) of OLDPANE))
           ATTACHEDWINDOWS NEWPANE PROPS NEWFIRSTLINE SEL)
          (CL:UNLESS Y
@@ -1373,18 +1376,18 @@
 
          [SETQ NEWFIRSTLINE (for L inlines (fetch (TEXTWINDOW PLINES) of OLDPANE)
                                unless (FGETLD L NEXTLINE)
-                               do (RETURN (\FORMATLINE TEXTOBJ (ADD1 (FGETLD L LCHARLIM]
+                               do (RETURN (\TEDIT.FORMATLINE TEXTOBJ (ADD1 (FGETLD L LCHARLIM]
          (\TEDIT.WINDOW.SETUP NEWPANE (FGETTOBJ TEXTOBJ STREAMHINT)
                 PROPS OLDPANE NEWFIRSTLINE)
          (CL:WHEN NEWFIRSTLINE
-             (\FILLPANE (GETLD NEWFIRSTLINE PREVLINE)
+             (\TEDIT.FILLPANE (GETLD NEWFIRSTLINE PREVLINE)
                     TEXTOBJ NEWPANE))
          (SETQ SEL (FGETTOBJ TEXTOBJ SEL))
-         (\FIXSEL SEL TEXTOBJ NIL NEWPANE)
+         (\TEDIT.FIXSEL SEL TEXTOBJ NIL NEWPANE)
          (CL:WHEN (GETSEL SEL ONFLG)
              (SETSEL SEL ONFLG NIL)                          (* ; 
                                                       "Turn it off, so we can turn it on for NEWPANE")
-             (\SHOWSEL SEL T NEWPANE))
+             (\TEDIT.SHOWSEL SEL T NEWPANE))
          (WINDOWPROP NEWPANE 'PROCESS (WINDOWPROP OLDPANE 'PROCESS))
          (replace (TEXTWINDOW NEXTPANE) of OLDPANE with NEWPANE)
                                                              (* ; 
@@ -1397,7 +1400,9 @@
              (replace (TEXTWINDOW NEXTPANE) of NEWPANE with NEXTPANE))])
 
 (\TEDIT.UNSPLITW
-  [LAMBDA (PANE)                                             (* ; "Edited 21-Feb-2024 08:31 by rmk")
+  [LAMBDA (PANE)                                             (* ; "Edited 20-Mar-2024 11:01 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 18:30 by rmk")
+                                                             (* ; "Edited 21-Feb-2024 08:31 by rmk")
                                                              (* ; "Edited 11-Feb-2024 11:14 by rmk")
                                                              (* ; "Edited  2-Jan-2024 21:11 by rmk")
                                                              (* ; "Edited 30-Sep-2023 14:17 by rmk")
@@ -1405,8 +1410,7 @@
                                                              (* ; "Edited  2-Sep-2023 16:18 by rmk")
                                                              (* ; "Edited 18-Apr-2023 23:41 by rmk")
                                                              (* ; "Edited  6-Nov-2022 00:06 by rmk")
-    (PROG* ((TEXTOBJ (\DTEST (WINDOWPROP PANE 'TEXTOBJ)
-                            'TEXTOBJ))
+    (PROG* ((TEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW WTEXTOBJ) of PANE)))
             (PANES (GETTOBJ TEXTOBJ \WINDOW))
             (PRIMARYPANE (\TEDIT.MAINW PANE))
             (SEL (FGETTOBJ TEXTOBJ SEL))
@@ -1417,7 +1421,7 @@
            [SETQ PRIORPANE (find P in PANES suchthat (EQ PANE (fetch (TEXTWINDOW NEXTPANE)
                                                                  of P]
            (SETQ NEXTPANE (fetch (TEXTWINDOW NEXTPANE) of PANE))
-           (\SHOWSEL SEL NIL)                                (* ; 
+           (\TEDIT.SHOWSEL SEL NIL)                          (* ; 
                                                             "Turn off selections during the unsplit.")
            (FSETTOBJ TEXTOBJ SELPANE PRIMARYPANE)
            (for P in PANES as CARET in (GETTOBJ TEXTOBJ CARET) as SL1 in (GETSEL SEL L1) as SLN
@@ -1429,12 +1433,11 @@
                                                             (DREMOVE SLN DATUM))
                                                      (RETURN))
            (WINDOWPROP PANE 'CURSOROUTFN NIL)
-           (WINDOWPROP PANE 'CURSORMOVEDFN NIL)
-           (replace (TEXTWINDOW WTEXTOBJ) of PANE with NIL)  (* ; "Disconnect")
+           (WINDOWPROP PANE 'CURSORMOVEDFN NIL)              (* ; "Disconnect")
            (replace (TEXTWINDOW WTEXTSTREAM) of PANE with NIL)
            (SETTOBJ TEXTOBJ \WINDOW (DREMOVE PANE PANES))
            (replace (TEXTWINDOW NEXTPANE) of PANE with NIL)
-           (\FIXSEL (TEXTSEL TEXTOBJ)
+           (\TEDIT.FIXSEL (TEXTSEL TEXTOBJ)
                   TEXTOBJ)
            (replace (TEXTWINDOW NEXTPANE) of PRIORPANE with NEXTPANE)
 
@@ -1460,7 +1463,7 @@
                (DETACHWINDOW NEXTPANE)
                (ATTACHWINDOW NEXTPANE PRIORPANE 'BOTTOM 'JUSTIFY 'MAIN))
            (CLOSEW PANE)
-           (\SHOWSEL SEL T])
+           (\TEDIT.SHOWSEL SEL T])
 )
 
 (MOVD? 'NILL 'GRAB-TYPED-REGION)
@@ -1586,15 +1589,13 @@
 (DEFINEQ
 
 (TEDIT.PROMPTWINDOW
-  [LAMBDA (TEDIT.THING)
+  [LAMBDA (TSTREAM)                                          (* ; "Edited 18-Mar-2024 17:48 by rmk")
 
     (* ;; 
  " Return the TEdit promptwindow, if any, from a TEdit thing (textstream, textobj, or TEdit window).")
 
-    (LET ((TEXTOBJ (TEXTOBJ TEDIT.THING)))
-         (if TEXTOBJ
-             then (fetch (TEXTOBJ PROMPTWINDOW) of TEXTOBJ)
-           else NIL])
+    (FGETTOBJ (TEXTOBJ TSTREAM)
+           PROMPTWINDOW])
 
 (TEDIT.PROMPTPRINT
   [LAMBDA (TEXTSTREAM MSG CLEAR? FLASH?)                     (* ; "Edited 26-Nov-2023 10:10 by rmk")
@@ -1662,31 +1663,29 @@
                          (CLEARW PW))))])
 
 (TEDIT.PROMPTFLASH
-  [LAMBDA (TEXTSTREAM)                                       (* ; "Edited 30-May-91 23:34 by jds")
-                                                             (* Flash the TEdit prompt window, or 
-                                                             the global promptwindow, if TEdit has 
-                                                             none.)
+  [LAMBDA (TEXTSTREAM)                                       (* ; "Edited 15-Mar-2024 18:32 by rmk")
+                                                             (* ; "Edited 30-May-91 23:34 by jds")
+                                                             (* ; 
+                      "Flash the TEdit prompt window, or the global promptwindow, if TEdit has none.")
     (PROG (WINDOW PWINDOW (TEXTOBJ (TEXTOBJ TEXTSTREAM))
                  MAINTEXTOBJ)
           (COND
              [(AND TEXTOBJ (fetch (TEXTOBJ MENUFLG) of TEXTOBJ))
-
-         (* There is a known textobj, and it's a menu.
-         Go use the main editor's promptwindow.)
-
-              (SETQ MAINTEXTOBJ (WINDOWPROP (\TEDIT.MAINW TEXTOBJ)
-                                       'TEXTOBJ))            (* Find the TEXTOBJ for the main edit 
-                                                             window, and use ITS prompting window.)
+                                                             (* ; 
+                 "There is a known textobj, and it's a menu.  Go use the main editor's promptwindow.")
+              (SETQ MAINTEXTOBJ (fetch (TEXTWINDOW WTEXTOBJ) of (\TEDIT.MAINW TEXTOBJ)))
+                                                             (* ; 
+                           "Find the TEXTOBJ for the main edit window, and use ITS prompting window.")
               (SETQ WINDOW (AND MAINTEXTOBJ (fetch (TEXTOBJ PROMPTWINDOW) of MAINTEXTOBJ]
              ((AND TEXTOBJ (SETQ WINDOW (fetch (TEXTOBJ PROMPTWINDOW) of TEXTOBJ)))
-                                                             (* There IS an editor window to get 
-                                                             to; use its prompt window)
+                                                             (* ; 
+                                        "There IS an editor window to get to;  use its prompt window")
               )
              ((SETQ WINDOW (GETPROMPTWINDOW (\TEDIT.MAINW TEXTSTREAM)
-                                  NIL NIL T))                (* Failing that, try any prompt window 
-                                                             attached to the edit window.)
-              ))                                             (* Try to find an editor's prompt 
-                                                             window for our message)
+                                  NIL NIL T))                (* ; 
+                                   "Failing that, try any prompt window attached to the edit window.")
+              ))                                             (* ; 
+                                              "Try to find an editor's prompt window for our message")
           (FLASHWINDOW (OR WINDOW PROMPTWINDOW)
                  2])
 
@@ -1865,7 +1864,9 @@
 (DEFINEQ
 
 (TEDIT.DEACTIVATE.WINDOW
-  [LAMBDA (W)                                                (* ; "Edited 17-Oct-2023 08:54 by rmk")
+  [LAMBDA (W)                                                (* ; "Edited 20-Mar-2024 11:02 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:34 by rmk")
+                                                             (* ; "Edited 17-Oct-2023 08:54 by rmk")
                                                              (* ; "Edited 10-Oct-2023 10:23 by rmk")
                                                              (* ; "Edited 30-Sep-2023 13:42 by rmk")
                                                              (* ; "Edited 22-Sep-2023 00:07 by rmk")
@@ -1879,7 +1880,7 @@
           (CL:UNLESS TEXTOBJ                                 (* ; 
                                            "Return NIL if not an editing window (rather than error?)")
               (RETURN))
-          (\DTEST TEXTOBJ 'TEXTOBJ)
+          (TEXTOBJ! TEXTOBJ)
 
      (* ;; "Return DON'T If we don't close the window.  if previously quit, the window is closed already, and would be reopened to reclose it.")
 
@@ -1896,7 +1897,7 @@
           (CL:WHEN (AND (GETTOBJ TEXTOBJ PROMPTWINDOW)
                         (OPENWP (GETTOBJ TEXTOBJ PROMPTWINDOW)))
               (CLEARW (GETTOBJ TEXTOBJ PROMPTWINDOW)))
-          (\SHOWSEL (TEXTSEL TEXTOBJ)
+          (\TEDIT.SHOWSEL (TEXTSEL TEXTOBJ)
                  NIL)                                        (* ; 
         "Before the window is closed, make SURE that the caret is down, or the window will reappear.")
           (CL:WHEN (AND (\TEDIT.WINDOW.TITLE TEXTOBJ)
@@ -1947,12 +1948,13 @@
                                                              (* ; "It's a list;  remove this pane")
                                        (DREMOVE W (GETTOBJ TEXTOBJ \WINDOW)))]
           (WINDOWPROP W 'CURSOROUTFN NIL)
-          (WINDOWPROP W 'CURSORMOVEDFN NIL)
-          (replace (TEXTWINDOW WTEXTOBJ) of W with NIL)      (* ; "Disconnect")
+          (WINDOWPROP W 'CURSORMOVEDFN NIL)                  (* ; "Disconnect")
           (replace (TEXTWINDOW WTEXTSTREAM) of W with NIL])
 
 (\TEDIT.REPAINTFN
-  [LAMBDA (PANE)                                             (* ; "Edited 13-Dec-2023 23:27 by rmk")
+  [LAMBDA (PANE)                                             (* ; "Edited 20-Mar-2024 06:43 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited 13-Dec-2023 23:27 by rmk")
                                                              (* ; "Edited 30-Nov-2023 10:02 by rmk")
                                                              (* ; "Edited 11-May-2023 11:35 by rmk")
                                                              (* ; "Edited 30-May-91 23:34 by jds")
@@ -1970,13 +1972,13 @@
  "The window is clear before this is called, so no highlighting to worry about.  Tell the selection.")
 
              (FSETSEL SEL ONFLG NIL)
-             (for P PLINES inpanes (PROGN TEXTOBJ) do (\TEDIT.FORMATLINES (fetch (TEXTWINDOW PLINES)
+             (for P PLINES inpanes (PROGN TEXTOBJ) do (\TEDIT.LINES.BELOW (fetch (TEXTWINDOW PLINES)
                                                                              of P)
                                                              NIL P TEXTOBJ))
              (CL:WHEN WASON
-                 (\FIXSEL SEL TEXTOBJ)                       (* ; 
+                 (\TEDIT.FIXSEL SEL TEXTOBJ)                 (* ; 
                                                              "Account for new lines and highlighting")
-                 (\SHOWSEL SEL T)))])
+                 (\TEDIT.SHOWSEL SEL T)))])
 
 (\TEDIT.AFTERMOVEFN
   [LAMBDA (PANE)                                             (* ; "Edited 20-Jan-2024 23:22 by rmk")
@@ -1990,29 +1992,40 @@
     (WINDOWPROP PANE 'OFFSCREEN (OFFSCREENP PANE])
 
 (OFFSCREENP
-  [LAMBDA (WINDOW)                                           (* ; "Edited 20-Jan-2024 23:23 by rmk")
+  [LAMBDA (WINDOW)                                           (* ; "Edited 19-Mar-2024 23:30 by rmk")
+                                                             (* ; "Edited 20-Jan-2024 23:23 by rmk")
                                                              (* ; "Edited 21-Dec-2023 17:17 by rmk")
                                                              (* ; "Edited 17-Dec-2023 17:27 by rmk")
+
+    (* ;; "Returns a list indicating which boundaries of the window is offscreen.  Also includes VERTICAL or HORIZONTAL, if one of those respective dimensions is off.")
+
     (LET ((REGION (WINDOWREGION WINDOW))
           (SCREEN (fetch (WINDOW SCREEN) of WINDOW))
-          HORIZONTAL VERTICAL)
-         [SETQ HORIZONTAL (OR (ILESSP (fetch LEFT of REGION)
-                                     0)
-                              (IGREATERP (fetch RIGHT of REGION)
-                                     (fetch (SCREEN SCWIDTH) of SCREEN]
-         [SETQ VERTICAL (OR (ILESSP (fetch BOTTOM of REGION)
-                                   0)
-                            (IGREATERP (fetch TOP of REGION)
-                                   (fetch (SCREEN SCHEIGHT) of SCREEN]
-         (if VERTICAL
-             then (CL:IF HORIZONTAL
-                      '(HORIZONTAL VERTICAL)
-                      'VERTICAL)
-           elseif HORIZONTAL
-             then 'HORIZONTAL])
+          RESULT)
+         (CL:WHEN (ILESSP (fetch LEFT of REGION)
+                         0)
+             (PUSH RESULT 'LEFT))
+         (CL:WHEN (IGREATERP (fetch RIGHT of REGION)
+                         (fetch (SCREEN SCWIDTH) of SCREEN))
+             (PUSH RESULT 'RIGHT))
+         (CL:WHEN (OR (MEMB 'LEFT RESULT)
+                      (MEMB 'RIGHT RESULT))
+             (PUSH RESULT 'HORIZONTAL))
+         (CL:WHEN (IGREATERP (fetch TOP of REGION)
+                         (fetch (SCREEN SCHEIGHT) of SCREEN))
+             (PUSH RESULT 'TOP))
+         (CL:WHEN (ILESSP (fetch BOTTOM of REGION)
+                         0)
+             (PUSH RESULT 'BOTTOM))
+         (CL:WHEN (OR (MEMB 'TOP RESULT)
+                      (MEMB 'BOTTOM RESULT))
+             (PUSH RESULT 'VERTICAL))
+         RESULT])
 
 (\TEDIT.RESHAPEFN
-  [LAMBDA (PANE BITS OLDREGION)                              (* ; "Edited 20-Jan-2024 23:02 by rmk")
+  [LAMBDA (PANE BITS OLDREGION)                              (* ; "Edited 20-Mar-2024 06:46 by rmk")
+                                                             (* ; "Edited 16-Mar-2024 00:02 by rmk")
+                                                             (* ; "Edited 20-Jan-2024 23:02 by rmk")
                                                              (* ; "Edited  2-Jan-2024 12:43 by rmk")
                                                              (* ; "Edited 14-Dec-2023 11:32 by rmk")
                                                              (* ; "Edited 20-Nov-2023 11:04 by rmk")
@@ -2024,15 +2037,19 @@
 
     (* ;; "Will eventually do the right thing w/r/t text margins.  For now, it's a place holder.")
 
-    (PROG ((TEXTOBJ (WINDOWPROP PANE 'TEXTOBJ))
+    (* ;; "This is called after the window has been reshaped, we have to redisplay")
+
+    (PROG ((TEXTOBJ (fetch (TEXTWINDOW WTEXTOBJ) of PANE))
            (PREG (DSPCLIPPINGREGION NIL PANE))
            NEWPHEIGHT PLINES LINE)
           (CL:UNLESS TEXTOBJ                                 (* ; "Not a Tedit window")
               (RETURN))
           (CL:UNLESS (SETQ PLINES (fetch (TEXTWINDOW PLINES) of PANE))
-                                                             (* ; "No lines: should never happen")
+
+              (* ;; "Should always be a dummy line, but...")
+
               (RETURN))
-          (\SHOWSEL (FGETTOBJ TEXTOBJ SEL)
+          (\TEDIT.SHOWSEL (FGETTOBJ TEXTOBJ SEL)
                  NIL)                                        (* ; 
                                                        "Turn off the selection while we make changes")
           (SETQ NEWPHEIGHT (fetch HEIGHT of PREG))
@@ -2051,18 +2068,20 @@
           (SETLD PLINES YBOT NEWPHEIGHT)
           (CL:WHEN LINE                                      (* ; 
                                                              "If nothing visible then, nothing now")
-              [SETQ LINE (CADR (\FORMATBLOCK TEXTOBJ (FGETLD LINE LCHAR1]
+              (CL:WHEN (IGREATERP (FGETTOBJ TEXTOBJ TEXTLEN)
+                              0)
+                  [SETQ LINE (CADR (\TEDIT.LINES.ABOVE TEXTOBJ (FGETLD LINE LCHAR1])
               (CL:UNLESS (EQ LINE PLINES)                    (* ; 
                                                            "Forget the old chain of line descriptors")
                   (LINKLD PLINES LINE))                      (* ; 
                                                       "Fix the line to appear at the top of the pane")
               (SETYPOS LINE (IDIFFERENCE NEWPHEIGHT (FGETLD LINE LHEIGHT)))
-              (\DISPLAYLINE TEXTOBJ LINE PANE)               (* ; "Actually display it")
-              (\FILLPANE LINE TEXTOBJ PANE))
-          (\FIXSEL (FGETTOBJ TEXTOBJ SEL)
+              (\TEDIT.DISPLAYLINE TEXTOBJ LINE PANE)         (* ; "Actually display it")
+              (\TEDIT.FILLPANE LINE TEXTOBJ PANE))
+          (\TEDIT.FIXSEL (FGETTOBJ TEXTOBJ SEL)
                  TEXTOBJ)                                    (* ; 
                                              "Fix up the selection to account for the line shuffling")
-          (\SHOWSEL (FGETTOBJ TEXTOBJ SEL)
+          (\TEDIT.SHOWSEL (FGETTOBJ TEXTOBJ SEL)
                  T])
 
 (\TEDIT.PANEWITHINSCREEN?
@@ -2093,6 +2112,10 @@
 (\TEDIT.SCROLLFN
   [LAMBDA (PANE DX DY)
 
+    (* ;; "Edited 20-Mar-2024 11:02 by rmk")
+
+    (* ;; "Edited 10-Mar-2024 22:23 by rmk")
+
     (* ;; "Edited 22-Oct-2023 08:31 by rmk")
 
     (* ;; "Edited 11-May-2023 12:03 by rmk")
@@ -2101,8 +2124,7 @@
    "Edited 18-Feb-2022 14:53 by rmk: Repaint after scrolling for panes that are partially off-screen")
 
     (TOTOPW PANE)
-    (PROG [(TEXTOBJ (\DTEST (fetch (TEXTWINDOW PTEXTOBJ) of PANE)
-                           'TEXTOBJ]
+    (PROG [(TEXTOBJ (TEXTOBJ! (fetch (TEXTWINDOW PTEXTOBJ) of PANE]
           (if (ZEROP (FGETTOBJ TEXTOBJ TEXTLEN))
               then 
                    (* ;; "Don't scroll a zero-length file")
@@ -2114,6 +2136,9 @@
 
                    (TEDIT.PROMPTPRINT TEXTOBJ "Edit operation in progress." T)
                    (RETURN))
+          (CL:UNLESS (\GETSTREAM (FGETTOBJ TEXTOBJ STREAMHINT)
+                            'INPUT T)
+                 (\TEDIT.REOPENTEXTSTREAM TEXTOBJ))
           (CL:WHEN (GETTEXTPROP TEXTOBJ 'PRESCROLLFN)
               (DOUSERFNS (GETTEXTPROP TEXTOBJ 'PRESCROLLFN)
                      PANE))                                  (* ; 
@@ -2131,7 +2156,9 @@
     NIL])
 
 (\TEDIT.SCROLLFLOAT
-  [LAMBDA (TEXTOBJ PANE DY)                                  (* ; "Edited 22-Jan-2024 10:43 by rmk")
+  [LAMBDA (TEXTOBJ PANE DY)                                  (* ; "Edited 20-Mar-2024 06:46 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 22:00 by rmk")
+                                                             (* ; "Edited 22-Jan-2024 10:43 by rmk")
                                                              (* ; "Edited 20-Jan-2024 23:13 by rmk")
                                                              (* ; "Edited  2-Jan-2024 11:02 by rmk")
                                                              (* ; "Edited 13-Dec-2023 23:24 by rmk")
@@ -2186,7 +2213,7 @@
             (T 
                (* ;; "There is no current line to be moved to the top of the pane. The line containing CH# becomes the new topline of the pane")
 
-               [SETQ NEWTOP (CADR (\FORMATBLOCK TEXTOBJ CH# (fetch BOTTOM of PREG]
+               [SETQ NEWTOP (CADR (\TEDIT.LINES.ABOVE TEXTOBJ CH# (fetch BOTTOM of PREG]
                (SETYPOS NEWTOP (IDIFFERENCE PHEIGHT (GETLD NEWTOP LHEIGHT)))
                (LINKLD (fetch (TEXTWINDOW PLINES) of PANE)
                       NEWTOP)                                (* ; 
@@ -2196,18 +2223,20 @@
                (* ;; 
              "Maybe replace the rest of this with \TEDIT.REPAINTFN ?  \FILLPANE adds the dummy lines")
 
-               (\FILLPANE (fetch (TEXTWINDOW PLINES) of PANE)
+               (\TEDIT.FILLPANE (fetch (TEXTWINDOW PLINES) of PANE)
                       TEXTOBJ PANE)
-               (\FIXSEL SEL TEXTOBJ NIL PANE)
+               (\TEDIT.FIXSEL SEL TEXTOBJ NIL PANE)
                (CL:WHEN (FGETSEL SEL ONFLG)
 
                    (* ;; "Tell the selection that none of its hilighting is current onscreen (BLTSHADE above), then restore it. ")
 
                    (FSETSEL SEL ONFLG NIL)
-                   (\SHOWSEL SEL T PANE))])
+                   (\TEDIT.SHOWSEL SEL T PANE))])
 
 (\TEDIT.SCROLLUP
-  [LAMBDA (TEXTOBJ PANE DY)                                  (* ; "Edited 14-Dec-2023 00:00 by rmk")
+  [LAMBDA (TEXTOBJ PANE DY)                                  (* ; "Edited 20-Mar-2024 06:43 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 19:23 by rmk")
+                                                             (* ; "Edited 14-Dec-2023 00:00 by rmk")
                                                              (* ; "Edited  4-Dec-2023 20:49 by rmk")
                                                              (* ; "Edited 30-Nov-2023 00:07 by rmk")
                                                              (* ; "Edited 28-Nov-2023 22:55 by rmk")
@@ -2255,7 +2284,8 @@
 
                                  (* ;; "If the old truetop would still be visible after raising DY, then move it up by DY.  This effectively discounts the white space of paragraph leading.  Maybe we also want to discount the white space of line-leading below, by using LTRUEHEIGHT instead of LHEIGHT to determine the new bottom line")
 
-                                        (SETQ NEXT (\FORMATLINE TEXTOBJ (FGETLD OLDTOPLINE LCHAR1)))
+                                        (SETQ NEXT (\TEDIT.FORMATLINE TEXTOBJ (FGETLD OLDTOPLINE 
+                                                                                     LCHAR1)))
                                         (LINKLD NEXT (FGETLD OLDTOPLINE NEXTLINE))
                                         (SETYPOS NEXT (IPLUS DY (FGETLD OLDTOPLINE YBOT)))
                                         (RETURN NEXT))
@@ -2268,7 +2298,7 @@
 
                                  (* ;; "Continue by formatting a new, undisplayed line.  This can happen if DY (say from an explicit SCROLLW call) picks a line that is somewhere below the pane.  The newline is linked in as L's NEXTLINE, but its NEXTLINE is NIL, so we keep running through here. The new line is positioned properly with respect to the current OLDTOPLINE (so are all lines we have crossed over or formatted, but those will be thrown away.)")
 
-                                     [SETQ NEXT (\FORMATLINE TEXTOBJ (ADD1 (FGETLD L LCHARLIM]
+                                     [SETQ NEXT (\TEDIT.FORMATLINE TEXTOBJ (ADD1 (FGETLD L LCHARLIM]
                                      (LINKLD L NEXT)         (* ; 
                                                              "So we find NEXT on the next iteration")
                                      (\TEDIT.LINE.BOTTOM NEXT))]
@@ -2296,7 +2326,7 @@
                            PBOTTOM)                          (* ; 
                                       "Not visible, SUB1 to display not quite at the top, then raise")
               (\TEDIT.LINE.BOTTOM NEWTOPLINE)
-              (\DISPLAYLINE TEXTOBJ NEWTOPLINE PANE))
+              (\TEDIT.DISPLAYLINE TEXTOBJ NEWTOPLINE PANE))
 
      (* ;; "")
 
@@ -2323,11 +2353,12 @@
               (BLTSHADE WHITESHADE PANE 0 0 (fetch WIDTH of PREG)
                      (FGETLD LASTVISIBLE YBOT)
                      'REPLACE)
-              (\TEDIT.FORMATLINES LASTVISIBLE NIL PANE TEXTOBJ))
+              (\TEDIT.LINES.BELOW LASTVISIBLE NIL PANE TEXTOBJ))
           (\TEDIT.SCROLL.SHOWSEL 'UP WHERESEL PANE TEXTOBJ LASTVISIBLE])
 
 (\TEDIT.SCROLL.SHOWSEL
-  [LAMBDA (DIRECTION WHERESEL PANE TEXTOBJ VISIBLELINE)      (* ; "Edited 18-Feb-2024 15:24 by rmk")
+  [LAMBDA (DIRECTION WHERESEL PANE TEXTOBJ VISIBLELINE)      (* ; "Edited 15-Mar-2024 13:36 by rmk")
+                                                             (* ; "Edited 18-Feb-2024 15:24 by rmk")
                                                              (* ; "Edited 28-Nov-2023 22:58 by rmk")
 
     (* ;; "This synchronizes the selection hilighting and caret to correspond to lines that up- or down-scrolling has newly revealed.  It assumes that the hilighting of previously and still visible lines have been carried along with BITBLT.  VISIBLELINE is the last visible line (above or below) that bounds the region that needs to be redisplayed.")
@@ -2341,14 +2372,14 @@
              "No lines previously visible, they might come from above or below, in the ordinary way.")
 
                       (FSETSEL SEL ONFLG NIL)
-                      (\FIXSEL SEL TEXTOBJ NIL PANE)
-                      (\SHOWSEL SEL T PANE)
+                      (\TEDIT.FIXSEL SEL TEXTOBJ NIL PANE)
+                      (\TEDIT.SHOWSEL SEL T PANE)
                else 
                     (* ;; 
      "Old lines were visible and therefore highlighted, newly revealed lines may need to catch up.  ")
 
                     (FSETSEL SEL ONFLG T)
-                    (\FIXSEL SEL TEXTOBJ NIL PANE)
+                    (\TEDIT.FIXSEL SEL TEXTOBJ NIL PANE)
                     (SELECTQ DIRECTION
                         (UP 
                             (* ;; "lastline is not highlighted when it comes up")
@@ -2370,7 +2401,9 @@
                     (\TEDIT.SETCARET SEL PANE TEXTOBJ T))))])
 
 (\TEDIT.SCROLLDOWN
-  [LAMBDA (TEXTOBJ PANE DY)                                  (* ; "Edited 20-Jan-2024 23:13 by rmk")
+  [LAMBDA (TEXTOBJ PANE DY)                                  (* ; "Edited 19-Mar-2024 23:34 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 22:02 by rmk")
+                                                             (* ; "Edited 20-Jan-2024 23:13 by rmk")
                                                              (* ; "Edited  2-Jan-2024 00:25 by rmk")
                                                              (* ; "Edited  1-Dec-2023 16:11 by rmk")
                                                              (* ; "Edited 11-May-2023 11:53 by rmk")
@@ -2407,14 +2440,15 @@
 
           (SETQ NEWTOPLINE (if OLDTOPLINE
                                then (SETQ TOPOFOLD (FGETLD OLDTOPLINE YTOP))
-                                    (\BACKFORMAT TEXTOBJ (IMAX DY (ADD1 (FGETLD OLDTOPLINE LHEIGHT)))
+                                    (\TEDIT.BACKFORMAT TEXTOBJ (IMAX DY (ADD1 (FGETLD OLDTOPLINE 
+                                                                                     LHEIGHT)))
                                            (SUB1 (FGETLD OLDTOPLINE LCHAR1))
                                            (FGETLD OLDTOPLINE LHEIGHT))
                              else 
 
                                  (* ;; "If we didn't find a visible line, we must be looking at the tail end of the text.  We will need to bring down some of its final lines. ")
 
-                                  (\BACKFORMAT TEXTOBJ DY (FGETTOBJ TEXTOBJ TEXTLEN)
+                                  (\TEDIT.BACKFORMAT TEXTOBJ DY (FGETTOBJ TEXTOBJ TEXTLEN)
                                          0)))
           (CL:UNLESS NEWTOPLINE (RETURN))
           (SETQ WHERESEL (\TEDIT.WHERE.SEL TEXTOBJ OLDTOPLINE PANE))
@@ -2426,7 +2460,7 @@
 
      (* ;; "All the needed lines have been constructed, linked, and positioned; some trailing lines may have been chopped.  We now try to be clever and flicker-free about updating the display, although at this point a simple repaint will give the proper display.  ")
 
-          (CL:UNLESS (\TEDIT.OFFSCREEN.SCROLL TEXTOBJ PANE 'VERTICAL)
+          (CL:UNLESS (\TEDIT.OFFSCREEN.SCROLL TEXTOBJ PANE 'TOP)
               (CL:WHEN (AND OLDTOPLINE (IGEQ (FGETLD OLDTOPLINE YBOT)
                                              (FGETLD LASTVISIBLE YBOT)))
 
@@ -2446,12 +2480,15 @@
               (* ;; 
         "Display the new lines.  No need to clear the rectangle first, \DISPLAYLINE fills the bitmap")
 
-              (for L inlines NEWTOPLINE until (EQ L OLDTOPLINE) do (\DISPLAYLINE TEXTOBJ L PANE))
+              (for L inlines NEWTOPLINE until (EQ L OLDTOPLINE) do (\TEDIT.DISPLAYLINE TEXTOBJ L PANE
+                                                                          ))
               (\TEDIT.SCROLL.SHOWSEL 'DOWN WHERESEL PANE TEXTOBJ OLDTOPLINE)))
     NIL])
 
 (\TEDIT.OFFSCREEN.SCROLL
-  [LAMBDA (TEXTOBJ PANE DIRECTION)                           (* ; "Edited 20-Jan-2024 23:12 by rmk")
+  [LAMBDA (TEXTOBJ PANE BOUNDARY)                            (* ; "Edited 19-Mar-2024 23:34 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 22:00 by rmk")
+                                                             (* ; "Edited 20-Jan-2024 23:12 by rmk")
                                                              (* ; "Edited  2-Jan-2024 12:36 by rmk")
                                                              (* ; "Edited  4-Dec-2023 20:57 by rmk")
                                                              (* ; "Edited 11-May-2023 11:35 by rmk")
@@ -2459,11 +2496,11 @@
 
     (* ;; "Returns NIL if PANE if PANE is not all or partially offscreen because of a previous move. Otherwise, this replaces the normal incremental screen update of the calling function. Essentially, it applies a version of the repaint function for the one offscreen PANE of TEXTOBJ that is being scrolled.")
 
-    (CL:WHEN (EQMEMB DIRECTION (WINDOWPROP PANE 'OFFSCREEN))
+    (CL:WHEN (EQMEMB BOUNDARY (WINDOWPROP PANE 'OFFSCREEN))
         (LET (SEL WASON PREVLINE)
              (SETQ SEL (FGETTOBJ TEXTOBJ SEL))
              (CL:WHEN (SETQ WASON (GETSEL SEL ONFLG))
-                    (\SHOWSEL SEL NIL))                      (* ; 
+                    (\TEDIT.SHOWSEL SEL NIL))                (* ; 
                                                        "Turn off the selection while we make changes")
 
              (* ;; "Find the precursor of the target top line.")
@@ -2474,11 +2511,11 @@
                                            PHEIGHT) do (RETURN (FGETLD L PREVLINE))
                                finally (RETURN (fetch (TEXTWINDOW PLINES) of PANE]
              (\TEDIT.CLEARPANE PANE)
-             (\FILLPANE PREVLINE TEXTOBJ PANE)
+             (\TEDIT.FILLPANE PREVLINE TEXTOBJ PANE)
              (CL:WHEN WASON
-                 (\FIXSEL SEL TEXTOBJ)                       (* ; 
+                 (\TEDIT.FIXSEL SEL TEXTOBJ)                 (* ; 
                                                     "Account for any line shuffling and re-highlight")
-                 (\SHOWSEL SEL T)))
+                 (\TEDIT.SHOWSEL SEL T)))
         T)])
 
 (\TEDIT.WHERE.SEL
@@ -2664,7 +2701,8 @@
 (DEFINEQ
 
 (\TEDIT.PROCIDLEFN
-  [LAMBDA (WINDOW)                                           (* ; "Edited 25-Sep-2023 10:30 by rmk")
+  [LAMBDA (WINDOW)                                           (* ; "Edited 15-Mar-2024 18:34 by rmk")
+                                                             (* ; "Edited 25-Sep-2023 10:30 by rmk")
                                                              (* ; "Edited 19-Sep-2023 23:25 by rmk")
                                                              (* ; "Edited 30-May-91 23:35 by jds")
 
@@ -2682,7 +2720,7 @@
              (PROCESSP (WINDOWPROP WINDOW 'PROCESS]
         (TTY.PROCESS (WINDOWPROP WINDOW 'PROCESS))           (* ; 
                                                           "No SHIFT key down;  let's regain control.")
-        (CL:WHEN (GETTOBJ (WINDOWPROP WINDOW 'TEXTOBJ)
+        (CL:WHEN (GETTOBJ (fetch (TEXTWINDOW WTEXTOBJ) of WINDOW)
                         MENUFLG)                             (* ; "This is a MENU -- always select.")
             (\TEDIT.MENU.BUTTONEVENTFN WINDOW)))
        (T                                                    (* ; "Otherwise, let him select.")
@@ -2696,13 +2734,15 @@
     (\TEDIT.INTERRUPT.SETUP NEWPROCESS])
 
 (\TEDIT.PROCEXITFN
-  [LAMBDA (THISP NEWP)                                       (* jds " 5-Apr-84 10:40")
+  [LAMBDA (THISP NEWP)                                       (* ; "Edited 27-Mar-2024 15:23 by rmk")
+                                                             (* jds " 5-Apr-84 10:40")
+
+    (* ;; "Re-arm any interrupts that TEdit turned off, so the poor user has them available in other parts of the system.")
 
          (* Re-arm any interrupts that TEdit turned off, so the poor user has them 
          available in other parts of the system.)
 
-    (AND (WINDOWPROP (PROCESSPROP THISP 'WINDOW)
-                'TEXTOBJ)
+    (AND (fetch (TEXTWINDOW WTEXTSTREAM) of (PROCESSPROP THISP 'WINDOW))
          (\TEDIT.INTERRUPT.SETUP THISP T])
 )
 
@@ -2775,7 +2815,10 @@
         (DSPYPOSITION Y (ffetch (TEDITCARET TCCARETDS) of CARET)))])
 
 (TEDIT.NORMALIZECARET
-  [LAMBDA (TEXTOBJ SEL EVEN.IF.VISIBLE)                      (* ; "Edited 21-Mar-2024 21:48 by rmk")
+  [LAMBDA (TSTREAM SEL EVEN.IF.VISIBLE)                      (* ; "Edited 21-Mar-2024 21:27 by rmk")
+                                                             (* ; "Edited 20-Mar-2024 06:46 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 22:00 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 23:39 by rmk")
                                                              (* ; "Edited 21-Feb-2024 20:43 by rmk")
                                                              (* ; "Edited 18-Feb-2024 23:35 by rmk")
                                                              (* ; "Edited  2-Jan-2024 11:09 by rmk")
@@ -2786,67 +2829,73 @@
 
     (* ;; "This ensures that the caret is visible in the pane where the selection SEL was made.  Other panes are left alone (caret may or may not be visible), presumably because you don't want all the panes to jump to the caret when you are working in just one of them.")
 
-    (SETQ TEXTOBJ (TEXTOBJ TEXTOBJ))
-    (CL:UNLESS (FGETTOBJ TEXTOBJ TXTNEEDSUPDATE)
-        (CL:UNLESS SEL
-            (SETQ SEL (FGETTOBJ TEXTOBJ SEL)))
-        (\DTEST SEL 'SELECTION)
-        (CL:WHEN (FGETSEL SEL SET)                           (* ; 
+    (LET ((TEXTOBJ (TEXTOBJ TSTREAM)))
+         (CL:UNLESS (FGETTOBJ TEXTOBJ TXTNEEDSUPDATE)
+             (CL:UNLESS SEL
+                 (SETQ SEL (\DTEST (FGETTOBJ TEXTOBJ SEL)
+                                  'SELECTION)))
+             (CL:WHEN (AND (FGETSEL SEL SET)
+                           (IGREATERP (FGETTOBJ TEXTOBJ TEXTLEN)
+                                  0))                        (* ; 
                                                           "If the selection isn't set, don't bother.")
 
-            (* ;; "This is essentially %"find selpane in panes%"  and the corresponding L1/LN in SEL.  SELPANE is the pane of the last selection")
+                 (* ;; "This is essentially %"find selpane in panes%"  and the corresponding L1/LN in SEL.  SELPANE is the pane of the last selection")
 
-            (for PANE CH# CARETYBOT TOPLINE PREG PHEIGHT PBOTTOM (SELPANE _ (OR (FGETTOBJ TEXTOBJ 
-                                                                                       SELPANE)
-                                                                                (\TEDIT.PRIMARYW
-                                                                                 TEXTOBJ)))
-               inpanes TEXTOBJ as L1 inside (FGETSEL SEL L1) as LN inside (FGETSEL SEL LN)
-               first (CL:UNLESS SELPANE (RETURN)) when (EQ PANE SELPANE)
-               do 
-                  (* ;; "Find the YBOT in SELPANE of the line with the selected character, if known.")
+                 (for PANE CH# CARETYBOT TOPLINE PREG PHEIGHT PBOTTOM (SELPANE _
+                                                                             (OR (FGETTOBJ TEXTOBJ 
+                                                                                        SELPANE)
+                                                                                 (\TEDIT.PRIMARYW
+                                                                                  TEXTOBJ)))
+                    inpanes TEXTOBJ as L1 inside (FGETSEL SEL L1) as LN inside (FGETSEL SEL LN)
+                    first (CL:UNLESS SELPANE (RETURN)) when (EQ PANE SELPANE)
+                    do 
+                       (* ;; 
+                       "Find the YBOT in SELPANE of the line with the selected character, if known.")
 
-                  (SETQ PREG (DSPCLIPPINGREGION NIL PANE))
-                  (SETQ PHEIGHT (fetch PTOP of PREG))
-                  (SETQ PBOTTOM (fetch BOTTOM of PREG)) 
+                       (SETQ PREG (DSPCLIPPINGREGION NIL PANE))
+                       (SETQ PHEIGHT (fetch PTOP of PREG))
+                       (SETQ PBOTTOM (fetch BOTTOM of PREG)) 
 
-                  (* ;; 
-                  "Find the selected character either at the beginning or end of the selection.")
+                       (* ;; 
+                       "Find the selected character either at the beginning or end of the selection.")
 
-                  [SETQ CH# (IMAX 1 (IMIN (TEXTLEN TEXTOBJ)
-                                          (SELECTQ (FGETSEL SEL POINT)
-                                              (LEFT (FGETSEL SEL CH#))
-                                              (RIGHT (SUB1 (FGETSEL SEL CHLIM)))
-                                              (SHOULDNT]
-                  (SETQ CARETYBOT (SELECTQ (FGETSEL SEL POINT)
-                                      (LEFT (AND L1 (GETLD L1 YBOT)))
-                                      (RIGHT (AND LN (GETLD LN YBOT)))
-                                      NIL)) 
+                       [SETQ CH# (IMAX 1 (IMIN (TEXTLEN TEXTOBJ)
+                                               (SELECTQ (FGETSEL SEL POINT)
+                                                   (LEFT (FGETSEL SEL CH#))
+                                                   (RIGHT (SUB1 (FGETSEL SEL CHLIM)))
+                                                   (SHOULDNT]
+                       (SETQ CARETYBOT (SELECTQ (FGETSEL SEL POINT)
+                                           (LEFT (AND L1 (GETLD L1 YBOT)))
+                                           (RIGHT (AND LN (GETLD LN YBOT)))
+                                           NIL)) 
 
-                  (* ;; "We don't want to jump around if the caret is already visible in SELPANE.  ")
+                       (* ;; 
+  "We don't want to jump around if the caret is already visible in SELPANE, unless EVEN.IF.VISIBLE  ")
 
-                  (CL:WHEN (OR EVEN.IF.VISIBLE (NOT CARETYBOT)
-                               (IGEQ CARETYBOT PHEIGHT)
-                               (ILESSP CARETYBOT PBOTTOM))
+                       (CL:WHEN (OR EVEN.IF.VISIBLE (NOT CARETYBOT)
+                                    (IGEQ CARETYBOT PHEIGHT)
+                                    (ILESSP CARETYBOT PBOTTOM))
 
-                      (* ;; "Not visible, work to do: Make sure the line containing CH# is linked in and scrolled to the top of the pane. This should be replaceable by \TEDIT.SCROLLFN, with the appropriate DY.")
+                           (* ;; "Not visible, work to do: Make sure the line containing CH# is linked in and scrolled to the top of the pane. This should be replaceable by \TEDIT.SCROLLFN, with the appropriate DY.")
 
-                      (\SHOWSEL SEL NIL SELPANE)
-                      (SETQ TOPLINE (CADR (\FORMATBLOCK TEXTOBJ CH# PHEIGHT)))
-                      (SETYPOS TOPLINE (IDIFFERENCE PHEIGHT (GETLD TOPLINE LHEIGHT)))
-                      (LINKLD (fetch (TEXTWINDOW PLINES) of SELPANE)
-                             TOPLINE)
+                           (\TEDIT.SHOWSEL SEL NIL SELPANE TEXTOBJ)
+                           (SETQ TOPLINE (CADR (\TEDIT.LINES.ABOVE TEXTOBJ CH# PHEIGHT)))
+                           (SETYPOS TOPLINE (IDIFFERENCE PHEIGHT (GETLD TOPLINE LHEIGHT)))
+                           (LINKLD (fetch (TEXTWINDOW PLINES) of SELPANE)
+                                  TOPLINE)
 
-                      (* ;; 
+                           (* ;; 
      "Lines are established and positioned.  Clear the window, display the first (caret) caret line.")
 
-                      (\TEDIT.CLEARPANE PANE)
-                      (\DISPLAYLINE TEXTOBJ TOPLINE SELPANE)
-                      (\FILLPANE TOPLINE TEXTOBJ SELPANE)    (* ; 
+                           (\TEDIT.CLEARPANE PANE)
+                           (\TEDIT.DISPLAYLINE TEXTOBJ TOPLINE SELPANE)
+                           (\TEDIT.FILLPANE TOPLINE TEXTOBJ SELPANE)
+                                                             (* ; 
                                                              "And fill out the window from there.")
-                      (\FIXSEL SEL TEXTOBJ NIL SELPANE)
-                      (\TEDIT.SET.WINDOW.EXTENT TEXTOBJ SELPANE)
-                      (\SHOWSEL SEL T SELPANE))
-                  (RETURN))))])
+                           (\TEDIT.FIXSEL SEL TEXTOBJ NIL SELPANE)
+                           (\TEDIT.SET.WINDOW.EXTENT TEXTOBJ SELPANE)
+                           (\TEDIT.SHOWSEL SEL T SELPANE TEXTOBJ))
+                       (RETURN))))])
 
 (\TEDIT.SETCARET
   [LAMBDA (SEL PANE TEXTOBJ DISPOSITION CARET)               (* ; "Edited 15-Dec-2023 23:37 by rmk")
@@ -2955,7 +3004,10 @@
                 (UPDATE/MENU/IMAGE MENU])
 
 (TEDIT.DEFAULT.MENUFN
-  [LAMBDA (W)                                                (* ; "Edited 29-Feb-2024 17:02 by rmk")
+  [LAMBDA (W)                                                (* ; "Edited 20-Mar-2024 11:02 by rmk")
+                                                             (* ; "Edited 15-Mar-2024 18:35 by rmk")
+                                                             (* ; "Edited  9-Mar-2024 11:35 by rmk")
+                                                             (* ; "Edited 29-Feb-2024 17:02 by rmk")
                                                              (* ; "Edited 27-Feb-2024 07:55 by rmk")
                                                              (* ; "Edited 22-Sep-2023 20:14 by rmk")
                                                              (* ; "Edited 19-Sep-2023 11:55 by rmk")
@@ -2966,10 +3018,10 @@
     (* ;; 
     "Default MENU Fn for editor windows--displays a menu of items & acts on the commands received.")
 
-    (PROG ((TEXTOBJ (WINDOWPROP W 'TEXTOBJ))
+    (PROG ((TEXTOBJ (fetch (TEXTWINDOW WTEXTOBJ) of W))
            (WMENU (WINDOWPROP W 'TEDIT.MENU))
            THISMENU CH OFILE OCURSOR LINES SEL ITEM)
-          (\DTEST TEXTOBJ 'TEXTOBJ)
+          (TEXTOBJ! TEXTOBJ)
           (COND
              ((EQ (FGETTOBJ TEXTOBJ EDITOPACTIVE)
                   T)
@@ -3024,7 +3076,7 @@
                                                           'TEDIT.LAST.FIND.STRING]
                                 (CL:WHEN OFILE
                                     (SETQ SEL (TEXTSEL TEXTOBJ))
-                                    (\SHOWSEL SEL NIL)
+                                    (\TEDIT.SHOWSEL SEL NIL)
                                     (TEDIT.PROMPTPRINT TEXTOBJ "Searching..." T)
                                     (SETQ CH (TEDIT.FIND TEXTOBJ (MKSTRING OFILE)
                                                     NIL NIL T))
@@ -3040,14 +3092,15 @@
                                            (SETSEL SEL POINT 'RIGHT)
                                            (SETTOBJ TEXTOBJ CARETLOOKS (\TEDIT.GET.INSERT.CHARLOOKS
                                                                         TEXTOBJ SEL))
-                                           (TEDIT.RESET.EXTEND.PENDING.DELETE SEL)
+                                           (\TEDIT.RESET.EXTEND.PENDING.DELETE SEL TEXTOBJ)
                                                              (* ; "And never pending a deletion.")
-                                           (\FIXSEL SEL TEXTOBJ)
+                                           (\TEDIT.FIXSEL SEL TEXTOBJ)
                                            (TEDIT.NORMALIZECARET TEXTOBJ)
-                                           (\SHOWSEL SEL T)  (* ; "And get it into the TEXTOBJ")
+                                           (\TEDIT.SHOWSEL SEL T)
+                                                             (* ; "And get it into the TEXTOBJ")
                                            (PUTTEXTPROP TEXTOBJ 'TEDIT.LAST.FIND.STRING OFILE))
                                        (T (TEDIT.PROMPTPRINT TEXTOBJ "(not found)")
-                                          (\SHOWSEL SEL T)))))
+                                          (\TEDIT.SHOWSEL SEL T)))))
                           (Looks                             (* ; 
                                                  "He wants to set the font for the current selection")
                                  (\TEDIT.LOOKS TEXTOBJ))
@@ -3175,34 +3228,34 @@
 (RPAQ? TEDIT.TITLED.ICON.TEMPLATE (create TITLEDICON ICON _ TEDITICON MASK _ TEDITMASK TITLEREG _ 
                                          TEDIT.ICON.TITLE.REGION))
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (13032 32608 (\TEDIT.CREATEW 13042 . 19417) (\TEDIT.WINDOW.SETUP 19419 . 22108) (
-\TEDIT.MINIMAL.WINDOW.SETUP 22110 . 30531) (\TEDIT.ADD.CARET 30533 . 31997) (\TEDIT.CLEARPANE 31999 . 
-32606)) (32609 53665 (\TEDIT.CURSORMOVEDFN 32619 . 36427) (\TEDIT.CURSOROUTFN 36429 . 36874) (
-\TEDIT.ACTIVE.WINDOWP 36876 . 38002) (\TEDIT.EXPANDFN 38004 . 38567) (\TEDIT.MAINW 38569 . 40709) (
-\TEDIT.PRIMARYW 40711 . 41351) (\TEDIT.NEWREGIONFN 41353 . 43869) (\TEDIT.SET.WINDOW.EXTENT 43871 . 
-48734) (\TEDIT.SHRINK.ICONCREATE 48736 . 51159) (\TEDIT.SHRINKFN 51161 . 51570) (\TEDIT.PANEREGION 
-51572 . 53663)) (53666 77431 (\TEDIT.BUTTONEVENTFN 53676 . 68731) (\TEDIT.DO.SELOPERATION 68733 . 
-71015) (\TEDIT.TTY.TEXTOBJP 71017 . 71441) (\TEDIT.BUTTONEVENTFN.SELOPERATION 71443 . 72832) (
-\TEDIT.BUTTONEVENTFN.INACTIVE 72834 . 74860) (\TEDIT.BUTTONEVENTFN.INTITLE 74862 . 76381) (
-\TEDIT.COPYINSERT 76383 . 77429)) (77466 92195 (\TEDIT.PANE.SPLIT 77476 . 81696) (\TEDIT.SPLITW 81698
- . 88031) (\TEDIT.UNSPLITW 88033 . 92193)) (93551 94336 (TEDITWINDOWP 93561 . 94334)) (94373 97361 (
-TEDIT.GETINPUT 94383 . 96826) (\TEDIT.MAKEFILENAME 96828 . 97359)) (97410 105399 (TEDIT.PROMPTWINDOW 
-97420 . 97757) (TEDIT.PROMPTPRINT 97759 . 100195) (TEDIT.PROMPTCLEAR 100197 . 101916) (
-TEDIT.PROMPTFLASH 101918 . 103827) (\TEDIT.PROMPT.PAGEFULLFN 103829 . 105397)) (105637 113516 (
-\TEXTSTREAM.TITLE 105647 . 106337) (\TEDIT.DEFAULT.TITLE 106339 . 108718) (\TEDIT.WINDOW.TITLE 108720
- . 110777) (\TEXTSTREAM.FILENAME 110779 . 112449) (\TEDIT.UPDATE.TITLE 112451 . 113514)) (113559 
-128600 (TEDIT.DEACTIVATE.WINDOW 113569 . 119991) (\TEDIT.REPAINTFN 119993 . 121568) (
-\TEDIT.AFTERMOVEFN 121570 . 122324) (OFFSCREENP 122326 . 123531) (\TEDIT.RESHAPEFN 123533 . 127422) (
-\TEDIT.PANEWITHINSCREEN? 127424 . 128598)) (128601 156234 (\TEDIT.SCROLLFN 128611 . 130298) (
-\TEDIT.SCROLLFLOAT 130300 . 134886) (\TEDIT.SCROLLUP 134888 . 142264) (\TEDIT.SCROLL.SHOWSEL 142266 . 
-144890) (\TEDIT.SCROLLDOWN 144892 . 150108) (\TEDIT.OFFSCREEN.SCROLL 150110 . 152225) (
-\TEDIT.WHERE.SEL 152227 . 153447) (\TEDIT.WHERE.SEL1 153449 . 156232)) (156235 161357 (\TEDIT.ONSCREEN
- 156245 . 157700) (\TEDIT.ONSCREEN? 157702 . 160015) (\TEDIT.PANE.SCREENREGION 160017 . 161355)) (
-161399 163644 (\TEDIT.PROCIDLEFN 161409 . 162818) (\TEDIT.PROCENTRYFN 162820 . 163265) (
-\TEDIT.PROCEXITFN 163267 . 163642)) (163723 176503 (\TEDIT.DOWNCARET 163733 . 164526) (
-\TEDIT.FLASHCARET 164528 . 166345) (\TEDIT.UPCARET 166347 . 167451) (TEDIT.NORMALIZECARET 167453 . 
-172234) (\TEDIT.SETCARET 172236 . 176076) (\TEDIT.CARET 176078 . 176501)) (176537 189783 (
-TEDIT.ADD.MENUITEM 176547 . 178838) (TEDIT.DEFAULT.MENUFN 178840 . 187123) (TEDIT.REMOVE.MENUITEM 
-187125 . 188122) (\TEDIT.CREATEMENU 188124 . 188561) (\TEDIT.MENU.WHENHELDFN 188563 . 189468) (
-\TEDIT.MENU.WHENSELECTEDFN 189470 . 189781)))))
+  (FILEMAP (NIL (13090 32895 (\TEDIT.CREATEW 13100 . 19541) (\TEDIT.WINDOW.SETUP 19543 . 22359) (
+\TEDIT.MINIMAL.WINDOW.SETUP 22361 . 30738) (\TEDIT.ADD.CARET 30740 . 32284) (\TEDIT.CLEARPANE 32286 . 
+32893)) (32896 54069 (\TEDIT.CURSORMOVEDFN 32906 . 36789) (\TEDIT.CURSOROUTFN 36791 . 37236) (
+\TEDIT.ACTIVE.WINDOWP 37238 . 38289) (\TEDIT.EXPANDFN 38291 . 38854) (\TEDIT.MAINW 38856 . 40996) (
+\TEDIT.PRIMARYW 40998 . 41638) (\TEDIT.NEWREGIONFN 41640 . 44156) (\TEDIT.SET.WINDOW.EXTENT 44158 . 
+49021) (\TEDIT.SHRINK.ICONCREATE 49023 . 51563) (\TEDIT.SHRINKFN 51565 . 51974) (\TEDIT.PANEREGION 
+51976 . 54067)) (54070 78734 (\TEDIT.BUTTONEVENTFN 54080 . 69847) (\TEDIT.DO.SELOPERATION 69849 . 
+72131) (\TEDIT.TTY.TEXTOBJP 72133 . 72557) (\TEDIT.BUTTONEVENTFN.SELOPERATION 72559 . 73948) (
+\TEDIT.BUTTONEVENTFN.INACTIVE 73950 . 76163) (\TEDIT.BUTTONEVENTFN.INTITLE 76165 . 77684) (
+\TEDIT.COPYINSERT 77686 . 78732)) (78769 93880 (\TEDIT.PANE.SPLIT 78779 . 82999) (\TEDIT.SPLITW 83001
+ . 89562) (\TEDIT.UNSPLITW 89564 . 93878)) (95236 96021 (TEDITWINDOWP 95246 . 96019)) (96058 99046 (
+TEDIT.GETINPUT 96068 . 98511) (\TEDIT.MAKEFILENAME 98513 . 99044)) (99095 107084 (TEDIT.PROMPTWINDOW 
+99105 . 99419) (TEDIT.PROMPTPRINT 99421 . 101857) (TEDIT.PROMPTCLEAR 101859 . 103578) (
+TEDIT.PROMPTFLASH 103580 . 105512) (\TEDIT.PROMPT.PAGEFULLFN 105514 . 107082)) (107322 115201 (
+\TEXTSTREAM.TITLE 107332 . 108022) (\TEDIT.DEFAULT.TITLE 108024 . 110403) (\TEDIT.WINDOW.TITLE 110405
+ . 112462) (\TEXTSTREAM.FILENAME 112464 . 114134) (\TEDIT.UPDATE.TITLE 114136 . 115199)) (115244 
+131492 (TEDIT.DEACTIVATE.WINDOW 115254 . 121837) (\TEDIT.REPAINTFN 121839 . 123638) (
+\TEDIT.AFTERMOVEFN 123640 . 124394) (OFFSCREENP 124396 . 126003) (\TEDIT.RESHAPEFN 126005 . 130314) (
+\TEDIT.PANEWITHINSCREEN? 130316 . 131490)) (131493 160656 (\TEDIT.SCROLLFN 131503 . 133408) (
+\TEDIT.SCROLLFLOAT 133410 . 138238) (\TEDIT.SCROLLUP 138240 . 145938) (\TEDIT.SCROLL.SHOWSEL 145940 . 
+148691) (\TEDIT.SCROLLDOWN 148693 . 154301) (\TEDIT.OFFSCREEN.SCROLL 154303 . 156647) (
+\TEDIT.WHERE.SEL 156649 . 157869) (\TEDIT.WHERE.SEL1 157871 . 160654)) (160657 165779 (\TEDIT.ONSCREEN
+ 160667 . 162122) (\TEDIT.ONSCREEN? 162124 . 164437) (\TEDIT.PANE.SCREENREGION 164439 . 165777)) (
+165821 168438 (\TEDIT.PROCIDLEFN 165831 . 167368) (\TEDIT.PROCENTRYFN 167370 . 167815) (
+\TEDIT.PROCEXITFN 167817 . 168436)) (168517 182211 (\TEDIT.DOWNCARET 168527 . 169320) (
+\TEDIT.FLASHCARET 169322 . 171139) (\TEDIT.UPCARET 171141 . 172245) (TEDIT.NORMALIZECARET 172247 . 
+177942) (\TEDIT.SETCARET 177944 . 181784) (\TEDIT.CARET 181786 . 182209)) (182245 195923 (
+TEDIT.ADD.MENUITEM 182255 . 184546) (TEDIT.DEFAULT.MENUFN 184548 . 193263) (TEDIT.REMOVE.MENUITEM 
+193265 . 194262) (\TEDIT.CREATEMENU 194264 . 194701) (\TEDIT.MENU.WHENHELDFN 194703 . 195608) (
+\TEDIT.MENU.WHENSELECTEDFN 195610 . 195921)))))
 STOP
diff --git a/library/tedit/TEDIT-WINDOW.LCOM b/library/tedit/TEDIT-WINDOW.LCOM
index 55cf3883..250b4c90 100644
Binary files a/library/tedit/TEDIT-WINDOW.LCOM and b/library/tedit/TEDIT-WINDOW.LCOM differ
diff --git a/library/tedit/TEDIT.LCOM b/library/tedit/TEDIT.LCOM
index e056bc49..8fb3ad55 100644
Binary files a/library/tedit/TEDIT.LCOM and b/library/tedit/TEDIT.LCOM differ
diff --git a/library/tedit/tedit-exports.all b/library/tedit/tedit-exports.all
index 2f07540a..081dec79 100644
--- a/library/tedit/tedit-exports.all
+++ b/library/tedit/tedit-exports.all
@@ -1,11 +1,11 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 4-Mar-2024 22:49:16" 
-{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>tedit-exports.all;111 46338  
+(FILECREATED "20-Mar-2024 11:16:36" 
+{DSK}<Users>kaplan>Local>medley3.5>working-medley>library>tedit>tedit-exports.all;120 47172  
 
       :EDIT-BY rmk
 
-      :PREVIOUS-DATE " 3-Mar-2024 08:55:19" {WMEDLEY}<library>tedit>tedit-exports.all;110)
+      :PREVIOUS-DATE "20-Mar-2024 09:45:21" {WMEDLEY}<library>TEDIT>tedit-exports.all;118)
 
 
 (PRETTYCOMPRINT ((E (MAPC (MKLIST FROMFILES) (FUNCTION (LAMBDA (F) (MAPC (IMPORTFILE F FLG) (FUNCTION 
@@ -17,7 +17,7 @@ HELP "TEDIT-ASSERT FAILURE" (\, (KWOTE (CAR ARGS))))))) (T (BQUOTE (* (TEDIT-ASS
 (RPAQ? CHECK-TEDIT-ASSERTIONS T)
 (PUTPROPS OBJECT.ALLOWS MACRO ((PC OPERATION FROMTOBJ TOTOBJ) (OR (NOT (EQ OBJECT.PTYPE (PTYPE PC))) (
 \TEDIT.APPLY.OBJFN (PCONTENTS PC) OPERATION FROMTOBJ TOTOBJ))))
-(PUTPROP (QUOTE TEDIT) (QUOTE IMPORTDATE) (IDATE " 4-Mar-2024 21:32:36"))
+(PUTPROP (QUOTE TEDIT) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:08:26"))
 (RPAQQ \BTREEWORDSPERSLOT 4)
 (RPAQQ \BTREEMAXCOUNT 8)
 (CONSTANTS (\BTREEWORDSPERSLOT 4) (\BTREEMAXCOUNT 8))
@@ -52,7 +52,7 @@ DLEN1 DOWN2 DLEN2 DOWN3 DLEN3 DOWN4 DLEN4 DOWN5 DLEN5 DOWN6 DLEN6 DOWN7 DLEN7 DO
  (\DTEST (OR (NEXTPIECE I.V.) (GO $$OUT)) (QUOTE PIECE)))))
 (I.S.OPR (QUOTE backpieces) NIL (QUOTE (first (SETQ I.V. (\DTEST (OR BODY (GO $$OUT)) (QUOTE PIECE))) 
 by (\DTEST (OR (PREVPIECE I.V.) (GO $$OUT)) (QUOTE PIECE)))))
-(PUTPROP (QUOTE TEDIT-PCTREE) (QUOTE IMPORTDATE) (IDATE " 3-Mar-2024 08:59:45"))
+(PUTPROP (QUOTE TEDIT-PCTREE) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:07:07"))
 (DATATYPE SELECTION ((* ;; 
 "Description of a piece of selected text for TEdit.  Text has to be selected before it can be operated on by the user. The caret is to the left of CH# if POINT is LEFT, to the keft of CHLIM if POINT is RIGHT."
 ) (* ;; "If DCH > 0, highlighting goes from CH# to (SUB1 CHLIM = (SUB1 (IPLUS CH# DCH)).") (* ;; 
@@ -104,7 +104,7 @@ $$SPLENGTH) first (SETQ I.V. (SETQ $$SPFIRST (\DTEST (OR (fetch (SELPIECES SPFIR
 GO $$OUT)) (QUOTE PIECE)))) (SETQ $$SPLAST (fetch (SELPIECES SPLAST) of $$SELPIECES)) (SETQ $$SPLENGTH
  (fetch (SELPIECES SPLEN) of $$SELPIECES)) while I.V. repeatuntil (EQ I.V. $$SPLAST) by (NEXTPIECE 
 I.V.))))) T)
-(PUTPROP (QUOTE TEDIT-SELECTION) (QUOTE IMPORTDATE) (IDATE " 4-Mar-2024 22:48:20"))
+(PUTPROP (QUOTE TEDIT-SELECTION) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:08:55"))
 (DATATYPE THISLINE ((* ;; 
 "Cache for line-related character location info, for selection and line-display code to use.") (DESC 
 FULLXPOINTER) (* ; "Line descriptor for the line this describes now") TLSPACEFACTOR (* ; 
@@ -136,8 +136,8 @@ FORCED-END (* ; "NIL or character (EOL, FORM...) that forces a line break") (* ;
 (* ; "Next line chain pointer") (PREVLINE FULLXPOINTER) (* ; "Previous line chain pointer") LMARK (* ;
  
 "One of SOLID, GREY, NIL.  Tells what kind of special-line marker should be put in the left margin for this paragraph.  (For hardcopy, can also be an indicator for special processing?)"
-) LTEXTOBJ (* ; 
-"A cached TEXTOBJ that this line took its text from.  Used only in hardcopy to disambiguate when chno's should be updated."
+) LTEXTSTREAM (* ; 
+"A cached textstream that this line took its text from.  Filled in by \TEDIT.FORMATLINE only in hardcopy, used temporarily and the cleared by \TEDIT.FORMATBOX to avoid the circularity."
 ) NIL (* ; 
 "Was CACHE: A cached THISLINE, for keeping hardcopy info around while we crunch with the line descriptors to make things fit.  Now:  THISLINE comes from TEXTOBJ"
 ) NIL (* ; "Was LDOBJ: The object which lies behind this line of text, for updating, etc.") LFMTSPEC (
@@ -226,7 +226,7 @@ eachtime (SETQ CHAR (fetch (CHARSLOT CHAR) of I.V.)) (SETQ CHARW (fetch (CHARSLO
 repeatuntil (EQ I.V. $$CHARSLOTLIMIT))))) T)
 (PUTPROPS DIACRITICP MACRO (OPENLAMBDA (CHAR) (* ;; "An XCCS diacritic") (AND (SMALLP CHAR) (IGEQ CHAR
  192) (ILEQ CHAR 207))))
-(PUTPROP (QUOTE TEDIT-SCREEN) (QUOTE IMPORTDATE) (IDATE " 2-Mar-2024 07:40:06"))
+(PUTPROP (QUOTE TEDIT-SCREEN) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:07:35"))
 (DATATYPE PIECE ((* ; 
 "The piece describes either a string or part of a file.  , or a generalized OBJECT.") PCONTENTS (* ; 
 "The background source of data for this piece (stream, string, block, object, depending on the PTYPE)."
@@ -327,9 +327,10 @@ NEWVALUE)) (* ;
 "The FMTSPEC that is currently applicable to characters being taken from the stream. This was  the only residual field of TEXTIMAGEDATA, now gone."
 ) (LOOKSUPDATEFN (fetch (STREAM F4) of DATUM) (REPLACE (STREAM F4) OF DATUM with NEWVALUE)) (* ; 
 "Function to be called at every piece change when line-formatting.") (STARTINGCOFFSET (fetch (STREAM 
-F2) of DATUM) (replace (STREAM F2) of DATUM with NEWVALUE))) (CREATE (create STREAM BINABLE _ NIL 
-BOUTABLE _ NIL ACCESS _ (QUOTE BOTH) USERCLOSEABLE _ T USERVISIBLE _ T DEVICE _ \TEXTFDEV F1 _ NIL F2 
-_ 0 F3 _ NIL F4 _ NIL F5 _ NIL MAXBUFFERS _ 10 IMAGEOPS _ \TEXTIMAGEOPS IMAGEDATA _ NIL)))
+F2) of DATUM) (replace (STREAM F2) of DATUM with NEWVALUE))) (TYPE? (AND (type? STREAM DATUM) (type? 
+TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of DATUM)))) (CREATE (create STREAM BINABLE _ NIL BOUTABLE _ NIL 
+ACCESS _ (QUOTE BOTH) USERCLOSEABLE _ T USERVISIBLE _ T DEVICE _ \TEXTFDEV F1 _ NIL F2 _ 0 F3 _ NIL F4
+ _ NIL F5 _ NIL MAXBUFFERS _ 10 IMAGEOPS _ \TEXTIMAGEOPS IMAGEDATA _ NIL)))
 (PUTPROPS NEXTPIECE MACRO ((PC) (ffetch (PIECE NEXTPIECE) of PC)))
 (PUTPROPS PREVPIECE MACRO ((PC) (ffetch (PIECE PREVPIECE) of PC)))
 (PUTPROPS PLEN MACRO ((PC) (ffetch (PIECE PLEN) of PC)))
@@ -364,6 +365,13 @@ VISIBLEPIECEP PPC))))
 (PUTPROPS FSETTOBJ MACRO ((TOBJ FIELD NEWVALUE) (freplace (TEXTOBJ FIELD) of TOBJ with NEWVALUE)))
 (PUTPROPS TEXTLEN MACRO ((TOBJ) (ffetch (TEXTOBJ TEXTLEN) of TOBJ)))
 (PUTPROPS TEXTSEL MACRO ((TOBJ) (fetch (TEXTOBJ SEL) of TOBJ)))
+(PUTPROPS TEXTOBJ! MACRO ((TOBJ) (\DTEST TOBJ (QUOTE TEXTOBJ))))
+(RPAQQ PTYPES ((THINFILE.PTYPE 0) (FATFILE1.PTYPE 1) (FATFILE2.PTYPE 2) (THINSTRING.PTYPE 3) (
+FATSTRING.PTYPE 4) (SUBSTREAM.PTYPE 5) (OBJECT.PTYPE 6) (LOOKS.PTYPE 7) (UTF16BE.PTYPE 8) (
+UTF16LE.PTYPE 9) (UTF8.PTYPE 11) (FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE 
+UTF8.PTYPE UTF16BE.PTYPE UTF16LE.PTYPE)) (STRING.PTYPES (LIST THINSTRING.PTYPE FATSTRING.PTYPE)) (
+BINABLE.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE)) (THIN.PTYPES (LIST THINFILE.PTYPE 
+THINSTRING.PTYPE))))
 (RPAQQ THINFILE.PTYPE 0)
 (RPAQQ FATFILE1.PTYPE 1)
 (RPAQQ FATFILE2.PTYPE 2)
@@ -372,18 +380,22 @@ VISIBLEPIECEP PPC))))
 (RPAQQ SUBSTREAM.PTYPE 5)
 (RPAQQ OBJECT.PTYPE 6)
 (RPAQQ LOOKS.PTYPE 7)
+(RPAQQ UTF16BE.PTYPE 8)
+(RPAQQ UTF16LE.PTYPE 9)
 (RPAQQ UTF8.PTYPE 11)
-(RPAQ FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE))
+(RPAQ FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE UTF16BE.PTYPE 
+UTF16LE.PTYPE))
 (RPAQ STRING.PTYPES (LIST THINSTRING.PTYPE FATSTRING.PTYPE))
 (RPAQ BINABLE.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE))
 (RPAQ THIN.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE))
 (CONSTANTS (THINFILE.PTYPE 0) (FATFILE1.PTYPE 1) (FATFILE2.PTYPE 2) (THINSTRING.PTYPE 3) (
-FATSTRING.PTYPE 4) (SUBSTREAM.PTYPE 5) (OBJECT.PTYPE 6) (LOOKS.PTYPE 7) (UTF8.PTYPE 11) (FILE.PTYPES (
-LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE UTF8.PTYPE)) (STRING.PTYPES (LIST THINSTRING.PTYPE 
-FATSTRING.PTYPE)) (BINABLE.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE)) (THIN.PTYPES (LIST 
-THINFILE.PTYPE THINSTRING.PTYPE)))
+FATSTRING.PTYPE 4) (SUBSTREAM.PTYPE 5) (OBJECT.PTYPE 6) (LOOKS.PTYPE 7) (UTF16BE.PTYPE 8) (
+UTF16LE.PTYPE 9) (UTF8.PTYPE 11) (FILE.PTYPES (LIST THINFILE.PTYPE FATFILE1.PTYPE FATFILE2.PTYPE 
+UTF8.PTYPE UTF16BE.PTYPE UTF16LE.PTYPE)) (STRING.PTYPES (LIST THINSTRING.PTYPE FATSTRING.PTYPE)) (
+BINABLE.PTYPES (LIST THINFILE.PTYPE THINSTRING.PTYPE)) (THIN.PTYPES (LIST THINFILE.PTYPE 
+THINSTRING.PTYPE)))
 (GLOBALVARS \TEXTIMAGEOPS \TEXTFDEV)
-(PUTPROP (QUOTE TEDIT-STREAM) (QUOTE IMPORTDATE) (IDATE " 2-Mar-2024 07:10:22"))
+(PUTPROP (QUOTE TEDIT-STREAM) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:08:37"))
 (RPAQQ NONE.TTC 0)
 (RPAQQ CHARDELETE.TTC 1)
 (RPAQQ WORDDELETE.TTC 2)
@@ -419,13 +431,13 @@ I in ARGS as J on ARGS when (NOT (STRINGP I)) collect (LIST (QUOTE OR) I (LIST (
 (RPAQQ NEWCHAR-IF-SPLIT.LB 32)
 (CONSTANTS (NOTBEFORE.LB 1) (NOTAFTER.LB 2) (BEFORE.LB 4) (AFTER.LB 8) (DISAPPEAR-IF-NOT-SPLIT.LB 16) 
 (NEWCHAR-IF-SPLIT.LB 32))
-(PUTPROP (QUOTE TEDIT-COMMAND) (QUOTE IMPORTDATE) (IDATE "26-Feb-2024 11:22:29"))
+(PUTPROP (QUOTE TEDIT-COMMAND) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:07:16"))
 (PUTPROPS \SMALLPIN MACRO (OPENLAMBDA (STREAM) (SIGNED (create WORD HIBYTE _ (\BIN STREAM) LOBYTE _ (
 \BIN STREAM)) BITSPERWORD)))
 (PUTPROPS \SMALLPOUT MACRO (OPENLAMBDA (STREAM W) (* ; "Signed smallp, unlike \WOUT") (\BOUT STREAM (
 LOGAND 255 (LRSH W 8))) (\BOUT STREAM (LOGAND W 255))))
-(PUTPROP (QUOTE TEDIT-FILE) (QUOTE IMPORTDATE) (IDATE "16-Feb-2024 23:55:44"))
-(PUTPROP (QUOTE TEDIT-OLDFILE) (QUOTE IMPORTDATE) (IDATE "21-Jan-2024 10:27:59"))
+(PUTPROP (QUOTE TEDIT-FILE) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:06:52"))
+(PUTPROP (QUOTE TEDIT-OLDFILE) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:06:42"))
 (DATATYPE CHARLOOKS ((* ;; "Describes the appearance (%"Looks%") of characters in a TEdit document.") 
 CLFONT (* ; "The font descriptor for these characters") CLNAME (* ;; 
 "Name of the font (e.g., HELVETICA) THIS FIELD IS A HINT, OR FOR USE IN CHARLOOKS-BUILDING CODE.  USE FONTPROP TO GET THE RIGHT VALUE FROM CLFONT."
@@ -490,7 +502,7 @@ LINELEAD _ 0 TABSPEC _ (CONS DEFAULTTAB NIL))
 )) (EQ \ST.POS16 (fetch (ARRAYP TYP) of A)))) (CHECK (IGREATERP (fetch (ARRAYP LENGTH) of A) J)) (
 \PUTBASE (fetch (ARRAYP BASE) of A) (IPLUS (fetch (ARRAYP OFFST) of A) J) V)))
 (PUTPROPS ONOFF MACRO (OPENLAMBDA (VAL) (COND (VAL (QUOTE ON)) (T (QUOTE OFF)))))
-(PUTPROP (QUOTE TEDIT-LOOKS) (QUOTE IMPORTDATE) (IDATE "24-Feb-2024 12:34:14"))
+(PUTPROP (QUOTE TEDIT-LOOKS) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:06:29"))
 (DATATYPE TEDITCARET (TCNOWTIME (* Used to hold the current time, when checking to see if a transition
  is due) TCTHENTIME (* Time when the next transition is to take place) TCFORCEDDOWN (* TCFORCEDOWN = T
  means (Make the caret visible at the next call to \EDIT.FLIPCARET.)) TCUP (* TCUP = T => The caret is
@@ -503,15 +515,14 @@ eventually))) TCNOWTIME _ (CREATECELL \FIXP) TCTHENTIME _ (CREATECELL \FIXP) TCC
 TCCARETRATE _ \CARETRATE TCUP _ T TCCARET _ (\CARET.CREATE BXCARET))
 (ACCESSFNS TEXTWINDOW ((NEXTPANE (GETWINDOWPROP DATUM (QUOTE TEDIT-NEXT-PANE-DOWN)) (PUTWINDOWPROP 
 DATUM (QUOTE TEDIT-NEXT-PANE-DOWN) NEWVALUE)) (WTEXTSTREAM (GETWINDOWPROP DATUM (QUOTE TEXTSTREAM)) (
-PUTWINDOWPROP DATUM (QUOTE TEXTSTREAM) NEWVALUE)) (WTEXTOBJ (GETWINDOWPROP DATUM (QUOTE TEXTOBJ)) (
-PUTWINDOWPROP DATUM (QUOTE TEXTOBJ) NEWVALUE)) (PTEXTOBJ (GETWINDOWPROP DATUM (QUOTE TEXTOBJ)) (
-PUTWINDOWPROP DATUM (QUOTE TEXTOBJ) NEWVALUE)) (WLINES (GETWINDOWPROP DATUM (QUOTE LINES)) (
-PUTWINDOWPROP DATUM (QUOTE LINES) NEWVALUE)) (CURSORREGION (GETWINDOWPROP DATUM (QUOTE 
-TEDIT.CURSORREGION)) (PUTWINDOWPROP DATUM (QUOTE TEDIT.CURSORREGION) NEWVALUE)) (PLINES (GETWINDOWPROP
- DATUM (QUOTE LINES)) (PUTWINDOWPROP DATUM (QUOTE LINES) NEWVALUE)) (CLOSINGFILE (GETWINDOWPROP DATUM 
-(QUOTE TEDIT-CLOSING-FILE)) (PUTWINDOWPROP DATUM (QUOTE TEDIT-CLOSING-FILE) NIL)) (WITHINSCREEN (
-GETWINDOWPROP DATUM (QUOTE TEDIT-WITHIN-SCREEN)) (LET ((NV NEWVALUE)) (PUTWINDOWPROP DATUM (QUOTE 
-TEDIT-WITHIN-SCREEN) NV) NV))))
+PUTWINDOWPROP DATUM (QUOTE TEXTSTREAM) NEWVALUE)) (WTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of (fetch (
+TEXTWINDOW WTEXTSTREAM) of DATUM))) (PTEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of (fetch (TEXTWINDOW 
+WTEXTSTREAM) of DATUM))) (WLINES (GETWINDOWPROP DATUM (QUOTE LINES)) (PUTWINDOWPROP DATUM (QUOTE LINES
+) NEWVALUE)) (CURSORREGION (GETWINDOWPROP DATUM (QUOTE TEDIT.CURSORREGION)) (PUTWINDOWPROP DATUM (
+QUOTE TEDIT.CURSORREGION) NEWVALUE)) (PLINES (GETWINDOWPROP DATUM (QUOTE LINES)) (PUTWINDOWPROP DATUM 
+(QUOTE LINES) NEWVALUE)) (CLOSINGFILE (GETWINDOWPROP DATUM (QUOTE TEDIT-CLOSING-FILE)) (PUTWINDOWPROP 
+DATUM (QUOTE TEDIT-CLOSING-FILE) NIL)) (WITHINSCREEN (GETWINDOWPROP DATUM (QUOTE TEDIT-WITHIN-SCREEN))
+ (LET ((NV NEWVALUE)) (PUTWINDOWPROP DATUM (QUOTE TEDIT-WITHIN-SCREEN) NV) NV))))
 (DATATYPE PANE ((XPWINDOW FULLXPOINTER) PLINES PCARET HOLDDUMMYFIRSTLINE NEXTPANE (PREVPANE XPOINTER))
  (ACCESSFNS (PWINDOW (PROGN DATUM))))
 (PUTPROPS FGETPANE MACRO ((P FIELD) (ffetch (PANE FIELD) of P)))
@@ -519,7 +530,7 @@ TEDIT-WITHIN-SCREEN) NV) NV))))
 (PUTPROPS SETPANE MACRO ((P FIELD NEWVALUE) (replace (PANE FIELD) of P with NEWVALUE)))
 (PUTPROPS FSETPANE MACRO ((P FIELD NEWVALUE) (freplace (PANE FIELD) of P with NEWVALUE)))
 (I.S.OPR (QUOTE inpanes) NIL (QUOTE (inside (fetch (TEXTOBJ \WINDOW) of BODY))))
-(PUTPROP (QUOTE TEDIT-WINDOW) (QUOTE IMPORTDATE) (IDATE " 4-Mar-2024 15:15:31"))
+(PUTPROP (QUOTE TEDIT-WINDOW) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:16:27"))
 (TYPERECORD MB.3STATE ((* ;; "Describes a 3-state menu button.") MBLABEL (* ; 
 "Label for the button on the screen") MBFONT (* ; "Font the label text should appear in") 
 MBCHANGESTATEFN (* ; "Function to call when the button's state changes") MBINITSTATE (* ; 
@@ -541,10 +552,10 @@ IMAGEOBJPROP DATUM (QUOTE DISPLAYFN)) (QUOTE \TEXTMENU.TOGGLE.DISPLAY))))))
 (RECORD MARGINBAR (MARL1 MARLN MARR MARTABS MARUNIT MARTABTYPE) (TYPE? (AND (IMAGEOBJP DATUM) (EQ (
 IMAGEOBJPROP DATUM (QUOTE DISPLAYFN)) (QUOTE MB.MARGINBAR.DISPLAYFN)))))
 (RECORD TAB (TABX . TABKIND))
-(PUTPROP (QUOTE TEDIT-MENU) (QUOTE IMPORTDATE) (IDATE " 1-Mar-2024 20:35:49"))
-(PUTPROP (QUOTE TEDIT-FIND) (QUOTE IMPORTDATE) (IDATE " 3-Mar-2024 20:44:51"))
-(PUTPROP (QUOTE TEDIT-FNKEYS) (QUOTE IMPORTDATE) (IDATE " 3-Mar-2024 20:44:44"))
-(PUTPROP (QUOTE TEDIT-HCPY) (QUOTE IMPORTDATE) (IDATE "19-Jan-2024 23:19:53"))
+(PUTPROP (QUOTE TEDIT-MENU) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:06:06"))
+(PUTPROP (QUOTE TEDIT-FIND) (QUOTE IMPORTDATE) (IDATE "17-Mar-2024 12:06:12"))
+(PUTPROP (QUOTE TEDIT-FNKEYS) (QUOTE IMPORTDATE) (IDATE "15-Mar-2024 14:07:55"))
+(PUTPROP (QUOTE TEDIT-HCPY) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:05:37"))
 (DATATYPE TEDITHISTORYEVENT ((* ;; "Describes one event on the TEdit edit history list.") THACTION (* 
 ; "A keyword specifying what the event was") THPOINT (* ; "Was the selection to the left or right?") 
 THLEN (* ; "The # of chars involved") THCH# (* ; "The starting ch#") THFIRSTPIECE (* ; 
@@ -559,7 +570,7 @@ QUOTE TEDITHISTORYEVENT) (FUNCTION \TEDIT.HISTORYEVENT.DEFPRINT))) THPOINT _ (QU
 (PUTPROPS GETTH MACRO ((EVENT FIELD) (fetch (TEDITHISTORYEVENT FIELD) of EVENT)))
 (PUTPROPS SETTH MACRO ((EVENT FIELD NEWVALUE) (replace (TEDITHISTORYEVENT FIELD) of EVENT with 
 NEWVALUE)))
-(PUTPROP (QUOTE TEDIT-HISTORY) (QUOTE IMPORTDATE) (IDATE " 4-Mar-2024 21:33:56"))
+(PUTPROP (QUOTE TEDIT-HISTORY) (QUOTE IMPORTDATE) (IDATE "20-Mar-2024 11:05:20"))
 (RECORD PAGEFORMATTINGSTATE ((* ;; "Contains the state for a TEdit page-formatting job.") PAGE# (* ; 
 "The current page number.  Counted from 1") FIRSTPAGE (* ;; 
 "T if the current page is the 'first page' .  Is set initially, and can be set again by the user at will.  Gets reset after each page image is printed."
@@ -590,9 +601,9 @@ REGIONPARENT FULLXPOINTER) (* ; "The parent node for this box, for sub-boxes") R
 (PUTPROPS GETPFS MACRO ((FS FIELD) (fetch (PAGEFORMATTINGSTATE FIELD) of FS)))
 (PUTPROPS SETPFS MACRO ((FS FIELD NEWVALUE) (replace (PAGEFORMATTINGSTATE FIELD) of FS with NEWVALUE))
 )
-(PUTPROP (QUOTE TEDIT-PAGE) (QUOTE IMPORTDATE) (IDATE "16-Feb-2024 23:05:08"))
-(PUTPROP (QUOTE TEDIT-ABBREV) (QUOTE IMPORTDATE) (IDATE "12-Jun-2023 10:34:12"))
-(PUTPROP (QUOTE TEDIT-TFBRAVO) (QUOTE IMPORTDATE) (IDATE "17-Jan-2024 12:12:29"))
+(PUTPROP (QUOTE TEDIT-PAGE) (QUOTE IMPORTDATE) (IDATE "17-Mar-2024 18:15:40"))
+(PUTPROP (QUOTE TEDIT-ABBREV) (QUOTE IMPORTDATE) (IDATE "17-Mar-2024 18:15:40"))
+(PUTPROP (QUOTE TEDIT-TFBRAVO) (QUOTE IMPORTDATE) (IDATE "17-Mar-2024 18:27:18"))
 (DECLARE%: DONTCOPY
   (FILEMAP (NIL)))
 STOP
diff --git a/lispusers/DOC-OBJECTS b/lispusers/DOC-OBJECTS
index 1c5c4baf..7bbf658a 100644
--- a/lispusers/DOC-OBJECTS
+++ b/lispusers/DOC-OBJECTS
@@ -1,12 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "16-Feb-2024 23:54:59" {WMEDLEY}<lispusers>DOC-OBJECTS.;28 52405  
+(FILECREATED "27-Mar-2024 23:42:37" {WMEDLEY}<lispusers>DOC-OBJECTS.;36 52788  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS DOCOBJ-INCLUDE-BEFOREHARDCOPYFN)
+      :CHANGES-TO (FNS DOCOBJ-INCLUDE-EDIT-WINDOWP)
 
-      :PREVIOUS-DATE "11-Dec-2023 11:32:46" {WMEDLEY}<lispusers>DOC-OBJECTS.;27)
+      :PREVIOUS-DATE "19-Mar-2024 19:36:25" {WMEDLEY}<lispusers>DOC-OBJECTS.;35)
 
 
 (PRETTYCOMPRINT DOC-OBJECTSCOMS)
@@ -167,7 +167,8 @@
     (GET.OBJ.FROM.USER TEXTSTREAM (TEXTOBJ TEXTSTREAM])
 
 (DOCOBJ-GET-LOOKS
-  [LAMBDA (TEXTOBJ CH#ORCHARLOOKS)                           (* ; "Edited 29-Oct-2022 21:30 by rmk")
+  [LAMBDA (TEXTOBJ CH#ORCHARLOOKS)                           (* ; "Edited 19-Mar-2024 19:36 by rmk")
+                                                             (* ; "Edited 29-Oct-2022 21:30 by rmk")
                                                              (* Koomen " 4-Feb-87 23:37")
 
 (* ;;; "Adapted from {ERIS}<TEDIT>TEDITLOOKS.;30 dated '15-Oct-85 16:51:10' to return looks itself, rather than a proplist.")
@@ -179,23 +180,24 @@
              ((type? CHARLOOKS CH#ORCHARLOOKS)               (* ; 
                                                      "He handed us a CHARLOOKS.  Unparse it for him.")
               (SETQ LOOKS CH#ORCHARLOOKS))
-             ((ZEROP (fetch TEXTLEN of TEXTOBJ))             (* ; 
+             ((ZEROP (FGETTOBJ TEXTOBJ TEXTLEN))             (* ; 
                                       "There's no text in the document.  Use the extant caret looks.")
-              (SETQ LOOKS (fetch CARETLOOKS of TEXTOBJ)))
+              (SETQ LOOKS (FGETTOBJ TEXTOBJ CARETLOOKS)))
              [(FIXP CH#ORCHARLOOKS)                          (* ; 
                                                     "He gave us a CH# to get the looks of.  Grab it.")
-              (SETQ LOOKS (PLOOKS (\CHTOPC (IMIN (fetch TEXTLEN of TEXTOBJ)
-                                                 CH#ORCHARLOOKS)
+              (SETQ LOOKS (PLOOKS (\TEDIT.CHTOPC (IMIN (FGETTOBJ TEXTOBJ TEXTLEN)
+                                                       CH#ORCHARLOOKS)
                                          TEXTOBJ]
              [(type? SELECTION CH#ORCHARLOOKS)               (* ; 
                                                              "Get the looks of the selected text")
-              (SETQ LOOKS (PLOOKS (\CHTOPC (IMIN (fetch TEXTLEN of TEXTOBJ)
-                                                 (fetch (SELECTION CH#) of CH#ORCHARLOOKS))
+              (SETQ LOOKS (PLOOKS (\TEDIT.CHTOPC (IMIN (FGETTOBJ TEXTOBJ TEXTLEN)
+                                                       (GETSEL CH#ORCHARLOOKS CH#))
                                          TEXTOBJ]
              ((NULL CH#ORCHARLOOKS)                          (* ; 
                                                              "Get the looks of the selected text")
-              (SETQ LOOKS (PLOOKS (\CHTOPC (IMIN (fetch TEXTLEN of TEXTOBJ)
-                                                 (fetch (SELECTION CH#) of (fetch SEL of TEXTOBJ)))
+              (SETQ LOOKS (PLOOKS (\TEDIT.CHTOPC (IMIN (FGETTOBJ TEXTOBJ TEXTLEN)
+                                                       (GETSEL (FGETTOBJ TEXTOBJ SEL)
+                                                              CH#))
                                          TEXTOBJ]
           (RETURN LOOKS)
 
@@ -261,7 +263,8 @@
                     (APPLY* IMAGEOBJFN IMAGEOBJ CH# PIECE))))])
 
 (DOCOBJ-BEFOREHARDCOPYFN
-  [LAMBDA (TEXTSTREAM TEXTOBJ)                               (* ; "Edited 16-Jul-2023 16:53 by rmk")
+  [LAMBDA (TEXTSTREAM TEXTOBJ)                               (* ; "Edited 16-Mar-2024 10:05 by rmk")
+                                                             (* ; "Edited 16-Jul-2023 16:53 by rmk")
                                                              (* ; "Edited 10-Jul-2023 22:29 by rmk")
                                                              (* ; 
                                                         "Edited 25-May-93 13:07 by sybalsky:mv:envos")
@@ -276,13 +279,13 @@
                `(TEXTPROP ,TEXTOBJ 'DON'TUPDATE OLDVALUE))
         (LET ((PREVEVENTS (GETTOBJ TEXTOBJ TXTHISTORY))
               (OLDDIRTY (GETTOBJ TEXTOBJ \DIRTY))
-              (PREVSEL (\COPYSEL (TEXTSEL TEXTOBJ)))
+              (PREVSEL (\TEDIT.COPYSEL (TEXTSEL TEXTOBJ)))
               FAILED)
 
              (* ;; "This is a little tricky because the imageobj function may screw around with the piece containining the object, delete it or replace it with something else.  But presumably it links into the previous saved piece, and we continue from there.")
 
              [bind OBJ FN PREVPC (CH# _ 1)
-                   (PC _ (\FIRSTPIECE TEXTOBJ)) while PC
+                   (PC _ (\TEDIT.FIRSTPIECE TEXTOBJ)) while PC
                 do (SETQ PC (if (AND (EQ OBJECT.PTYPE (PTYPE PC))
                                      (SETQ OBJ (PCONTENTS PC))
                                      (SETQ FN (IMAGEOBJPROP OBJ 'BEFOREHARDCOPYFN))
@@ -304,14 +307,14 @@
                                                               "Otherwise investigate its replacement")
 
                                                                 PREVPC))
-                                       elseif (EQ PC (\FIRSTPIECE TEXTOBJ))
+                                       elseif (EQ PC (\TEDIT.FIRSTPIECE TEXTOBJ))
                                          then (add CH# (PLEN PC))
                                               (NEXTPIECE PC)
                                        else 
                                             (* ;; 
                                            "Investigate the replacement of the previous first piece.")
 
-                                            (\FIRSTPIECE TEXTOBJ))
+                                            (\TEDIT.FIRSTPIECE TEXTOBJ))
                               else (add CH# (PLEN PC))
                                    (NEXTPIECE PC]            (* ; "Restore previous settings")
                                                              (* ; 
@@ -326,14 +329,14 @@
              (* ;; "In case something screws up, at least redisplaying will show something correctly (even if we aren't \DIRTY)")
 
              (\TEDIT.MARK.LINES.DIRTY TEXTOBJ 1 (TEXTLEN TEXTOBJ))
-             (if FAILED
-                 then (DOCOBJ-AFTERHARDCOPYFN TEXTSTREAM TEXTOBJ) 
-                                                             (* ; "UNDO whatever was saved")
-                      (SETTOBJ TEXTOBJ SEL PREVSEL)
-                      'DON'T)))])
+             (CL:WHEN FAILED
+                 (DOCOBJ-AFTERHARDCOPYFN TEXTSTREAM TEXTOBJ) (* ; "UNDO whatever was saved")
+                 (SETTOBJ TEXTOBJ SEL PREVSEL)
+                 'DON'T)))])
 
 (DOCOBJ-AFTERHARDCOPYFN
-  [LAMBDA (TEXTSTREAM TEXTOBJ)                               (* ; "Edited 15-Jul-2023 15:57 by rmk")
+  [LAMBDA (TEXTSTREAM TEXTOBJ)                               (* ; "Edited 15-Mar-2024 14:24 by rmk")
+                                                             (* ; "Edited 15-Jul-2023 15:57 by rmk")
                                                              (* ; 
                                                         "Edited 25-May-93 13:08 by sybalsky:mv:envos")
     (RESETLST
@@ -343,7 +346,7 @@
              (TEDIT.UNDO TEXTOBJ)
              (SETTOBJ TEXTOBJ TXTHISTORYUNDONE PREVUNDONE)
              (\TEDIT.MARK.LINES.DIRTY TEXTOBJ 1 (TEXTLEN TEXTOBJ))
-             (TEDIT.UPDATE.SCREEN TEXTOBJ)))])
+             (\TEDIT.UPDATE.SCREEN TEXTOBJ)))])
 )
 
 
@@ -806,20 +809,19 @@
         NIL])
 
 (DOCOBJ-INCLUDE-EDIT-WINDOWP
-  [LAMBDA (FILENAME WINDOW)                                 (* ; "Edited 26-Oct-87 19:53 by Koomen")
-
-    (if (WINDOWP WINDOW)
-        then (OR (LET (TEXTOBJ TXTFILE)
-                      (if (AND (SETQ TEXTOBJ (WINDOWPROP WINDOW 'TEXTOBJ))
-                               (type? TEXTOBJ TEXTOBJ)
-                               (SETQ TXTFILE (fetch (TEXTOBJ TXTFILE) of TEXTOBJ))
+  [LAMBDA (FILENAME WINDOW)                                  (* ; "Edited 27-Mar-2024 23:42 by rmk")
+                                                            (* ; "Edited 26-Oct-87 19:53 by Koomen")
+    (CL:WHEN (WINDOWP WINDOW)
+        [OR (LET (TEXTOBJ TXTFILE)
+                 (CL:WHEN (AND (SETQ TEXTOBJ (TEXTOBJ WINDOW T))
+                               (SETQ TXTFILE (GETTOBJ TEXTOBJ TXTFILE))
                                (STREAMP TXTFILE)
                                (SETQ TXTFILE (FULLNAME TXTFILE))
                                (OR (STRINGP TXTFILE)
                                    (LITATOM TXTFILE))
                                (STRING-EQUAL FILENAME TXTFILE))
-                          then WINDOW))
-                 (DOCOBJ-INCLUDE-EDIT-WINDOWP FILENAME (WINDOWPROP WINDOW 'ICONFOR])
+                        WINDOW))
+            (DOCOBJ-INCLUDE-EDIT-WINDOWP FILENAME (WINDOWPROP WINDOW 'ICONFOR])])
 
 (DOCOBJ-INCLUDE-RESET-OBJ
   [LAMBDA (IMAGEOBJ)                                         (* ; "Edited 16-Jul-2023 10:02 by rmk")
@@ -892,7 +894,8 @@
            T])
 
 (DOCOBJ-INCLUDE-CLEANUPFN
-  [LAMBDA (TEXTSTREAM STARTPOS LEN)                          (* ; "Edited 11-Dec-2023 11:32 by rmk")
+  [LAMBDA (TEXTSTREAM STARTPOS LEN)                          (* ; "Edited 15-Mar-2024 14:08 by rmk")
+                                                             (* ; "Edited 11-Dec-2023 11:32 by rmk")
                                                              (* ; "Edited 22-Jun-2023 16:53 by rmk")
                                                              (* ; "Edited  6-Sep-2022 10:08 by rmk")
                                                              (* ; 
@@ -902,7 +905,7 @@
 
     (HELP "NOTUSED?" 'DOCOBJ-INCLUDE-CLEANUPFN)
     (LET ((TEXTOBJ (TEXTOBJ TEXTSTREAM)))
-         (for PC inselpieces (\SELPIECES STARTPOS (SUB1 (IPLUS STARTPOS LEN))
+         (for PC inselpieces (\TEDIT.SELPIECES STARTPOS (SUB1 (IPLUS STARTPOS LEN))
                                     TEXTOBJ) when (MEMB (PTYPE PC)
                                                         FILE.PTYPES) do (CLOSEF? (PCONTENTS PC)))
 
@@ -1008,30 +1011,30 @@
 (PUTPROPS DOC-OBJECTS MAKEFILE-ENVIRONMENT (:READTABLE "INTERLISP" :PACKAGE "INTERLISP" :BASE 10))
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (7686 20755 (DOCOBJ-ACQUIRE-OBJECT 7696 . 8697) (DOCOBJ-INIT 8699 . 9327) (
-DOCOBJ-TEDIT-MENU-ENTRY 9329 . 9751) (DOCOBJ-GET-LOOKS 9753 . 12253) (DOCOBJ-REGISTER-OBJECT 12255 . 
-12909) (DOCOBJ-STRING-IMAGEBOX 12911 . 13859) (DOCOBJ-WAIT-MOUSE 13861 . 14321) (
-DOCOBJ-INVOKE-IMAGEOBJFN 14323 . 15446) (DOCOBJ-BEFOREHARDCOPYFN 15448 . 20041) (
-DOCOBJ-AFTERHARDCOPYFN 20043 . 20753)) (20785 21052 (DOCOBJ-ACQUIRE-EVALED-OBJECT 20795 . 21050)) (
-21252 21394 (DOCOBJ-ACQUIRE-SNAPPED-OBJECT 21262 . 21392)) (21733 26529 (DOCOBJ-EDIT-TIMESTAMP 21743
- . 22272) (DOCOBJ-MAKE-TIMESTAMP 22274 . 22685) (DOCOBJ-MAKE-TIMESTAMP-IMAGEFNS 22687 . 23757) (
-DOCOBJ-TIMESTAMP-BUTTONEVENTINFN 23759 . 24290) (DOCOBJ-TIMESTAMP-COPYFN 24292 . 24617) (
-DOCOBJ-TIMESTAMP-DISPLAYFN 24619 . 24912) (DOCOBJ-TIMESTAMP-GETFN 24914 . 25154) (
-DOCOBJ-TIMESTAMP-IMAGEBOXFN 25156 . 25512) (DOCOBJ-TIMESTAMP-PREPRINTFN 25514 . 25745) (
-DOCOBJ-TIMESTAMP-PUTFN 25747 . 26116) (DOCOBJ-TIMESTAMP-TO-STRING 26118 . 26527)) (26823 31130 (
-DOCOBJ-MAKE-FILESTAMP 26833 . 27174) (DOCOBJ-MAKE-FILESTAMP-IMAGEFNS 27176 . 28218) (
-DOCOBJ-FILESTAMP-COPYFN 28220 . 28535) (DOCOBJ-FILESTAMP-DISPLAYFN 28537 . 28825) (
-DOCOBJ-FILESTAMP-GETFN 28827 . 29180) (DOCOBJ-FILESTAMP-IMAGEBOXFN 29182 . 29520) (
-DOCOBJ-FILESTAMP-GET-FULLNAME 29522 . 30140) (DOCOBJ-FILESTAMP-NEW-FULLNAME 30142 . 30615) (
-DOCOBJ-FILESTAMP-PREPRINTFN 30617 . 30826) (DOCOBJ-FILESTAMP-PUTFN 30828 . 31128)) (31453 33950 (
-DOCOBJ-MAKE-HRULE 31463 . 31877) (DOCOBJ-EDIT-HRULE 31879 . 32351) (DOCOBJ-HRULE-INIT 32353 . 32685) (
-DOCOBJ-HRULE-GET-WIDTH 32687 . 33498) (DOCOBJ-HRULE-BUTTONEVENTINFN 33500 . 33948)) (34369 43047 (
-DOCOBJ-MAKE-INCLUDE 34379 . 34780) (DOCOBJ-MAKE-INCLUDE-IMAGEFNS 34782 . 35787) (
-DOCOBJ-INCLUDE-CREATE-OBJ 35789 . 36557) (DOCOBJ-INCLUDE-EDIT 36559 . 41158) (
-DOCOBJ-INCLUDE-EDIT-WINDOWP 41160 . 42022) (DOCOBJ-INCLUDE-RESET-OBJ 42024 . 43045)) (43048 51864 (
-DOCOBJ-INCLUDE-BEFOREHARDCOPYFN 43058 . 46780) (DOCOBJ-INCLUDE-CLEANUPFN 46782 . 48186) (
-DOCOBJ-INCLUDE-BUTTONEVENTINFN 48188 . 48722) (DOCOBJ-INCLUDE-COPYFN 48724 . 48942) (
-DOCOBJ-INCLUDE-DISPLAYFN 48944 . 49696) (DOCOBJ-INCLUDE-GETFN 49698 . 50421) (
-DOCOBJ-INCLUDE-IMAGEBOXFN 50423 . 51432) (DOCOBJ-INCLUDE-PREPRINTFN 51434 . 51653) (
-DOCOBJ-INCLUDE-PUTFN 51655 . 51862)))))
+  (FILEMAP (NIL (7682 21029 (DOCOBJ-ACQUIRE-OBJECT 7692 . 8693) (DOCOBJ-INIT 8695 . 9323) (
+DOCOBJ-TEDIT-MENU-ENTRY 9325 . 9747) (DOCOBJ-GET-LOOKS 9749 . 12364) (DOCOBJ-REGISTER-OBJECT 12366 . 
+13020) (DOCOBJ-STRING-IMAGEBOX 13022 . 13970) (DOCOBJ-WAIT-MOUSE 13972 . 14432) (
+DOCOBJ-INVOKE-IMAGEOBJFN 14434 . 15557) (DOCOBJ-BEFOREHARDCOPYFN 15559 . 20205) (
+DOCOBJ-AFTERHARDCOPYFN 20207 . 21027)) (21059 21326 (DOCOBJ-ACQUIRE-EVALED-OBJECT 21069 . 21324)) (
+21526 21668 (DOCOBJ-ACQUIRE-SNAPPED-OBJECT 21536 . 21666)) (22007 26803 (DOCOBJ-EDIT-TIMESTAMP 22017
+ . 22546) (DOCOBJ-MAKE-TIMESTAMP 22548 . 22959) (DOCOBJ-MAKE-TIMESTAMP-IMAGEFNS 22961 . 24031) (
+DOCOBJ-TIMESTAMP-BUTTONEVENTINFN 24033 . 24564) (DOCOBJ-TIMESTAMP-COPYFN 24566 . 24891) (
+DOCOBJ-TIMESTAMP-DISPLAYFN 24893 . 25186) (DOCOBJ-TIMESTAMP-GETFN 25188 . 25428) (
+DOCOBJ-TIMESTAMP-IMAGEBOXFN 25430 . 25786) (DOCOBJ-TIMESTAMP-PREPRINTFN 25788 . 26019) (
+DOCOBJ-TIMESTAMP-PUTFN 26021 . 26390) (DOCOBJ-TIMESTAMP-TO-STRING 26392 . 26801)) (27097 31404 (
+DOCOBJ-MAKE-FILESTAMP 27107 . 27448) (DOCOBJ-MAKE-FILESTAMP-IMAGEFNS 27450 . 28492) (
+DOCOBJ-FILESTAMP-COPYFN 28494 . 28809) (DOCOBJ-FILESTAMP-DISPLAYFN 28811 . 29099) (
+DOCOBJ-FILESTAMP-GETFN 29101 . 29454) (DOCOBJ-FILESTAMP-IMAGEBOXFN 29456 . 29794) (
+DOCOBJ-FILESTAMP-GET-FULLNAME 29796 . 30414) (DOCOBJ-FILESTAMP-NEW-FULLNAME 30416 . 30889) (
+DOCOBJ-FILESTAMP-PREPRINTFN 30891 . 31100) (DOCOBJ-FILESTAMP-PUTFN 31102 . 31402)) (31727 34224 (
+DOCOBJ-MAKE-HRULE 31737 . 32151) (DOCOBJ-EDIT-HRULE 32153 . 32625) (DOCOBJ-HRULE-INIT 32627 . 32959) (
+DOCOBJ-HRULE-GET-WIDTH 32961 . 33772) (DOCOBJ-HRULE-BUTTONEVENTINFN 33774 . 34222)) (34643 43315 (
+DOCOBJ-MAKE-INCLUDE 34653 . 35054) (DOCOBJ-MAKE-INCLUDE-IMAGEFNS 35056 . 36061) (
+DOCOBJ-INCLUDE-CREATE-OBJ 36063 . 36831) (DOCOBJ-INCLUDE-EDIT 36833 . 41432) (
+DOCOBJ-INCLUDE-EDIT-WINDOWP 41434 . 42290) (DOCOBJ-INCLUDE-RESET-OBJ 42292 . 43313)) (43316 52247 (
+DOCOBJ-INCLUDE-BEFOREHARDCOPYFN 43326 . 47048) (DOCOBJ-INCLUDE-CLEANUPFN 47050 . 48569) (
+DOCOBJ-INCLUDE-BUTTONEVENTINFN 48571 . 49105) (DOCOBJ-INCLUDE-COPYFN 49107 . 49325) (
+DOCOBJ-INCLUDE-DISPLAYFN 49327 . 50079) (DOCOBJ-INCLUDE-GETFN 50081 . 50804) (
+DOCOBJ-INCLUDE-IMAGEBOXFN 50806 . 51815) (DOCOBJ-INCLUDE-PREPRINTFN 51817 . 52036) (
+DOCOBJ-INCLUDE-PUTFN 52038 . 52245)))))
 STOP
diff --git a/lispusers/DOC-OBJECTS.LCOM b/lispusers/DOC-OBJECTS.LCOM
index 53d2736c..7cf44377 100644
Binary files a/lispusers/DOC-OBJECTS.LCOM and b/lispusers/DOC-OBJECTS.LCOM differ
diff --git a/lispusers/TEDIT-PF-SEE b/lispusers/TEDIT-PF-SEE
index 93e89f3d..0a7e2421 100644
--- a/lispusers/TEDIT-PF-SEE
+++ b/lispusers/TEDIT-PF-SEE
@@ -1,12 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "25-Dec-2023 12:29:39" {WMEDLEY}<lispusers>TEDIT-PF-SEE.;118 8191   
+(FILECREATED "27-Mar-2024 23:45:38" {WMEDLEY}<lispusers>TEDIT-PF-SEE.;119 8322   
 
       :EDIT-BY rmk
 
       :CHANGES-TO (FNS PF-TEDIT)
 
-      :PREVIOUS-DATE " 5-Dec-2023 23:52:07" {WMEDLEY}<lispusers>TEDIT-PF-SEE.;117)
+      :PREVIOUS-DATE "25-Dec-2023 12:29:39" {WMEDLEY}<lispusers>TEDIT-PF-SEE.;118)
 
 
 (PRETTYCOMPRINT TEDIT-PF-SEECOMS)
@@ -23,7 +23,8 @@
 (DEFINEQ
 
 (PF-TEDIT
-  [LAMBDA (FN IFILES REPRINT)                                (* ; "Edited 25-Dec-2023 12:24 by rmk")
+  [LAMBDA (FN IFILES REPRINT)                                (* ; "Edited 27-Mar-2024 23:45 by rmk")
+                                                             (* ; "Edited 25-Dec-2023 12:24 by rmk")
                                                              (* ; "Edited  5-Dec-2023 23:50 by rmk")
                                                              (* ; "Edited 12-Oct-2023 00:19 by rmk")
                                                              (* ; "Edited 14-Sep-2023 22:33 by rmk")
@@ -65,7 +66,7 @@
                   THEN (SETQ TFPROP (LIST FN (CAR LOC)))
                        [SETQ WINDOW (FIND W IN (OPENWINDOWS)
                                        SUCHTHAT (AND (EQUAL TFPROP (WINDOWPROP W 'TF))
-                                                     (WINDOWPROP W 'TEXTOBJ]
+                                                     (fetch (TEXTWINDOW WTEXTSTREAM) of W]
                        (IF (AND WINDOW (NOT REPRINT))
                            THEN 
                                 (* ;; 
@@ -148,5 +149,5 @@
 (ADDTOVAR LAMA )
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (782 7671 (PF-TEDIT 792 . 7669)))))
+  (FILEMAP (NIL (782 7802 (PF-TEDIT 792 . 7800)))))
 STOP
diff --git a/lispusers/TEDIT-PF-SEE.LCOM b/lispusers/TEDIT-PF-SEE.LCOM
index ddda9c61..95a8b77b 100644
Binary files a/lispusers/TEDIT-PF-SEE.LCOM and b/lispusers/TEDIT-PF-SEE.LCOM differ
diff --git a/lispusers/TEDIT-PROCESS-KILLER.LCOM b/lispusers/TEDIT-PROCESS-KILLER.LCOM
index 6d0a82c6..963fd243 100644
Binary files a/lispusers/TEDIT-PROCESS-KILLER.LCOM and b/lispusers/TEDIT-PROCESS-KILLER.LCOM differ
diff --git a/lispusers/TEDITTALK b/lispusers/TEDITTALK
index 0677f1d5..42bdcefc 100644
--- a/lispusers/TEDITTALK
+++ b/lispusers/TEDITTALK
@@ -1,26 +1,32 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
-(FILECREATED "22-Jul-88 15:38:03" |{MCS:MCS:STANFORD}<LANE>TEDITTALK.;2| 24816  
 
-      previous date%: "13-Jun-88 16:35:46" |{MCS:MCS:STANFORD}<LANE>TEDITTALK.;1|)
+(FILECREATED "28-Mar-2024 00:03:10" {WMEDLEY}<lispusers>TEDITTALK.;2 24401  
+
+      :EDIT-BY rmk
+
+      :CHANGES-TO (VARS TEDITTALKCOMS)
+                  (FNS TALK.TEDIT.DISPLAY TALK.TEDIT.LISTEN)
+
+      :PREVIOUS-DATE "22-Jul-88 15:38:03" {WMEDLEY}<lispusers>TEDITTALK.;1)
 
 
 (PRETTYCOMPRINT TEDITTALKCOMS)
 
-(RPAQQ TEDITTALKCOMS 
-       [(* TALK TEdit Service)
+(RPAQQ TEDITTALKCOMS
+       [                                                     (* ; "TALK TEdit Service")
         (LOCALVARS . T)
         (FNS TALK.TEDIT.DISPLAY TALK.TEDIT.LISTEN TALK.TEDIT.CHARFN)
-        (* TALK TEdit hooks)
+                                                             (* ; "TALK TEdit hooks")
         (FNS TALK.TEDIT.USERFN TALK.TEDIT.INSERT TALK.SELFN TALK.SETSELFN TALK.IMAGEOBJFN 
              TALK.LOOKSFN TALK.PARAFN TALK.INSERTFN TALK.INCLUDEFN TALK.DELETEFN TALK.GETFN)
         (FNS TALK.TEDIT.BACKSPACE TALK.TEDIT.INCLUDE TALK.TEDIT.DELETE.TEXT TALK.TEDIT.GET 
              TALK.TEDIT.INSERT.TEXT TALK.TEDIT.SETSEL TALK.TEDIT.INSERT.OBJECT TALK.TEDIT.LOOKS 
              TALK.TEDIT.PARALOOKS TALK.TEDIT.DELETE)
         (FNS TALK.ENCODE.SEL TALK.DECODE.SEL)
-        (* TALK data)
+                                                             (* ; "TALK data")
         (VARS TALK.TEDIT.ACTIONS TALK.FROM.TEDIT.PROPS TALK.TO.TEDIT.PROPS)
         (GLOBALVARS TALK.TEDIT.ACTIONS TALK.TO.TEDIT.PROPS TALK.FROM.TEDIT.PROPS)
-        (* etc)
+                                                             (* ; "etc")
         (FILES TALK TEDIT)
         (APPENDVARS (GAP.SERVICETYPES (6 TEdit TALK.NS.SERVER))
                (TALK.SERVICETYPES (TEdit TALK.TEDIT.DISPLAY TALK.TEDIT.LISTEN)))
@@ -28,7 +34,7 @@
                         TEDIT.LOOKS TEDIT.PARALOOKS OPENFILE-IN-TEDIT.INCLUDE))
         (ADVISE * (PROGN TALK.TEDIT.ADVISEDFNS))
         (GLOBALVARS TALK.TEDIT.ADVISEDFNS)
-        (DECLARE%: DONTCOPY DOEVAL@COMPILE
+        (DECLARE%: DONTCOPY DOEVAL@COMPILE (FILES TEDIT-EXPORTS.ALL)
                (ALISTS (CHARACTERNAMES UNDO REDO NEXT MARGINS FONT SHIFT.UNDO SHIFT.REDO SHIFT.NEXT 
                               SHIFT.MARGINS SHIFT.FONT SHIFT.DEL)
                       (PRINTOUTMACROS .OP .FORCE)))
@@ -38,7 +44,7 @@
 
 
 
-(* TALK TEdit Service)
+(* ; "TALK TEdit Service")
 
 (DECLARE%: DOEVAL@COMPILE DONTCOPY
 
@@ -48,73 +54,70 @@
 
 (TALK.TEDIT.DISPLAY
   [LAMBDA (MAINWINDOW WINDOW INPUTSTREAM OUTPUTSTREAM PROTOCOL USER)
+                                                             (* ; "Edited 27-Mar-2024 23:55 by rmk")
                                                              (* ; "Edited  2-Jun-88 16:25 by cdl")
     (LET (TEXTOBJ)
          (TEDIT NIL MAINWINDOW NIL TALK.TO.TEDIT.PROPS)
-         (TEXTPROP (SETQ TEXTOBJ (WINDOWPROP MAINWINDOW 'TEXTOBJ))
-                'TALK OUTPUTSTREAM)
-         (with TEXTOBJ TEXTOBJ (SETQ TXTFILE (CONCAT "Talk with " USER)))
+         (SETQ TEXTOBJ (TEXTOBJ MAINWINDOW))
+         (TEXTPROP TEXTOBJ 'TALK OUTPUTSTREAM)
+         (SETTOBJ TEXTOBJ TXTFILE (CONCAT "Talk with " USER))
          (TEDIT.SETSEL (OPENTEXTSTREAM NIL WINDOW NIL NIL TALK.FROM.TEDIT.PROPS)
                 1 0 'LEFT)
          (WINDOWPROP WINDOW 'PROMPTWINDOW (WINDOWPROP MAINWINDOW 'PROMPTWINDOW])
 
 (TALK.TEDIT.LISTEN
   [LAMBDA (MAINWINDOW WINDOW INPUTSTREAM OUTPUTSTREAM PROTOCOLTYPE)
+                                                             (* ; "Edited 28-Mar-2024 00:01 by rmk")
                                                              (* ; "Edited  7-Jun-88 08:45 by cdl")
                                                              (* DECLARATIONS%: (RECORD ACTION
-                                                           (CCODES ACTIONFN TEXTOBJP)))
+                                                             (CCODES ACTIONFN TEXTOBJP)))
     (DECLARE (SPECVARS INPUTSTREAM))
     (PROG ((POSITION (create POSITION))
-           (TEXTOBJ (WINDOWPROP WINDOW 'TEXTOBJ))
-           (TEXTSTREAM (WINDOWPROP WINDOW 'TEXTSTREAM))
+           (TEXTSTREAM (TEXTSTREAM WINDOW))
            (SCRATCHPTR (ALLOCSTRING 0))
            (STRING (ALLOCSTRING 128))
            (EVENTFN (with TALK.PROTOCOLTYPE PROTOCOLTYPE TALK.EVENTFN))
-           STRINGSTREAM EOFPTR BYTE ACTION CCODE)
+           TEXTOBJ STRINGSTREAM EOFPTR BYTE ACTION CCODE)
+          (SETQ TEXTOBJ (fetch (TEXTSTREAM TEXTOBJ) of TEXTSTREAM))
           [SETQ EOFPTR (GETEOFPTR (SETQ STRINGSTREAM (OPENSTRINGSTREAM STRING 'BOTH]
           (while (OPENP TEXTSTREAM)
              do (APPLY* EVENTFN INPUTSTREAM OUTPUTSTREAM)
-                   (if (NOT (AND (OPENP INPUTSTREAM)
-                                     (OPENP OUTPUTSTREAM)))
-                       then (RETURN))
-                   (TALK.FLASH.CARET WINDOW POSITION 'OFF)
-                   (while (AND (OPENP INPUTSTREAM)
-                                   (READP INPUTSTREAM))
-                      do (SELCHARQ (SETQ BYTE (LOGAND (SETQ CCODE (READCCODE INPUTSTREAM))
-                                                         (MASK.1'S 0 8)))
-                                  (BS                        (* Flush text buffer)
-                                      (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM 
-                                             SCRATCHPTR)     (* the escape code)
-                                      (SETQ CCODE (LOGAND (SETQ CCODE (READCCODE INPUTSTREAM))
-                                                         (MASK.1'S 0 10)))
-                                      (if [SETQ ACTION (for ACTION in TALK.TEDIT.ACTIONS
-                                                              thereis (with ACTION ACTION
-                                                                                 (EQMEMB CCODE CCODES
-                                                                                        ]
-                                          then (with ACTION ACTION
-                                                          (APPLY* ACTIONFN
-                                                                 (if TEXTOBJP
-                                                                     then TEXTOBJ
-                                                                   else TEXTSTREAM)
-                                                                 INPUTSTREAM))))
-                                  (^G                        (* Flush text buffer)
-                                      (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM 
-                                             SCRATCHPTR)
-                                      (TALK.RINGBELLS WINDOW))
-                                  (if (LESSP CCODE (MASK.1'S 0 8))
-                                      then (PRINTCCODE CCODE STRINGSTREAM)
-                                            (if (LEQ EOFPTR (GETFILEPTR STRINGSTREAM))
-                                                then (TALK.TEDIT.INSERT TEXTSTREAM STRING 
-                                                                STRINGSTREAM SCRATCHPTR))
-                                    else (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM 
-                                                    SCRATCHPTR) 
-                                                             (* String streams don't handle NS 
-                                                           charaters so don't buffer)
-                                          (TALK.TEDIT.INSERT TEXTSTREAM CCODE)))
-                      finally (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM SCRATCHPTR))
-                   (TALK.FLASH.CARET WINDOW POSITION 'ON))
-          (if (SETQ TEXTOBJ (WINDOWPROP MAINWINDOW 'TEXTOBJ))
-              then (with TEXTOBJ TEXTOBJ (SETQ TXTFILE (CONCAT TXTFILE TALK.CLOSED.STRING])
+                (CL:UNLESS (AND (OPENP INPUTSTREAM)
+                                (OPENP OUTPUTSTREAM))
+                       (RETURN))
+                (TALK.FLASH.CARET WINDOW POSITION 'OFF)
+                (while (AND (OPENP INPUTSTREAM)
+                            (READP INPUTSTREAM))
+                   do (SELCHARQ (SETQ BYTE (LOGAND (SETQ CCODE (READCCODE INPUTSTREAM))
+                                                  (MASK.1'S 0 8)))
+                           (BS                               (* ; "Flush text buffer")
+                               (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM SCRATCHPTR)
+                                                             (* ; "the escape code")
+                               (SETQ CCODE (LOGAND (SETQ CCODE (READCCODE INPUTSTREAM))
+                                                  (MASK.1'S 0 10)))
+                               (if [SETQ ACTION (for ACTION in TALK.TEDIT.ACTIONS
+                                                   thereis (with ACTION ACTION (EQMEMB CCODE CCODES]
+                                   then (with ACTION ACTION (APPLY* ACTIONFN
+                                                                   (if TEXTOBJP
+                                                                       then TEXTOBJ
+                                                                     else TEXTSTREAM)
+                                                                   INPUTSTREAM))))
+                           (^G                               (* ; "Flush text buffer")
+                               (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM SCRATCHPTR)
+                               (TALK.RINGBELLS WINDOW))
+                           (if (LESSP CCODE (MASK.1'S 0 8))
+                               then (PRINTCCODE CCODE STRINGSTREAM)
+                                    (if (LEQ EOFPTR (GETFILEPTR STRINGSTREAM))
+                                        then (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM 
+                                                    SCRATCHPTR))
+                             else (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM SCRATCHPTR) 
+                                                             (* ; 
+                                           "String streams don't handle NS charaters so don't buffer")
+                                  (TALK.TEDIT.INSERT TEXTSTREAM CCODE)))
+                   finally (TALK.TEDIT.INSERT TEXTSTREAM STRING STRINGSTREAM SCRATCHPTR))
+                (TALK.FLASH.CARET WINDOW POSITION 'ON))
+          (CL:WHEN (SETQ TEXTOBJ (TEXTOBJ MAINWINDOW T))
+              (SETTOBJ TEXTOBJ TXTFILE (CONCAT TXTFILE TALK.CLOSED.STRING)))])
 
 (TALK.TEDIT.CHARFN
   [LAMBDA (TEXTOBJ CCODE)                                (* ; "Edited  9-Jun-88 15:06 by cdl")
@@ -144,7 +147,7 @@
 
 
 
-(* TALK TEdit hooks)
+(* ; "TALK TEdit hooks")
 
 (DEFINEQ
 
@@ -380,32 +383,33 @@
 
 
 
-(* TALK data)
+(* ; "TALK data")
 
 
-(RPAQQ TALK.TEDIT.ACTIONS ((8 TALK.TEDIT.BACKSPACE)
-                               (15 TALK.TEDIT.INCLUDE)
-                               (16 TALK.TEDIT.DELETE.TEXT)
-                               (17 TALK.TEDIT.GET TEXTOBJ)
-                               (18 TALK.TEDIT.INSERT.TEXT)
-                               (19 TALK.TEDIT.SETSEL)
-                               (20 TALK.TEDIT.INSERT.OBJECT)
-                               (21 TALK.TEDIT.LOOKS)
-                               (22 TALK.TEDIT.PARALOOKS)
-                               (23 \TEDIT.WORDDELETE TEXTOBJ)
-                               (127 TALK.TEDIT.DELETE)
-                               (516 TEDIT.UNDO TEXTOBJ)
-                               (520 TEDIT.REDO TEXTOBJ)
-                               (530 TEDIT.NEXT)))
+(RPAQQ TALK.TEDIT.ACTIONS
+       ((8 TALK.TEDIT.BACKSPACE)
+        (15 TALK.TEDIT.INCLUDE)
+        (16 TALK.TEDIT.DELETE.TEXT)
+        (17 TALK.TEDIT.GET TEXTOBJ)
+        (18 TALK.TEDIT.INSERT.TEXT)
+        (19 TALK.TEDIT.SETSEL)
+        (20 TALK.TEDIT.INSERT.OBJECT)
+        (21 TALK.TEDIT.LOOKS)
+        (22 TALK.TEDIT.PARALOOKS)
+        (23 \TEDIT.WORDDELETE TEXTOBJ)
+        (127 TALK.TEDIT.DELETE)
+        (516 TEDIT.UNDO TEXTOBJ)
+        (520 TEDIT.REDO TEXTOBJ)
+        (530 TEDIT.NEXT)))
 
 (RPAQQ TALK.FROM.TEDIT.PROPS (PROMPTWINDOW DON'T NOTITLE T COPYBYBKSYSBUF T MENU
-                                        ((Put 'Put NIL (SUBITEMS Plain-Text Old-Format))
-                                         Find Quit)))
+                                    ((Put 'Put NIL (SUBITEMS Plain-Text Old-Format))
+                                     Find Quit)))
 
-(RPAQQ TALK.TO.TEDIT.PROPS 
-       (CHARFN TALK.TEDIT.CHARFN SELFN TALK.SELFN GETFN TALK.GETFN IMAGEOBJFN TALK.IMAGEOBJFN LOOKSFN
-              TALK.LOOKSFN PARAFN TALK.PARAFN INSERTFN TALK.INSERTFN SETSELFN TALK.SETSELFN DELETEFN
-              TALK.DELETEFN INCLUDEFN TALK.INCLUDEFN NOTITLE T QUITFN TRUE COPYBYBKSYSBUF T))
+(RPAQQ TALK.TO.TEDIT.PROPS (CHARFN TALK.TEDIT.CHARFN SELFN TALK.SELFN GETFN TALK.GETFN IMAGEOBJFN 
+                                  TALK.IMAGEOBJFN LOOKSFN TALK.LOOKSFN PARAFN TALK.PARAFN INSERTFN 
+                                  TALK.INSERTFN SETSELFN TALK.SETSELFN DELETEFN TALK.DELETEFN 
+                                  INCLUDEFN TALK.INCLUDEFN NOTITLE T QUITFN TRUE COPYBYBKSYSBUF T))
 (DECLARE%: DOEVAL@COMPILE DONTCOPY
 
 (GLOBALVARS TALK.TEDIT.ACTIONS TALK.TO.TEDIT.PROPS TALK.FROM.TEDIT.PROPS)
@@ -413,7 +417,7 @@
 
 
 
-(* etc)
+(* ; "etc")
 
 
 (FILESLOAD TALK TEDIT)
@@ -423,26 +427,26 @@
 (APPENDTOVAR TALK.SERVICETYPES (TEdit TALK.TEDIT.DISPLAY TALK.TEDIT.LISTEN))
 
 (ADDTOVAR TALK.TEDIT.ADVISEDFNS TEDIT.SETSEL TEDIT.INSERT TEDIT.DELETE TEDIT.INSERT.OBJECT 
-                                          TEDIT.LOOKS TEDIT.PARALOOKS OPENFILE-IN-TEDIT.INCLUDE)
+                                      TEDIT.LOOKS TEDIT.PARALOOKS OPENFILE-IN-TEDIT.INCLUDE)
 
-[XCL:REINSTALL-ADVICE 'TEDIT.SETSEL :BEFORE '((:LAST (TALK.TEDIT.USERFN 'SETSELFN STREAM CH# LEN
+[XCL:REINSTALL-ADVICE 'TEDIT.SETSEL :BEFORE '((:LAST (TALK.TEDIT.USERFN 'SETSELFN STREAM CH# LEN 
                                                             POINT PENDINGDELFLG LEAVECARETLOOKS 
                                                             OPERATION]
 
 [XCL:REINSTALL-ADVICE 'TEDIT.INSERT :BEFORE '((:LAST (TALK.TEDIT.USERFN 'INSERTFN STREAM TEXT 
                                                             CH#ORSEL LOOKS DONTSCROLL]
 
-[XCL:REINSTALL-ADVICE 'TEDIT.DELETE :BEFORE '((:LAST (TALK.TEDIT.USERFN 'DELETEFN STREAM SEL LEN
+[XCL:REINSTALL-ADVICE 'TEDIT.DELETE :BEFORE '((:LAST (TALK.TEDIT.USERFN 'DELETEFN STREAM SEL LEN 
                                                             LEAVECARETLOOKS]
 
-[XCL:REINSTALL-ADVICE 'TEDIT.INSERT.OBJECT :BEFORE '((:LAST (TALK.TEDIT.USERFN 'IMAGEOBJFN STREAM
+[XCL:REINSTALL-ADVICE 'TEDIT.INSERT.OBJECT :BEFORE '((:LAST (TALK.TEDIT.USERFN 'IMAGEOBJFN STREAM 
                                                                    OBJECT CH#]
 
 [XCL:REINSTALL-ADVICE 'TEDIT.LOOKS :BEFORE '((:LAST (TALK.TEDIT.USERFN 'LOOKSFN STREAM NEWLOOKS 
                                                            SELORCH# LEN]
 
-[XCL:REINSTALL-ADVICE 'TEDIT.PARALOOKS :BEFORE '((:LAST (TALK.TEDIT.USERFN 'PARAFN TEXTOBJ 
-                                                               NEWLOOKS SEL LEN]
+[XCL:REINSTALL-ADVICE 'TEDIT.PARALOOKS :BEFORE '((:LAST (TALK.TEDIT.USERFN 'PARAFN TEXTOBJ NEWLOOKS 
+                                                               SEL LEN]
 
 [XCL:REINSTALL-ADVICE '(OPENFILE :IN TEDIT.INCLUDE)
        :BEFORE
@@ -456,27 +460,32 @@
 )
 (DECLARE%: DONTCOPY DOEVAL@COMPILE 
 
-(ADDTOVAR CHARACTERNAMES (UNDO 2,4)
-                             (REDO 2,10)
-                             (NEXT 2,22)
-                             (MARGINS 2,111)
-                             (FONT 2,112)
-                             (SHIFT.UNDO 2,44)
-                             (SHIFT.REDO 2,50)
-                             (SHIFT.NEXT 2,62)
-                             (SHIFT.MARGINS 2,151)
-                             (SHIFT.FONT 2,152)
-                             (SHIFT.DEL 2,27))
+(FILESLOAD TEDIT-EXPORTS.ALL)
 
-(ADDTOVAR PRINTOUTMACROS [.OP (LAMBDA (COMS)
-                                         (CONS `(PROGN (PRINTCCODE (CHARCODE BS)
-                                                              NIL)
-                                                       (PRINTCCODE ,(CADR COMS)
-                                                              NIL))
-                                               (CDDR COMS]
-                             [.FORCE (LAMBDA (COMS)
-                                            (CONS '(FORCEOUTPUT NIL)
-                                                  (CDR COMS])
+
+(ADDTOVAR CHARACTERNAMES
+          (UNDO 2,4)
+          (REDO 2,10)
+          (NEXT 2,22)
+          (MARGINS 2,111)
+          (FONT 2,112)
+          (SHIFT.UNDO 2,44)
+          (SHIFT.REDO 2,50)
+          (SHIFT.NEXT 2,62)
+          (SHIFT.MARGINS 2,151)
+          (SHIFT.FONT 2,152)
+          (SHIFT.DEL 2,27))
+
+(ADDTOVAR PRINTOUTMACROS
+          [.OP (LAMBDA (COMS)
+                      (CONS `(PROGN (PRINTCCODE (CHARCODE BS)
+                                           NIL)
+                                    (PRINTCCODE ,(CADR COMS)
+                                           NIL))
+                            (CDDR COMS]
+          [.FORCE (LAMBDA (COMS)
+                         (CONS '(FORCEOUTPUT NIL)
+                               (CDR COMS])
 )
 (DECLARE%: DONTEVAL@LOAD DOEVAL@COMPILE DONTCOPY COMPILERVARS 
 
@@ -487,14 +496,14 @@
 (ADDTOVAR LAMA TALK.TEDIT.USERFN)
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (2190 8573 (TALK.TEDIT.DISPLAY 2200 . 2844) (TALK.TEDIT.LISTEN 2846 . 7122) (
-TALK.TEDIT.CHARFN 7124 . 8571)) (8603 14772 (TALK.TEDIT.USERFN 8613 . 8921) (TALK.TEDIT.INSERT 8923 . 
-9559) (TALK.SELFN 9561 . 10339) (TALK.SETSELFN 10341 . 11199) (TALK.IMAGEOBJFN 11201 . 11779) (
-TALK.LOOKSFN 11781 . 12246) (TALK.PARAFN 12248 . 12709) (TALK.INSERTFN 12711 . 13231) (TALK.INCLUDEFN 
-13233 . 13664) (TALK.DELETEFN 13666 . 14239) (TALK.GETFN 14241 . 14770)) (14773 18681 (
-TALK.TEDIT.BACKSPACE 14783 . 15139) (TALK.TEDIT.INCLUDE 15141 . 15520) (TALK.TEDIT.DELETE.TEXT 15522
- . 15943) (TALK.TEDIT.GET 15945 . 16371) (TALK.TEDIT.INSERT.TEXT 16373 . 16830) (TALK.TEDIT.SETSEL 
-16832 . 17218) (TALK.TEDIT.INSERT.OBJECT 17220 . 17640) (TALK.TEDIT.LOOKS 17642 . 18047) (
-TALK.TEDIT.PARALOOKS 18049 . 18508) (TALK.TEDIT.DELETE 18510 . 18679)) (18682 20137 (TALK.ENCODE.SEL 
-18692 . 19545) (TALK.DECODE.SEL 19547 . 20135)))))
+  (FILEMAP (NIL (2574 8668 (TALK.TEDIT.DISPLAY 2584 . 3310) (TALK.TEDIT.LISTEN 3312 . 7217) (
+TALK.TEDIT.CHARFN 7219 . 8666)) (8702 14871 (TALK.TEDIT.USERFN 8712 . 9020) (TALK.TEDIT.INSERT 9022 . 
+9658) (TALK.SELFN 9660 . 10438) (TALK.SETSELFN 10440 . 11298) (TALK.IMAGEOBJFN 11300 . 11878) (
+TALK.LOOKSFN 11880 . 12345) (TALK.PARAFN 12347 . 12808) (TALK.INSERTFN 12810 . 13330) (TALK.INCLUDEFN 
+13332 . 13763) (TALK.DELETEFN 13765 . 14338) (TALK.GETFN 14340 . 14869)) (14872 18780 (
+TALK.TEDIT.BACKSPACE 14882 . 15238) (TALK.TEDIT.INCLUDE 15240 . 15619) (TALK.TEDIT.DELETE.TEXT 15621
+ . 16042) (TALK.TEDIT.GET 16044 . 16470) (TALK.TEDIT.INSERT.TEXT 16472 . 16929) (TALK.TEDIT.SETSEL 
+16931 . 17317) (TALK.TEDIT.INSERT.OBJECT 17319 . 17739) (TALK.TEDIT.LOOKS 17741 . 18146) (
+TALK.TEDIT.PARALOOKS 18148 . 18607) (TALK.TEDIT.DELETE 18609 . 18778)) (18781 20236 (TALK.ENCODE.SEL 
+18791 . 19644) (TALK.DECODE.SEL 19646 . 20234)))))
 STOP
diff --git a/lispusers/tedit-process-killer b/lispusers/tedit-process-killer
index c47bdf3e..8705f12b 100644
--- a/lispusers/tedit-process-killer
+++ b/lispusers/tedit-process-killer
@@ -1,18 +1,14 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED "20-Oct-2023 00:11:10" {WMEDLEY}<lispusers>tedit-process-killer.;2 16210  
+(FILECREATED "27-Mar-2024 23:52:57" {WMEDLEY}<lispusers>tedit-process-killer.;4 16479  
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS TEDIT-PROCESS-P)
+      :CHANGES-TO (FNS KILL-TEDIT-PROCESS MAKE-NEW-TEDIT-PROCESS TEDIT-KILLER-CLEANUP)
 
-      :PREVIOUS-DATE " 9-Mar-89 15:01:15" {WMEDLEY}<lispusers>tedit-process-killer.;1)
+      :PREVIOUS-DATE "20-Oct-2023 00:11:10" {WMEDLEY}<lispusers>tedit-process-killer.;2)
 
 
-(* ; "
-Copyright (c) 1987-1989 by Xerox Corporation.
-")
-
 (PRETTYCOMPRINT TEDIT-PROCESS-KILLERCOMS)
 
 (RPAQQ TEDIT-PROCESS-KILLERCOMS
@@ -233,75 +229,77 @@ Copyright (c) 1987-1989 by Xerox Corporation.
          (for W in (ATTACHEDWINDOWS WINDOW) do (KILL-PROCESS-OF-TEDIT-WINDOW1 W])
 
 (KILL-TEDIT-PROCESS
-  [LAMBDA (PROCESS)                                   (* ; "Edited 11-Dec-87 20:06 by Randy.Gobbel")
-          
-          (* ;; "Save the state that TEdit bashes, and then kill the process.  Only TEdits have TEXTOBJs, so this won't go killing other kinds of processes.  Won't kill if the TEdit is in the middle of an operation.")
-          
-          (* ;; "rrp 10/19/87: Now also saves TXTFILE property.")
+  [LAMBDA (PROCESS)                                          (* ; "Edited 27-Mar-2024 23:52 by rmk")
+                                                             (* ; 
+                                                             "Edited 11-Dec-87 20:06 by Randy.Gobbel")
 
-    (LET* [(WINDOW (PROCESSPROP PROCESS 'WINDOW))
-           (TEXTOBJ (WINDOWPROP WINDOW 'TEXTOBJ]
-          (COND
-             ((AND (WINDOWP WINDOW)
-                   TEXTOBJ
-                   (NOT (fetch (TEXTOBJ EDITOPACTIVE) of TEXTOBJ)))
+    (* ;; "Save the state that TEdit bashes, and then kill the process.  Only TEdits have TEXTOBJs, so this won't go killing other kinds of processes.  Won't kill if the TEdit is in the middle of an operation.")
+
+    (* ;; "rrp 10/19/87: Now also saves TXTFILE property.")
+
+    (LET* ((WINDOW (PROCESSPROP PROCESS 'WINDOW))
+           (TEXTOBJ (TEXTOBJ WINDOW T)))
+          (CL:WHEN (AND (WINDOWP WINDOW)
+                        TEXTOBJ
+                        (NOT (fetch (TEXTOBJ EDITOPACTIVE) of TEXTOBJ)))
               (WINDOWPROP WINDOW 'TXTHISTORY (fetch (TEXTOBJ TXTHISTORY) of TEXTOBJ))
               (WINDOWPROP WINDOW 'TXTFILE (fetch (TEXTOBJ TXTFILE) of TEXTOBJ))
-              (WINDOWPROP WINDOW 'SELWINDOW (fetch (TEXTOBJ SELWINDOW) of TEXTOBJ))
+              (WINDOWPROP WINDOW 'SELPANE (fetch (TEXTOBJ SELPANE) of TEXTOBJ))
               (WINDOWPROP WINDOW 'SAVEDPROCFORM (PROCESSPROP PROCESS 'FORM))
               (WINDOWPROP WINDOW 'SAVEDRESTARTFORM (PROCESSPROP PROCESS 'RESTARTFORM))
               (WINDOWPROP WINDOW 'SAVEDRESTARTABLE (PROCESSPROP PROCESS 'RESTARTABLE))
               (WINDOWPROP WINDOW 'SAVEDPROCNAME (PROCESSPROP PROCESS 'NAME))
-          
-          (* ;; 
-     "Mark the window so we know we can restart the process.  Atomic action to turn off the process.")
+
+              (* ;; 
+     "Mark the window so we know we can restart the process.  Atomic action to turn off the process.")
 
               (UNINTERRUPTABLY
                   (MARK-AS-WITHOUT-PROCESS WINDOW 'TEDIT)
-                  (DEL.PROCESS PROCESS))])
+                  (DEL.PROCESS PROCESS)))])
 
 (MAKE-NEW-TEDIT-PROCESS
-  [LAMBDA (WINDOW)                                    (* ; "Edited  9-Mar-89 14:58 by Randy.Gobbel")
+  [LAMBDA (WINDOW)                                           (* ; "Edited 27-Mar-2024 23:52 by rmk")
+                                                             (* ; 
+                                                             "Edited  9-Mar-89 14:58 by Randy.Gobbel")
 
-    (* ;; "This assumes that WINDOW really is the window of a restartable TEdit.")
+    (* ;; "This assumes that WINDOW really is the window of a restartable TEdit.")
 
-    (* ;; "Build a new TEdit process recovering saved PROCESSPROPs from the window.")
+    (* ;; "Build a new TEdit process recovering saved PROCESSPROPs from the window.")
 
-    (* ;; 
- "rht 2/9/87: Added a check that SAVEDPROCFORM of WINDOW is non-nil in case WINDOW just got smashed.")
+    (* ;; 
+ "rht 2/9/87: Added a check that SAVEDPROCFORM of WINDOW is non-nil in case WINDOW just got smashed.")
 
-    (* ;; 
-    "rht&sb 4/24/87: Now smashes windowprops after reading them by calling TEDIT-KILLER-CLEANUP.")
+    (* ;; 
+    "rht&sb 4/24/87: Now smashes windowprops after reading them by calling TEDIT-KILLER-CLEANUP.")
 
-    (* ;; "rrp 10/19/87: Now restores TXTFILE property as well.")
+    (* ;; "rrp 10/19/87: Now restores TXTFILE property as well.")
 
     (LET ((TEXTOBJ (TEXTOBJ WINDOW))
           (TXTFILE (WINDOWPROP WINDOW 'TXTFILE))
           PROCESS SAVEDPROCFORM)
          (replace (TEXTOBJ TXTHISTORY) of TEXTOBJ with (WINDOWPROP WINDOW 'TXTHISTORY))
-         (replace (TEXTOBJ SELWINDOW) of TEXTOBJ with (WINDOWPROP WINDOW 'SELWINDOW))
+         (replace (TEXTOBJ SELPANE) of TEXTOBJ with (WINDOWPROP WINDOW 'SELPANE))
          [if (AND TXTFILE (NOT (STREQUAL TXTFILE "")))
-             then (replace (TEXTOBJ TXTFILE) of TEXTOBJ with (OPENSTREAM (FULLNAME
-                                                                                          TXTFILE)
-                                                                                    'INPUT
-                                                                                    'OLD]
+             then (replace (TEXTOBJ TXTFILE) of TEXTOBJ with (OPENSTREAM (FULLNAME TXTFILE)
+                                                                    'INPUT
+                                                                    'OLD]
 
-         (* ;; "Atomic action to restore the process.")
+         (* ;; "Atomic action to restore the process.")
 
          (if (SETQ SAVEDPROCFORM (WINDOWPROP WINDOW 'SAVEDPROCFORM))
              then (UNINTERRUPTABLY
-                          [SETQ PROCESS (ADD.PROCESS SAVEDPROCFORM 'NAME
-                                               (LET* ((PROCNAME (WINDOWPROP WINDOW 'SAVEDPROCNAME))
-                                                      (POS (STRPOS "#" PROCNAME)))
-                                                     (OR (SUBSTRING PROCNAME 1 (AND POS (SUB1 POS)))
-                                                         PROCNAME))
-                                               'RESTARTABLE
-                                               (WINDOWPROP WINDOW 'SAVEDRESTARTABLE)
-                                               'RESTARTFORM
-                                               (WINDOWPROP WINDOW 'SAVEDRESTARTFORM]
-                          (TEDIT-KILLER-CLEANUP WINDOW)
-                          (PROCESSPROP PROCESS 'WINDOW WINDOW)
-                          (WINDOWPROP WINDOW 'PROCESS PROCESS)))
+                      [SETQ PROCESS (ADD.PROCESS SAVEDPROCFORM 'NAME
+                                           (LET* ((PROCNAME (WINDOWPROP WINDOW 'SAVEDPROCNAME))
+                                                  (POS (STRPOS "#" PROCNAME)))
+                                                 (OR (SUBSTRING PROCNAME 1 (AND POS (SUB1 POS)))
+                                                     PROCNAME))
+                                           'RESTARTABLE
+                                           (WINDOWPROP WINDOW 'SAVEDRESTARTABLE)
+                                           'RESTARTFORM
+                                           (WINDOWPROP WINDOW 'SAVEDRESTARTFORM]
+                      (TEDIT-KILLER-CLEANUP WINDOW)
+                      (PROCESSPROP PROCESS 'WINDOW WINDOW)
+                      (WINDOWPROP WINDOW 'PROCESS PROCESS)))
          PROCESS])
 
 (RESTART-PROCESS-OF-TEDIT-WINDOW1
@@ -314,15 +312,17 @@ Copyright (c) 1987-1989 by Xerox Corporation.
     (for W in (ATTACHEDWINDOWS WINDOW) do (RESTART-PROCESS-OF-TEDIT-WINDOW1 W])
 
 (TEDIT-KILLER-CLEANUP
-  [LAMBDA (WINDOW)                                    (* ; "Edited 11-Dec-87 20:13 by Randy.Gobbel")
-          
-          (* ;; "This unmarks the window and also throws away any cruft we left on windowprops.")
-          
-          (* ;; "rrp 10/19/87: Now trashes TXTFILE property as well.")
+  [LAMBDA (WINDOW)                                           (* ; "Edited 27-Mar-2024 23:52 by rmk")
+                                                             (* ; 
+                                                             "Edited 11-Dec-87 20:13 by Randy.Gobbel")
+
+    (* ;; "This unmarks the window and also throws away any cruft we left on windowprops.")
+
+    (* ;; "rrp 10/19/87: Now trashes TXTFILE property as well.")
 
     (WINDOWPROP WINDOW 'TXTHISTORY NIL)
     (WINDOWPROP WINDOW 'TXTFILE NIL)
-    (WINDOWPROP WINDOW 'SELWINDOW NIL)
+    (WINDOWPROP WINDOW 'SELPANE NIL)
     (WINDOWPROP WINDOW 'SAVEDPROCFORM NIL)
     (WINDOWPROP WINDOW 'SAVEDPROCNAME NIL)
     (WINDOWPROP WINDOW 'SAVEDRESTARTABLE NIL)
@@ -364,14 +364,13 @@ Copyright (c) 1987-1989 by Xerox Corporation.
 
 (START-TEDIT-KILLER)
 )
-(PUTPROPS TEDIT-PROCESS-KILLER COPYRIGHT ("Xerox Corporation" 1987 1988 1989))
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (3081 4855 (START-TEDIT-KILLER 3091 . 3581) (STOP-TEDIT-KILLER 3583 . 3974) (
-KILL-PROCESS-OF-TEDIT-WINDOW 3976 . 4283) (RESTART-PROCESS-OF-TEDIT-WINDOW 4285 . 4691) (
-WITHOUT-TEDIT-PROCESS 4693 . 4853)) (4906 7831 (TEDIT-KILLER 4916 . 6732) (
-\TEDIT.BUTTONEVENTFN-BEFORE-ADVICE 6734 . 7829)) (7832 8336 (MARK-AS-WITHOUT-PROCESS 7842 . 8014) (
-UNMARK-AS-WITHOUT-PROCESS 8016 . 8181) (WITHOUT-PROCESS 8183 . 8334)) (8337 14869 (ALL-TEDIT-PROCESSES
- 8347 . 8651) (TEDIT-PROCESS-P 8653 . 9449) (KILL-PROCESS-OF-TEDIT-WINDOW1 9451 . 9812) (
-KILL-TEDIT-PROCESS 9814 . 11369) (MAKE-NEW-TEDIT-PROCESS 11371 . 13811) (
-RESTART-PROCESS-OF-TEDIT-WINDOW1 13813 . 14209) (TEDIT-KILLER-CLEANUP 14211 . 14867)))))
+  (FILEMAP (NIL (3073 4847 (START-TEDIT-KILLER 3083 . 3573) (STOP-TEDIT-KILLER 3575 . 3966) (
+KILL-PROCESS-OF-TEDIT-WINDOW 3968 . 4275) (RESTART-PROCESS-OF-TEDIT-WINDOW 4277 . 4683) (
+WITHOUT-TEDIT-PROCESS 4685 . 4845)) (4898 7823 (TEDIT-KILLER 4908 . 6724) (
+\TEDIT.BUTTONEVENTFN-BEFORE-ADVICE 6726 . 7821)) (7824 8328 (MARK-AS-WITHOUT-PROCESS 7834 . 8006) (
+UNMARK-AS-WITHOUT-PROCESS 8008 . 8173) (WITHOUT-PROCESS 8175 . 8326)) (8329 15217 (ALL-TEDIT-PROCESSES
+ 8339 . 8643) (TEDIT-PROCESS-P 8645 . 9441) (KILL-PROCESS-OF-TEDIT-WINDOW1 9443 . 9804) (
+KILL-TEDIT-PROCESS 9806 . 11513) (MAKE-NEW-TEDIT-PROCESS 11515 . 13999) (
+RESTART-PROCESS-OF-TEDIT-WINDOW1 14001 . 14397) (TEDIT-KILLER-CLEANUP 14399 . 15215)))))
 STOP
diff --git a/lispusers/tmax/TMAX-DATE b/lispusers/tmax/TMAX-DATE
index 782d9b09..e7499d96 100644
--- a/lispusers/tmax/TMAX-DATE
+++ b/lispusers/tmax/TMAX-DATE
@@ -1,16 +1,13 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "XCL" BASE 10)
 
-(FILECREATED "17-Mar-2022 23:03:32" 
-|{DSK}<Users>kaplan>Local>medley3.5>my-medley>lispusers>TMAX-DATE.;3| 14993  
+(FILECREATED "16-Mar-2024 07:49:47" |{WMEDLEY}<lispusers>tmax>TMAX-DATE.;4| 14846  
 
-      :CHANGES-TO (VARS TMAX-DATECOMS)
-                  (FNS MAKE.DATEOBJ.IMAGEFNS)
+      :EDIT-BY |rmk|
 
-      :PREVIOUS-DATE "24-Oct-2021 13:52:22" 
-|{DSK}<Users>kaplan>Local>medley3.5>my-medley>lispusers>TMAX-DATE.;2|)
+      :CHANGES-TO (FNS DATE.GETFN)
 
+      :PREVIOUS-DATE "17-Mar-2022 23:03:32" |{WMEDLEY}<lispusers>tmax>TMAX-DATE.;3|)
 
-; Copyright (c) 1987-1988 by Xerox Corporation.
 
 (PRETTYCOMPRINT TMAX-DATECOMS)
 
@@ -104,12 +101,12 @@
     (prin2 (list '|Date| (|fetch| objectdatum |of| obj))
            stream)))
 
-(date.getfn
-  (lambda (stream copy.object)                               (* |fsg| "20-Aug-87 14:56")
-    (let ((window (|with| textobj textobj (car \\window))))
-         (tsp.setup.fmmenu window))
-    (apply (function dateobj)
-           (or copy.object (cadr (read stream))))))
+(DATE.GETFN
+  (LAMBDA (STREAM COPY.OBJECT)                              (* \; "Edited 16-Mar-2024 07:45 by rmk")
+                                                             (* |fsg| "20-Aug-87 14:56")
+    (TSP.SETUP.FMMENU (\\TEDIT.PRIMARYW TEXTOBJ))
+    (APPLY (FUNCTION DATEOBJ)
+           (OR COPY.OBJECT (CADR (READ STREAM))))))
 
 (date.copyfn
   (lambda (image.obj source.stream target.stream)            (* |fsg| "23-Jul-87 11:34")
@@ -352,12 +349,11 @@
 (RECORD DATERECORD (DATESTRING DISPLAY.DATE TEMPLATE.DATE))
 )
 )
-(PUTPROPS TMAX-DATE COPYRIGHT ("Xerox Corporation" 1987 1988))
 (DECLARE\: DONTCOPY
-  (FILEMAP (NIL (1517 6251 (DATEOBJ 1527 . 2294) (DATEOBJP 2296 . 2730) (DATE.DISPLAYFN 2732 . 3054) (
-DATE.IMAGEBOXFN 3056 . 3683) (DATE.PUTFN 3685 . 3883) (DATE.GETFN 3885 . 4179) (DATE.COPYFN 4181 . 
-4713) (DATE.BUTTONEVENTINFN 4715 . 6249)) (6295 8948 (CURRENT.DISPLAY.FONT 6305 . 7011) (
-CHANGE.DATE.FORMAT 7013 . 8946)) (9001 13400 (FINDTIME 9011 . 10790) (FINDHOUR 10792 . 11153) (AMPM 
-11155 . 11454) (FINDDAY 11456 . 11727) (NUMP 11729 . 11958) (FINDMONTH 11960 . 13076) (FINDYEAR 13078
- . 13398)) (14112 14678 (MAKE.DATEOBJ.IMAGEFNS 14122 . 14676)))))
+  (FILEMAP (NIL (1378 6167 (DATEOBJ 1388 . 2155) (DATEOBJP 2157 . 2591) (DATE.DISPLAYFN 2593 . 2915) (
+DATE.IMAGEBOXFN 2917 . 3544) (DATE.PUTFN 3546 . 3744) (DATE.GETFN 3746 . 4095) (DATE.COPYFN 4097 . 
+4629) (DATE.BUTTONEVENTINFN 4631 . 6165)) (6211 8864 (CURRENT.DISPLAY.FONT 6221 . 6927) (
+CHANGE.DATE.FORMAT 6929 . 8862)) (8917 13316 (FINDTIME 8927 . 10706) (FINDHOUR 10708 . 11069) (AMPM 
+11071 . 11370) (FINDDAY 11372 . 11643) (NUMP 11645 . 11874) (FINDMONTH 11876 . 12992) (FINDYEAR 12994
+ . 13314)) (14028 14594 (MAKE.DATEOBJ.IMAGEFNS 14038 . 14592)))))
 STOP
diff --git a/lispusers/tmax/TMAX-DATE.LCOM b/lispusers/tmax/TMAX-DATE.LCOM
index d0c6f211..c26862d8 100644
Binary files a/lispusers/tmax/TMAX-DATE.LCOM and b/lispusers/tmax/TMAX-DATE.LCOM differ
diff --git a/lispusers/tmax/TMAX-ENDNOTE b/lispusers/tmax/TMAX-ENDNOTE
index 6710d5df..fefcb004 100644
--- a/lispusers/tmax/TMAX-ENDNOTE
+++ b/lispusers/tmax/TMAX-ENDNOTE
@@ -1,15 +1,13 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "XCL" BASE 10)
 
-(FILECREATED "26-Jun-2022 18:15:33" 
-|{DSK}<users>kaplan>local>medley3.5>working-medley>lispusers>TMAX>TMAX-ENDNOTE.;3| 23863  
+(FILECREATED "16-Mar-2024 07:49:47" |{WMEDLEY}<lispusers>tmax>TMAX-ENDNOTE.;4| 23729  
 
-      :CHANGES-TO (FNS REGMARK.PUTFN REGMARK.BUTTONEVENTINFN)
+      :EDIT-BY |rmk|
 
-      :PREVIOUS-DATE "18-Mar-2022 07:12:34" 
-|{DSK}<users>kaplan>local>medley3.5>working-medley>lispusers>TMAX>TMAX-ENDNOTE.;2|)
+      :CHANGES-TO (FNS REGMARK.GETFN)
 
+      :PREVIOUS-DATE "26-Jun-2022 18:15:33" |{WMEDLEY}<lispusers>tmax>TMAX-ENDNOTE.;3|)
 
-; Copyright (c) 1987 by Xerox Corporation.
 
 (PRETTYCOMPRINT TMAX-ENDNOTECOMS)
 
@@ -388,12 +386,12 @@
                  (|fetch| (REGMARKOBJ MARKING) |of| (|fetch| OBJECTDATUM |of| MARKOBJ)))
            STREAM)))
 
-(regmark.getfn
-  (lambda (stream copy.object)                               (* |fsg| "20-Aug-87 14:58")
-    (let ((window (|with| textobj textobj (car \\window))))
-         (tsp.setup.fmmenu window))
-    (apply (function regmarkobj)
-           (or copy.object (cdr (read stream))))))
+(REGMARK.GETFN
+  (LAMBDA (STREAM COPY.OBJECT)                              (* \; "Edited 16-Mar-2024 07:45 by rmk")
+                                                             (* |fsg| "20-Aug-87 14:58")
+    (TSP.SETUP.FMMENU (\\TEDIT.PRIMARYW TEXTOBJ))
+    (APPLY (FUNCTION REGMARKOBJ)
+           (OR COPY.OBJECT (CDR (READ STREAM))))))
 
 (regmark.copyfn
   (lambda (image.obj source.stream target.stream)            (* |fsg| "23-Jul-87 14:09")
@@ -447,15 +445,14 @@
 (RECORD REGMARKOBJ (REGION.USE MARKING))
 )
 )
-(PUTPROPS TMAX-ENDNOTE COPYRIGHT ("Xerox Corporation" 1987))
 (DECLARE\: DONTCOPY
-  (FILEMAP (NIL (2529 12156 (ADD.ENDNOTE 2539 . 3207) (INSERT.ENDNOTES 3209 . 5412) (
-INSERT.ENDNOTES.TEXT 5414 . 6843) (DELETE.ENDNOTES 6845 . 7836) (NOTESREGIONP 7838 . 8100) (
-SET.ENDNOTE.STYLE 8102 . 10775) (MAP.ENDNOTE.LOOKS 10777 . 11544) (GET.ENDNOTE.FONTS 11546 . 12154)) (
-12157 16072 (ENDNOTEP 12167 . 12508) (NOTE.PUTFN 12510 . 13162) (NOTE.GETFN 13164 . 13744) (
-NOTE.BUTTONEVENTINFN 13746 . 14526) (NOTE.WHENSELECTEDFN 14528 . 16070)) (16830 19234 (AUX.TEDIT 16840
- . 17802) (AUX.TEDIT.AFTERQUITFN 17804 . 18247) (AUX.TEDIT.TITLEMENUFN 18249 . 19232)) (19319 23162 (
-REGMARKOBJ 19329 . 19736) (REGMARKOBJP 19738 . 19932) (REGMARK.DISPLAYFN 19934 . 20180) (
-REGMARK.IMAGEBOXFN 20182 . 20533) (REGMARK.PUTFN 20535 . 21006) (REGMARK.GETFN 21008 . 21307) (
-REGMARK.COPYFN 21309 . 21847) (REGMARK.BUTTONEVENTINFN 21849 . 23160)))))
+  (FILEMAP (NIL (2401 12028 (ADD.ENDNOTE 2411 . 3079) (INSERT.ENDNOTES 3081 . 5284) (
+INSERT.ENDNOTES.TEXT 5286 . 6715) (DELETE.ENDNOTES 6717 . 7708) (NOTESREGIONP 7710 . 7972) (
+SET.ENDNOTE.STYLE 7974 . 10647) (MAP.ENDNOTE.LOOKS 10649 . 11416) (GET.ENDNOTE.FONTS 11418 . 12026)) (
+12029 15944 (ENDNOTEP 12039 . 12380) (NOTE.PUTFN 12382 . 13034) (NOTE.GETFN 13036 . 13616) (
+NOTE.BUTTONEVENTINFN 13618 . 14398) (NOTE.WHENSELECTEDFN 14400 . 15942)) (16702 19106 (AUX.TEDIT 16712
+ . 17674) (AUX.TEDIT.AFTERQUITFN 17676 . 18119) (AUX.TEDIT.TITLEMENUFN 18121 . 19104)) (19191 23089 (
+REGMARKOBJ 19201 . 19608) (REGMARKOBJP 19610 . 19804) (REGMARK.DISPLAYFN 19806 . 20052) (
+REGMARK.IMAGEBOXFN 20054 . 20405) (REGMARK.PUTFN 20407 . 20878) (REGMARK.GETFN 20880 . 21234) (
+REGMARK.COPYFN 21236 . 21774) (REGMARK.BUTTONEVENTINFN 21776 . 23087)))))
 STOP
diff --git a/lispusers/tmax/TMAX-ENDNOTE.LCOM b/lispusers/tmax/TMAX-ENDNOTE.LCOM
index 5b834c8a..e41e9d7f 100644
Binary files a/lispusers/tmax/TMAX-ENDNOTE.LCOM and b/lispusers/tmax/TMAX-ENDNOTE.LCOM differ
diff --git a/lispusers/tmax/TMAX-INDEX b/lispusers/tmax/TMAX-INDEX
index 2391a451..2dc053c1 100644
--- a/lispusers/tmax/TMAX-INDEX
+++ b/lispusers/tmax/TMAX-INDEX
@@ -1,72 +1,74 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "XCL" BASE 10)
-(FILECREATED "20-Feb-97 17:58:09" |{DSK}<project>medley2.0>lispusers>TMAX-INDEX.;38| 46100  
 
-      |changes| |to:|  (FNS WRITE.INDEX.FILE INDEX.BUTTONEVENTINFN)
+(FILECREATED "16-Mar-2024 07:51:29" |{WMEDLEY}<lispusers>tmax>TMAX-INDEX.;4| 46587  
 
-      |previous| |date:| "19-Feb-97 21:51:43" |{DSK}<project>medley2.0>lispusers>TMAX-INDEX.;36|)
+      :EDIT-BY |rmk|
 
+      :CHANGES-TO (VARS TMAX-INDEXCOMS)
+                  (FNS INDEX.DISPLAYFN)
+
+      :PREVIOUS-DATE "20-Feb-97 17:58:09" |{WMEDLEY}<lispusers>tmax>TMAX-INDEX.;1|)
 
-; Copyright (c) 1987, 1997 by Xerox Corporation.  All rights reserved.
 
 (PRETTYCOMPRINT TMAX-INDEXCOMS)
 
 (RPAQQ TMAX-INDEXCOMS
        (
-        (* |;;| "Developed under support from NIH grant RR-00785.")
+        (* |;;| "Developed under support from NIH grant RR-00785.")
 
         
-        (* |;;| "Written by Frank Gilmurray and Sami Shaio.  Modified by Ron Kaplan")
+        (* |;;| "Written by Frank Gilmurray and Sami Shaio.  Modified by Ron Kaplan")
 
         
-        (* |;;| "INDEX objects are simply inserted into the text stream.  Information about them is accumulated only when the displayfn is applied to a hardcopy imagestream, and it is accumulated as a property of the imagestream.")
+        (* |;;| "INDEX objects are simply inserted into the text stream.  Information about them is accumulated only when the displayfn is applied to a hardcopy imagestream, and it is accumulated as a property of the imagestream.")
 
         
 
-(* |;;;| "TMAX-INDEX ImageObject functions")
+(* |;;;| "TMAX-INDEX ImageObject functions")
 
         (INITVARS (INDEXDISPLAYAPPEARANCE 'BOX))
         (FNS INDEXOBJ INDEXOBJP INDEX.DISPLAYFN INDEX.IMAGEBOXFN INDEX.PUTFN INDEX.GETFN INDEX.COPYFN
              INDEX.BUTTONEVENTINFN)
         
 
-(* |;;;| "Inserting indices")
+(* |;;;| "Inserting indices")
 
         (FNS INSERT.INDEX INSERT.INDEXENTRY INSERT.KNOWN.INDEX SUBITEM.SELECTFN ADD.NEW.INDEX)
         
 
-(* |;;;| "Functions to change the Index/Extended Index")
+(* |;;;| "Functions to change the Index/Extended Index")
 
         (FNS CHANGE.INDEX CHANGE.INDEXENTRY CHANGE.XINDEX.KEY CHANGE.XINDEX.ENTRY CHANGE.XINDEX.FONT
              CHANGE.XINDEX.NUMBER)
         
 
-(* |;;;| "Other misc functions")
+(* |;;;| "Other misc functions")
 
         (FNS GETHASH.INDEX INDEX.PAGE.NUMBER INDEX.MANUAL.DELIMITER INDEX.STRING 
              GET.INDEXENTRY.NUMBER INDEX.LIST.REFS LIST.OF.INDEXENTRIES)
         
 
-(* |;;;| "Index file functions")
+(* |;;;| "Index file functions")
 
         (FNS CREATE.INDEX.FILE DUMP.INDEX VIEW.INDEX.FILE GET.INDEX.FILE WRITE.INDEX.FILE 
              WRITE.INDEX.PAGENUMBERS RESET.INDEX.PAGENUMBERS)
         (RECORDS INDEX.ENTRY.RECORD)
         
 
-(* |;;;| "Convenient interface--depress the props key to index the current selection")
+(* |;;;| "Convenient interface--depress the props key to index the current selection")
 
         (FNS SELECTION.TO.STRING SELECTION.TO.INDEX)
         (MACROS MAKE.INDEXOBJ.IMAGEFNS)
         (VARS (\\INDEXOBJ.IMAGEFNS (MAKE.INDEXOBJ.IMAGEFNS)))
         (ADDVARS (IMAGEOBJGETFNS (INDEX.GETFN)))
-        (P                                                   (* \; 
-                                                           "533 is the PROPS key on Sun keyboards")
-           (TEDIT.SETSYNTAX 533 'FN TEDIT.READTABLE)
-           (TEDIT.SETFUNCTION 533 (FUNCTION SELECTION.TO.INDEX)
+        (P                                                   (* \; 
+                                                             "533 is the PROPS key on Sun keyboards")
+           (TEDIT.SETSYNTAX "Function,^U" 'FN TEDIT.READTABLE)
+           (TEDIT.SETFUNCTION "Function,^U" (FUNCTION SELECTION.TO.INDEX)
                   TEDIT.READTABLE))
         
 
-(* |;;;| "IMAGE OBJECT for causing the index to be written, without using the menu")
+(* |;;;| "IMAGE OBJECT for causing the index to be written, without using the menu")
 ))
 
 
@@ -121,10 +123,11 @@
                  'indexobj))))
 
 (INDEX.DISPLAYFN
-  (LAMBDA (OBJ IMAGESTREAM)                              (* \; "Edited 14-Feb-97 09:30 by rmk:")
-                                                             (* |fsg| "17-Sep-87 11:14")
+  (LAMBDA (OBJ IMAGESTREAM)                                 (* \; "Edited 16-Mar-2024 07:46 by rmk")
+                                                             (* \; "Edited 14-Feb-97 09:30 by rmk:")
+                                                             (* |fsg| "17-Sep-87 11:14")
 
-    (* |;;| "Display an Index imageobject.  If the stream-type is display, then just type Index or Extended Index followed by their args.  Otherwise the stream-type is hardcopy.  In this case, type nothing and replace the CAR of the hash array entry with a list of page numbers in which this index appears.")
+    (* |;;| "Display an Index imageobject.  If the stream-type is display, then just type Index or Extended Index followed by their args.  Otherwise the stream-type is hardcopy.  In this case, type nothing and replace the CAR of the hash array entry with a list of page numbers in which this index appears.")
 
     (SELECTQ (IMAGESTREAMTYPE IMAGESTREAM)
         (DISPLAY (CL:UNLESS (EQ 'INVISIBLE INDEXDISPLAYAPPEARANCE)
@@ -136,7 +139,7 @@
                                 (PRIN3 (INDEX.STRING OBJ)
                                        IMAGESTREAM)))))
         (LET ((PGS/IMOBJS (GETHASH.INDEX OBJ IMAGESTREAM))
-              (CURRENT.PAGE (INDEX.PAGE.NUMBER (WITH TEXTOBJ TEXTOBJ (CAR \\WINDOW)))))
+              (CURRENT.PAGE (INDEX.PAGE.NUMBER (\\TEDIT.PRIMARYW TEXTOBJ))))
              (COND
                 ((LISTP (CAR PGS/IMOBJS))
                  (OR (MEMB CURRENT.PAGE (CAR PGS/IMOBJS))
@@ -830,52 +833,50 @@
 )
 (DECLARE\: EVAL@COMPILE 
 
-(PUTPROPS MAKE.INDEXOBJ.IMAGEFNS  MACRO
-   (LAMBDA NIL
-     (IMAGEFNSCREATE (FUNCTION INDEX.DISPLAYFN)
-            (FUNCTION INDEX.IMAGEBOXFN)
-            (FUNCTION INDEX.PUTFN)
-            (FUNCTION INDEX.GETFN)
-            (FUNCTION INDEX.COPYFN)
-            (FUNCTION INDEX.BUTTONEVENTINFN)
-            (FUNCTION NILL)
-            (FUNCTION NILL)
-            (FUNCTION NILL)
-            (FUNCTION NILL)
-            (FUNCTION NILL)
-            (FUNCTION NILL)
-            (FUNCTION NILL))))
+(PUTPROPS MAKE.INDEXOBJ.IMAGEFNS MACRO (LAMBDA NIL
+                                         (IMAGEFNSCREATE (FUNCTION INDEX.DISPLAYFN)
+                                                (FUNCTION INDEX.IMAGEBOXFN)
+                                                (FUNCTION INDEX.PUTFN)
+                                                (FUNCTION INDEX.GETFN)
+                                                (FUNCTION INDEX.COPYFN)
+                                                (FUNCTION INDEX.BUTTONEVENTINFN)
+                                                (FUNCTION NILL)
+                                                (FUNCTION NILL)
+                                                (FUNCTION NILL)
+                                                (FUNCTION NILL)
+                                                (FUNCTION NILL)
+                                                (FUNCTION NILL)
+                                                (FUNCTION NILL))))
 )
 
 (RPAQ \\INDEXOBJ.IMAGEFNS (MAKE.INDEXOBJ.IMAGEFNS))
 
 (ADDTOVAR IMAGEOBJGETFNS (INDEX.GETFN))
 
-                                                             (* \; 
-                                                           "533 is the PROPS key on Sun keyboards")
+                                                             (* \; 
+                                                             "533 is the PROPS key on Sun keyboards")
 
-(TEDIT.SETSYNTAX 533 'FN TEDIT.READTABLE)
+(TEDIT.SETSYNTAX "Function,^U" 'FN TEDIT.READTABLE)
 
-(TEDIT.SETFUNCTION 533 (FUNCTION SELECTION.TO.INDEX)
+(TEDIT.SETFUNCTION "Function,^U" (FUNCTION SELECTION.TO.INDEX)
        TEDIT.READTABLE)
 
 
 
 (* |;;;| "IMAGE OBJECT for causing the index to be written, without using the menu")
 
-(PUTPROPS TMAX-INDEX COPYRIGHT ("Xerox Corporation" 1987 1997))
 (DECLARE\: DONTCOPY
-  (FILEMAP (NIL (3149 10825 (INDEXOBJ 3159 . 4182) (INDEXOBJP 4184 . 4632) (INDEX.DISPLAYFN 4634 . 6204)
- (INDEX.IMAGEBOXFN 6206 . 7752) (INDEX.PUTFN 7754 . 8184) (INDEX.GETFN 8186 . 8577) (INDEX.COPYFN 8579
- . 9214) (INDEX.BUTTONEVENTINFN 9216 . 10823)) (10864 18737 (INSERT.INDEX 10874 . 11461) (
-INSERT.INDEXENTRY 11463 . 14230) (INSERT.KNOWN.INDEX 14232 . 16309) (SUBITEM.SELECTFN 16311 . 17305) (
-ADD.NEW.INDEX 17307 . 18735)) (18803 22734 (CHANGE.INDEX 18813 . 19381) (CHANGE.INDEXENTRY 19383 . 
-20133) (CHANGE.XINDEX.KEY 20135 . 20693) (CHANGE.XINDEX.ENTRY 20695 . 21328) (CHANGE.XINDEX.FONT 21330
- . 22199) (CHANGE.XINDEX.NUMBER 22201 . 22732)) (22776 30497 (GETHASH.INDEX 22786 . 23453) (
-INDEX.PAGE.NUMBER 23455 . 25034) (INDEX.MANUAL.DELIMITER 25036 . 25727) (INDEX.STRING 25729 . 26739) (
-GET.INDEXENTRY.NUMBER 26741 . 27761) (INDEX.LIST.REFS 27763 . 29253) (LIST.OF.INDEXENTRIES 29255 . 
-30495)) (30539 40743 (CREATE.INDEX.FILE 30549 . 32428) (DUMP.INDEX 32430 . 34850) (VIEW.INDEX.FILE 
-34852 . 36116) (GET.INDEX.FILE 36118 . 36508) (WRITE.INDEX.FILE 36510 . 38911) (
-WRITE.INDEX.PAGENUMBERS 38913 . 40113) (RESET.INDEX.PAGENUMBERS 40115 . 40741)) (40941 44995 (
-SELECTION.TO.STRING 40951 . 43783) (SELECTION.TO.INDEX 43785 . 44993)))))
+  (FILEMAP (NIL (3112 10886 (INDEXOBJ 3122 . 4145) (INDEXOBJP 4147 . 4595) (INDEX.DISPLAYFN 4597 . 6265)
+ (INDEX.IMAGEBOXFN 6267 . 7813) (INDEX.PUTFN 7815 . 8245) (INDEX.GETFN 8247 . 8638) (INDEX.COPYFN 8640
+ . 9275) (INDEX.BUTTONEVENTINFN 9277 . 10884)) (10925 18798 (INSERT.INDEX 10935 . 11522) (
+INSERT.INDEXENTRY 11524 . 14291) (INSERT.KNOWN.INDEX 14293 . 16370) (SUBITEM.SELECTFN 16372 . 17366) (
+ADD.NEW.INDEX 17368 . 18796)) (18864 22795 (CHANGE.INDEX 18874 . 19442) (CHANGE.INDEXENTRY 19444 . 
+20194) (CHANGE.XINDEX.KEY 20196 . 20754) (CHANGE.XINDEX.ENTRY 20756 . 21389) (CHANGE.XINDEX.FONT 21391
+ . 22260) (CHANGE.XINDEX.NUMBER 22262 . 22793)) (22837 30558 (GETHASH.INDEX 22847 . 23514) (
+INDEX.PAGE.NUMBER 23516 . 25095) (INDEX.MANUAL.DELIMITER 25097 . 25788) (INDEX.STRING 25790 . 26800) (
+GET.INDEXENTRY.NUMBER 26802 . 27822) (INDEX.LIST.REFS 27824 . 29314) (LIST.OF.INDEXENTRIES 29316 . 
+30556)) (30600 40804 (CREATE.INDEX.FILE 30610 . 32489) (DUMP.INDEX 32491 . 34911) (VIEW.INDEX.FILE 
+34913 . 36177) (GET.INDEX.FILE 36179 . 36569) (WRITE.INDEX.FILE 36571 . 38972) (
+WRITE.INDEX.PAGENUMBERS 38974 . 40174) (RESET.INDEX.PAGENUMBERS 40176 . 40802)) (41002 45056 (
+SELECTION.TO.STRING 41012 . 43844) (SELECTION.TO.INDEX 43846 . 45054)))))
 STOP
diff --git a/lispusers/tmax/TMAX-INDEX.LCOM b/lispusers/tmax/TMAX-INDEX.LCOM
index 8c90748f..58f9c29d 100644
Binary files a/lispusers/tmax/TMAX-INDEX.LCOM and b/lispusers/tmax/TMAX-INDEX.LCOM differ
diff --git a/lispusers/tmax/TMAX-NUMBER b/lispusers/tmax/TMAX-NUMBER
index 723ba6ad..ff89d130 100644
--- a/lispusers/tmax/TMAX-NUMBER
+++ b/lispusers/tmax/TMAX-NUMBER
@@ -1,15 +1,14 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "XCL" BASE 10)
 
-(FILECREATED "18-Mar-2022 07:06:06" 
-|{DSK}<Users>kaplan>Local>medley3.5>my-medley>lispusers>TMAX-NUMBER.;8| 33934  
+(FILECREATED "16-Mar-2024 07:49:47" |{WMEDLEY}<lispusers>tmax>TMAX-NUMBER.;3| 33943  
 
-      :CHANGES-TO (VARS TMAX-NUMBERCOMS)
+      :EDIT-BY |rmk|
 
-      :PREVIOUS-DATE "17-Mar-2022 23:33:32" 
-|{DSK}<Users>kaplan>Local>medley3.5>my-medley>lispusers>TMAX-NUMBER.;7|)
+      :CHANGES-TO (FNS NUMBER.DISPLAYFN NUMBER.PREPRINTFN NUMBER.IMAGEBOXFN NUMBER.PUTFN NUMBER.GETFN
+                       NUMBER.COPYFN)
 
+      :PREVIOUS-DATE "18-Mar-2022 07:06:06" |{WMEDLEY}<lispusers>tmax>TMAX-NUMBER.;2|)
 
-; Copyright (c) 1987, 1999-2000 by Xerox Corporation.
 
 (PRETTYCOMPRINT TMAX-NUMBERCOMS)
 
@@ -94,193 +93,190 @@
          (eq (|fetch| (numberobj use) |of| (|fetch| objectdatum |of| imobj))
              'ngroup))))
 
-(number.displayfn
-  (lambda (image.obj stream)                                 (* |fsg| "24-Sep-87 14:56")
-          (* |Display| |function| |for| |numberobjs.|
-          |Allows| |different| |formats| |for| |display| |according| |to| |the| |use| 
-          |to| |which| |the| |numberobj| |is| |being| |put.|
-          i\f |no| |specific| |action| |is| |specified,| |displaying| |defaults| |to| 
-          |printing| |out| |as| \a |plain| |number.*|)
+(NUMBER.DISPLAYFN
+  (LAMBDA (IMAGE.OBJ STREAM)                                (* \; "Edited 16-Mar-2024 07:46 by rmk")
+                                                             (* |fsg| "24-Sep-87 14:56")
 
-    (|with| numberobj (|fetch| objectdatum |of| image.obj)
-           (let* ((main.window (|with| textobj textobj (car \\window)))
-                  (image.tag (imageobjprop image.obj 'tag))
-                  (old.font (dspfont nil stream))
-                  (nbr.font (selectq use
-                                (note (|fetch| (endnotefonts number.font) |of| (get.endnote.fonts
-                                                                                main.window)))
-                                (ngroup font)
-                                (error "Undefined USE field" use))))
-                 (and image.tag (or (tsp.getcodeval image.tag main.window)
-                                    (tsp.putcode image.tag image.obj main.window)))
-                 (and (fontp nbr.font)
-                      (dspfont (fontcreate (fontprop nbr.font 'family)
-                                      (fontprop nbr.font 'size)
-                                      (fontprop nbr.font 'face))
-                             stream))
-                 (or (imagestreamtypep stream 'display)
-                     (setq page.number (car formattingstate)))
-                 (tmax.shadeobj image.obj stream)
-                 (selectq use
-                     (ngroup (prin1 (concat (or text.before# "")
-                                           (mkstring numstring)
-                                           (or text.after# ""))
-                                    stream)
-                             (or (imagestreamtypep stream 'display)
-                                 (update.ngroup.manindex template ref.type main.window)))
-                     (note (let ((current.ypos (dspyposition nil stream))
-                                 (imagebox (listget (|fetch| imageobjplist |of| image.obj)
-                                                  'boundbox)))
-                                (dspyposition (iplus current.ypos (idifference (|fetch| ysize
-                                                                                  |of| imagebox)
-                                                                         (fontprop stream
-                                                                                'height)))
-                                       stream)
-                                (prin1 (mkstring numstring)
-                                       stream)
-                                (dspyposition current.ypos stream)))
-                     nil)
-                 (dspfont old.font stream)))))
+    (* |;;| "Display function for numberobjs.  Allows different formats for display according to the use to which the numberobj is being put.  If no specific action is specified, displaying defaults to printing out as a plain number.*")
 
-(NUMBER.PREPRINTFN
-  (LAMBDA (IMAGE.OBJ)                                        (* \; "Edited 18-May-99 22:51 by rmk:")
-                                                             (* |fsg| "24-Sep-87 14:56")
-
-    (* |;;| "Returns string that represents the number object, for plaintext put.  If no specific action is specified, displaying defaults to printing out as a plain number.*")
-
-    (WITH NUMBEROBJ (FETCH OBJECTDATUM OF IMAGE.OBJ)
-           (LET* ((MAIN.WINDOW (WITH TEXTOBJ TEXTOBJ (CAR \\WINDOW)))
-                  (IMAGE.TAG (IMAGEOBJPROP IMAGE.OBJ 'TAG)))
+    (|with| NUMBEROBJ (|fetch| OBJECTDATUM |of| IMAGE.OBJ)
+           (LET* ((MAIN.WINDOW (\\TEDIT.PRIMARYW TEXTOBJ))
+                  (IMAGE.TAG (IMAGEOBJPROP IMAGE.OBJ 'TAG))
+                  (OLD.FONT (DSPFONT NIL STREAM))
+                  (NBR.FONT (SELECTQ USE
+                                (NOTE (|fetch| (ENDNOTEFONTS NUMBER.FONT) |of| (GET.ENDNOTE.FONTS
+                                                                                MAIN.WINDOW)))
+                                (NGROUP FONT)
+                                (ERROR "Undefined USE field" USE))))
                  (AND IMAGE.TAG (OR (TSP.GETCODEVAL IMAGE.TAG MAIN.WINDOW)
                                     (TSP.PUTCODE IMAGE.TAG IMAGE.OBJ MAIN.WINDOW)))
+                 (AND (FONTP NBR.FONT)
+                      (DSPFONT (FONTCREATE (FONTPROP NBR.FONT 'FAMILY)
+                                      (FONTPROP NBR.FONT 'SIZE)
+                                      (FONTPROP NBR.FONT 'FACE))
+                             STREAM))
+                 (OR (IMAGESTREAMTYPEP STREAM 'DISPLAY)
+                     (SETQ PAGE.NUMBER (CAR FORMATTINGSTATE)))
+                 (TMAX.SHADEOBJ IMAGE.OBJ STREAM)
                  (SELECTQ USE
-                     (NGROUP (CONCAT (OR TEXT.BEFORE# "")
-                                    (MKSTRING NUMSTRING)
-                                    (OR TEXT.AFTER# "")))
-                     (NOTE (MKSTRING NUMSTRING))
-                     NIL)))))
+                     (NGROUP (PRIN1 (CONCAT (OR TEXT.BEFORE# "")
+                                           (MKSTRING NUMSTRING)
+                                           (OR TEXT.AFTER# ""))
+                                    STREAM)
+                             (OR (IMAGESTREAMTYPEP STREAM 'DISPLAY)
+                                 (UPDATE.NGROUP.MANINDEX TEMPLATE REF.TYPE MAIN.WINDOW)))
+                     (NOTE (LET ((CURRENT.YPOS (DSPYPOSITION NIL STREAM))
+                                 (IMAGEBOX (LISTGET (|fetch| IMAGEOBJPLIST |of| IMAGE.OBJ)
+                                                  'BOUNDBOX)))
+                                (DSPYPOSITION (IPLUS CURRENT.YPOS (IDIFFERENCE (|fetch| YSIZE
+                                                                                  |of| IMAGEBOX)
+                                                                         (FONTPROP STREAM
+                                                                                'HEIGHT)))
+                                       STREAM)
+                                (PRIN1 (MKSTRING NUMSTRING)
+                                       STREAM)
+                                (DSPYPOSITION CURRENT.YPOS STREAM)))
+                     NIL)
+                 (DSPFONT OLD.FONT STREAM)))))
 
-(number.imageboxfn
-  (lambda (obj stream currentx rightmargin)                  (* |fsg| " 4-Aug-87 14:56")
-          (* * |For| |Endnote| |numbers,| |the| |YSize| |is| |the| |current| |font| 
-          |height| |plus| 0.25 |times| |the| |Endnote| |number| |font| |height.|
-          w\e |do| |this| |so| |the| |the| |Endnote| |number| |will| |be| |superscripted| 
-          |but| |not| |too| |much.|)
+(NUMBER.PREPRINTFN
+  (LAMBDA (IMAGE.OBJ)                                       (* \; "Edited 16-Mar-2024 07:47 by rmk")
+                                                             (* \; "Edited 18-May-99 22:51 by rmk:")
+                                                             (* |fsg| "24-Sep-87 14:56")
 
-          (* * |The| |YSize| |is| |computed| |as| |the| |current| |font| |height| |plus| 
-          |half| |of| |the| note |or| |NGroup| |font.|
-          |The| |reason| |is| |weird.| |Ask| |Sami| |for| |more| |details.|)
+    (* |;;| "Returns string that represents the number object, for plaintext put.  If no specific action is specified, displaying defaults to printing out as a plain number.*")
 
-    (|with| numberobj (|fetch| objectdatum |of| obj)
-           (let* ((main.window (|with| textobj textobj (car \\window)))
-                  (imobj.string (mkstring numstring))
-                  (nbr.font (selectq use
-                                (note (|fetch| (endnotefonts number.font) |of| (get.endnote.fonts
-                                                                                main.window)))
-                                (ngroup font)
-                                (error "Undefined USE field" use))))
-                 (and (eq use 'ngroup)
-                      (progn (and (stringp text.before#)
-                                  (setq imobj.string (concat text.before# imobj.string)))
-                             (and (stringp text.after#)
-                                  (setq imobj.string (concat imobj.string text.after#)))))
-                 (and (fontp nbr.font)
-                      (dspfont (fontcreate (fontprop nbr.font 'family)
-                                      (fontprop nbr.font 'size)
-                                      (fontprop nbr.font 'face))
-                             stream))
-                 (|create| imagebox
-                        xsize _ (stringwidth imobj.string stream)
-                        ysize _ (selectq use
-                                    (note (fix (plus (times (dspscale nil stream)
-                                                            (fontprop (current.display.font stream)
-                                                                   'height))
-                                                     (times 0.25 (fontprop stream 'height)))))
-                                    (fontprop stream 'height))
-                        ydesc _ (fontprop stream 'descent)
-                        xkern _ 0)))))
+    (WITH NUMBEROBJ (FETCH OBJECTDATUM OF IMAGE.OBJ)
+          (LET* ((MAIN.WINDOW (\\TEDIT.PRIMARYW TEXTOBJ))
+                 (IMAGE.TAG (IMAGEOBJPROP IMAGE.OBJ 'TAG)))
+                (AND IMAGE.TAG (OR (TSP.GETCODEVAL IMAGE.TAG MAIN.WINDOW)
+                                   (TSP.PUTCODE IMAGE.TAG IMAGE.OBJ MAIN.WINDOW)))
+                (SELECTQ USE
+                    (NGROUP (CONCAT (OR TEXT.BEFORE# "")
+                                   (MKSTRING NUMSTRING)
+                                   (OR TEXT.AFTER# "")))
+                    (NOTE (MKSTRING NUMSTRING))
+                    NIL)))))
 
-(number.putfn
-  (lambda (obj stream)                                       (* |fsg| " 5-Aug-87 08:24")
-    (let ((window (|with| textobj textobj (car \\window)))
-          (use (|with| numberobj (|fetch| objectdatum |of| obj)
-                      use))
-          (old.font (|with| numberobj (|fetch| objectdatum |of| obj)
-                           font)))
-         (selectq use
-             (note (note.putfn obj stream window))
-             (ngroup (let ((ngroup.rec (copy (|fetch| objectdatum |of| obj))))
-                          (|with| numberobj ngroup.rec (setq font (list.font.props font))
-                                 (prin4 (list '|NGroup| (and (windowprop window 'dumpngroupgraph)
-                                                             (dump.ngroup.graph window))
-                                              (imageobjprop obj 'tag)
-                                              ngroup.rec)
-                                        stream))))
-             (error "Unknown NUMBER ImageObject type" use)))))
+(NUMBER.IMAGEBOXFN
+  (LAMBDA (OBJ STREAM CURRENTX RIGHTMARGIN)                 (* \; "Edited 16-Mar-2024 07:47 by rmk")
+                                                             (* |fsg| " 4-Aug-87 14:56")
 
-(number.getfn
-  (lambda (stream copy.object)                               (* |fsg| " 3-Sep-87 15:17")
-          (* * i\f copy.object |is| |non-NIL| |then| |we| |are| |COPYing| |it| |to| 
-          |this| |window.|)
+(* |;;;| "For Endnote numbers, the YSize is the current font height plus 0.25 times the Endnote number font height.  We do this so the the Endnote number will be superscripted but not too much.")
 
-    (let ((nbrobj.datum (or copy.object (cdr (read stream))))
-          (newobj (numberobj))
-          (window (|with| textobj textobj (car \\window))))
-         (tsp.setup.fmmenu window)
-         (and (ilessp (length nbrobj.datum)
+(* |;;;| "The YSize is computed as the current font height plus half of the NOTE or NGroup font.  The reason is weird.  Ask Sami for more details.")
+
+    (|with| NUMBEROBJ (|fetch| OBJECTDATUM |of| OBJ)
+           (LET* ((MAIN.WINDOW (\\TEDIT.PRIMARYW TEXTOBJ))
+                  (IMOBJ.STRING (MKSTRING NUMSTRING))
+                  (NBR.FONT (SELECTQ USE
+                                (NOTE (|fetch| (ENDNOTEFONTS NUMBER.FONT) |of| (GET.ENDNOTE.FONTS
+                                                                                MAIN.WINDOW)))
+                                (NGROUP FONT)
+                                (ERROR "Undefined USE field" USE))))
+                 (AND (EQ USE 'NGROUP)
+                      (PROGN (AND (STRINGP TEXT.BEFORE#)
+                                  (SETQ IMOBJ.STRING (CONCAT TEXT.BEFORE# IMOBJ.STRING)))
+                             (AND (STRINGP TEXT.AFTER#)
+                                  (SETQ IMOBJ.STRING (CONCAT IMOBJ.STRING TEXT.AFTER#)))))
+                 (AND (FONTP NBR.FONT)
+                      (DSPFONT (FONTCREATE (FONTPROP NBR.FONT 'FAMILY)
+                                      (FONTPROP NBR.FONT 'SIZE)
+                                      (FONTPROP NBR.FONT 'FACE))
+                             STREAM))
+                 (|create| IMAGEBOX
+                        XSIZE _ (STRINGWIDTH IMOBJ.STRING STREAM)
+                        YSIZE _ (SELECTQ USE
+                                    (NOTE (FIX (PLUS (TIMES (DSPSCALE NIL STREAM)
+                                                            (FONTPROP (CURRENT.DISPLAY.FONT STREAM)
+                                                                   'HEIGHT))
+                                                     (TIMES 0.25 (FONTPROP STREAM 'HEIGHT)))))
+                                    (FONTPROP STREAM 'HEIGHT))
+                        YDESC _ (FONTPROP STREAM 'DESCENT)
+                        XKERN _ 0)))))
+
+(NUMBER.PUTFN
+  (LAMBDA (OBJ STREAM)                                      (* \; "Edited 16-Mar-2024 07:48 by rmk")
+                                                             (* |fsg| " 5-Aug-87 08:24")
+    (LET ((WINDOW (\\TEDIT.PRIMARYW TEXTOBJ))
+          (USE (|with| NUMBEROBJ (|fetch| OBJECTDATUM |of| OBJ)
+                      USE))
+          (OLD.FONT (|with| NUMBEROBJ (|fetch| OBJECTDATUM |of| OBJ)
+                           FONT)))
+         (SELECTQ USE
+             (NOTE (NOTE.PUTFN OBJ STREAM WINDOW))
+             (NGROUP (LET ((NGROUP.REC (COPY (|fetch| OBJECTDATUM |of| OBJ))))
+                          (|with| NUMBEROBJ NGROUP.REC (SETQ FONT (LIST.FONT.PROPS FONT))
+                                 (PRIN4 (LIST '|NGroup| (AND (WINDOWPROP WINDOW 'DUMPNGROUPGRAPH)
+                                                             (DUMP.NGROUP.GRAPH WINDOW))
+                                              (IMAGEOBJPROP OBJ 'TAG)
+                                              NGROUP.REC)
+                                        STREAM))))
+             (ERROR "Unknown NUMBER ImageObject type" USE)))))
+
+(NUMBER.GETFN
+  (LAMBDA (STREAM COPY.OBJECT)                              (* \; "Edited 16-Mar-2024 07:48 by rmk")
+                                                             (* |fsg| " 3-Sep-87 15:17")
+
+(* |;;;| "If COPY.OBJECT is non-NIL then we are COPYing it to this window.")
+
+    (LET ((NBROBJ.DATUM (OR COPY.OBJECT (CDR (READ STREAM))))
+          (NEWOBJ (NUMBEROBJ))
+          (WINDOW (\\TEDIT.PRIMARYW TEXTOBJ)))
+         (TSP.SETUP.FMMENU WINDOW)
+         (AND (ILESSP (LENGTH NBROBJ.DATUM)
                      3)
-              (setq nbrobj.datum (cons nil nbrobj.datum)))
-         (and (car nbrobj.datum)
-              (not (and (boundp 'tmax.prune.ngraph)
-                        tmax.prune.ngraph))
-              (copy.ngroup.branch (car nbrobj.datum)
-                     window))
-         (and (cadr nbrobj.datum)
-              (not (gethash (cadr nbrobj.datum)
-                          (windowprop window 'tsp.code.array)))
-              (progn (tsp.putcode (cadr nbrobj.datum)
-                            newobj window)
-                     (imageobjprop newobj 'tag (cadr nbrobj.datum))))
-         (|with| numberobj (setq nbrobj.datum (ngroup.fixup.records (caddr nbrobj.datum)
-                                                     copy.object))
-                (selectq use
-                    (note (note.getfn newobj nbrobj.datum window))
-                    (ngroup (and (listp font)
-                                 (setq font (fontcreate font)))
-                            (create.ngroup.node ref.type ngroup.mother nbrobj.datum window)
-                            (create.ngroup.node ngroup.mother nil nil window)
-                            (add.ngroup.to.mother.node ref.type ngroup.mother window)
-                            (windowprop window 'rebuild.graphflg t)
-                            (and (|fetch| (ngtemplate ng.manualindex) |of| template)
-                                 (windowaddprop window 'manualgroups ref.type))
-                            (|replace| objectdatum |of| newobj |with| nbrobj.datum))
-                    (error "Unknown USE type in NUMBER.GETFN" use)))
-         newobj)))
+              (SETQ NBROBJ.DATUM (CONS NIL NBROBJ.DATUM)))
+         (AND (CAR NBROBJ.DATUM)
+              (NOT (AND (BOUNDP 'TMAX.PRUNE.NGRAPH)
+                        TMAX.PRUNE.NGRAPH))
+              (COPY.NGROUP.BRANCH (CAR NBROBJ.DATUM)
+                     WINDOW))
+         (AND (CADR NBROBJ.DATUM)
+              (NOT (GETHASH (CADR NBROBJ.DATUM)
+                          (WINDOWPROP WINDOW 'TSP.CODE.ARRAY)))
+              (PROGN (TSP.PUTCODE (CADR NBROBJ.DATUM)
+                            NEWOBJ WINDOW)
+                     (IMAGEOBJPROP NEWOBJ 'TAG (CADR NBROBJ.DATUM))))
+         (|with| NUMBEROBJ (SETQ NBROBJ.DATUM (NGROUP.FIXUP.RECORDS (CADDR NBROBJ.DATUM)
+                                                     COPY.OBJECT))
+                (SELECTQ USE
+                    (NOTE (NOTE.GETFN NEWOBJ NBROBJ.DATUM WINDOW))
+                    (NGROUP (AND (LISTP FONT)
+                                 (SETQ FONT (FONTCREATE FONT)))
+                            (CREATE.NGROUP.NODE REF.TYPE NGROUP.MOTHER NBROBJ.DATUM WINDOW)
+                            (CREATE.NGROUP.NODE NGROUP.MOTHER NIL NIL WINDOW)
+                            (ADD.NGROUP.TO.MOTHER.NODE REF.TYPE NGROUP.MOTHER WINDOW)
+                            (WINDOWPROP WINDOW 'REBUILD.GRAPHFLG T)
+                            (AND (|fetch| (NGTEMPLATE NG.MANUALINDEX) |of| TEMPLATE)
+                                 (WINDOWADDPROP WINDOW 'MANUALGROUPS REF.TYPE))
+                            (|replace| OBJECTDATUM |of| NEWOBJ |with| NBROBJ.DATUM))
+                    (ERROR "Unknown USE type in NUMBER.GETFN" USE)))
+         NEWOBJ)))
 
-(number.copyfn
-  (lambda (image.obj source.stream target.stream)            (* |fsg| " 4-Aug-87 09:46")
-          (* * |Here| |to| copy \a |Number| |Image| |Object.|
-          i\f |we| |are| |copying| |to| |our| |own| |window,| |we| |delete| |the| tag 
-          |if| |any| |so| |we| |don't| |get| |two| |ImageObjs| |with| |the| |same| tag 
-          |name.|)
+(NUMBER.COPYFN
+  (LAMBDA (IMAGE.OBJ SOURCE.STREAM TARGET.STREAM)           (* \; "Edited 16-Mar-2024 07:48 by rmk")
+                                                             (* |fsg| " 4-Aug-87 09:46")
 
-    (selectq (imagestreamtype target.stream)
-        (text (let ((source.window (|with| textobj textobj (car \\window)))
-                    (textobj (textobj target.stream)))
-                   (apply* (imageobjprop image.obj 'getfn)
-                          target.stream
-                          (list (|with| numberobj (|fetch| objectdatum |of| image.obj)
-                                       (and (eq use 'ngroup)
-                                            (neq source.stream target.stream)
-                                            (|for| parent |in| (append (list.ancestors ref.type nil 
-                                                                              source.window)
-                                                                      (list ref.type))
-                                               |collect| (car (gethash parent (tsp.get.ngroup.array
-                                                                               source.window))))))
-                                (and (neq source.stream target.stream)
-                                     (imageobjprop image.obj 'tag))
-                                (|fetch| objectdatum |of| image.obj)))))
-        (error "Unknown TARGET stream type" (imagestreamtype target.stream)))))
+(* |;;;| "Here to COPY a Number Image Object.  If we are copying to our own window, we delete the TAG if any so we don't get two ImageObjs with the same TAG name.")
+
+    (SELECTQ (IMAGESTREAMTYPE TARGET.STREAM)
+        (TEXT (LET ((SOURCE.WINDOW (\\TEDIT.PRIMARYW TEXTOBJ))
+                    (TEXTOBJ (TEXTOBJ TARGET.STREAM)))
+                   (APPLY* (IMAGEOBJPROP IMAGE.OBJ 'GETFN)
+                          TARGET.STREAM
+                          (LIST (|with| NUMBEROBJ (|fetch| OBJECTDATUM |of| IMAGE.OBJ)
+                                       (AND (EQ USE 'NGROUP)
+                                            (NEQ SOURCE.STREAM TARGET.STREAM)
+                                            (|for| PARENT |in| (APPEND (LIST.ANCESTORS REF.TYPE NIL 
+                                                                              SOURCE.WINDOW)
+                                                                      (LIST REF.TYPE))
+                                               |collect| (CAR (GETHASH PARENT (TSP.GET.NGROUP.ARRAY
+                                                                               SOURCE.WINDOW))))))
+                                (AND (NEQ SOURCE.STREAM TARGET.STREAM)
+                                     (IMAGEOBJPROP IMAGE.OBJ 'TAG))
+                                (|fetch| OBJECTDATUM |of| IMAGE.OBJ)))))
+        (ERROR "Unknown TARGET stream type" (IMAGESTREAMTYPE TARGET.STREAM)))))
 
 (number.buttoneventinfn
   (lambda (obj stream sel relx rely window hoststream button)(* |fsg| " 2-Sep-87 11:09")
@@ -588,14 +584,13 @@
                          FONT TEXT.BEFORE# ABBREV-VAL))
 )
 )
-(PUTPROPS TMAX-NUMBER COPYRIGHT ("Xerox Corporation" 1987 1999 2000))
 (DECLARE\: DONTCOPY
-  (FILEMAP (NIL (2558 18256 (NUMBEROBJ 2568 . 3674) (NUMBEROBJP 3676 . 4216) (NGROUPP 4218 . 4572) (
-NUMBER.DISPLAYFN 4574 . 7613) (NUMBER.PREPRINTFN 7615 . 8659) (NUMBER.IMAGEBOXFN 8661 . 11154) (
-NUMBER.PUTFN 11156 . 12240) (NUMBER.GETFN 12242 . 14378) (NUMBER.COPYFN 14380 . 16077) (
-NUMBER.BUTTONEVENTINFN 16079 . 17984) (NUMBEROBJ.TEDIT-TO-TEX-FN 17986 . 18254)) (18257 27428 (
-COPY.NGROUP.BRANCH 18267 . 19723) (DUMP.NGROUP.GRAPH 19725 . 20601) (NGROUP.BUTTONEVENTINFN 20603 . 
-21303) (NGROUP.DEFINE.TAG 21305 . 21908) (NUMBER.DELETE.TAG 21910 . 22169) (NGROUP.SHOW.TAG 22171 . 
-22493) (CHANGE.INSERTED.NGROUP.FORMAT 22495 . 24290) (CHANGE.NGROUP.FORMAT.#TEXT 24292 . 25878) (
-SHOW.INSERTED.NGROUP.FORMAT 25880 . 27426)))))
+  (FILEMAP (NIL (2562 18335 (NUMBEROBJ 2572 . 3678) (NUMBEROBJP 3680 . 4220) (NGROUPP 4222 . 4576) (
+NUMBER.DISPLAYFN 4578 . 7583) (NUMBER.PREPRINTFN 7585 . 8717) (NUMBER.IMAGEBOXFN 8719 . 11110) (
+NUMBER.PUTFN 11112 . 12284) (NUMBER.GETFN 12286 . 14471) (NUMBER.COPYFN 14473 . 16156) (
+NUMBER.BUTTONEVENTINFN 16158 . 18063) (NUMBEROBJ.TEDIT-TO-TEX-FN 18065 . 18333)) (18336 27507 (
+COPY.NGROUP.BRANCH 18346 . 19802) (DUMP.NGROUP.GRAPH 19804 . 20680) (NGROUP.BUTTONEVENTINFN 20682 . 
+21382) (NGROUP.DEFINE.TAG 21384 . 21987) (NUMBER.DELETE.TAG 21989 . 22248) (NGROUP.SHOW.TAG 22250 . 
+22572) (CHANGE.INSERTED.NGROUP.FORMAT 22574 . 24369) (CHANGE.NGROUP.FORMAT.#TEXT 24371 . 25957) (
+SHOW.INSERTED.NGROUP.FORMAT 25959 . 27505)))))
 STOP
diff --git a/lispusers/tmax/TMAX-NUMBER.LCOM b/lispusers/tmax/TMAX-NUMBER.LCOM
index 9c60dc79..ce014f7d 100644
Binary files a/lispusers/tmax/TMAX-NUMBER.LCOM and b/lispusers/tmax/TMAX-NUMBER.LCOM differ
diff --git a/lispusers/tmax/TMAX-XREF b/lispusers/tmax/TMAX-XREF
index 40348033..8b0debc6 100644
--- a/lispusers/tmax/TMAX-XREF
+++ b/lispusers/tmax/TMAX-XREF
@@ -1,13 +1,13 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "XCL" BASE 10)
 
-(FILECREATED "26-Dec-2023 11:56:52" |{WMEDLEY}<lispusers>TMAX>TMAX-XREF.;4| 23618  
+(FILECREATED "16-Mar-2024 07:55:53" |{WMEDLEY}<lispusers>tmax>TMAX-XREF.;7| 23813  
 
       :EDIT-BY |rmk|
 
-      :CHANGES-TO (FILES TMAX)
-                  (FNS XREF.BUTTONEVENTINFN)
+      :CHANGES-TO (VARS XREF.DISPLAY.METHODS)
+                  (FNS XREF.BUTTONEVENTINFN XREF.GETFN XREF.GET.TOOBJ)
 
-      :PREVIOUS-DATE "15-Jul-2023 10:49:41" |{WMEDLEY}<lispusers>TMAX>TMAX-XREF.;3|)
+      :PREVIOUS-DATE "16-Mar-2024 07:52:25" |{WMEDLEY}<lispusers>tmax>TMAX-XREF.;6|)
 
 
 (PRETTYCOMPRINT TMAX-XREFCOMS)
@@ -131,15 +131,15 @@
                  (imageobjprop obj 'reference.by))
            stream)))
 
-(xref.getfn
-  (lambda (stream copy.object)                               (* |fsg| "20-Aug-87 14:59")
-    (let ((window (|with| textobj textobj (car \\window))))
-         (tsp.setup.fmmenu window))
-    (let* ((xref.args (or copy.object (cdr (read stream))))
-           (xref.obj (xref (car xref.args))))
-          (imageobjprop xref.obj 'reference.by (or (cadr xref.args)
+(XREF.GETFN
+  (LAMBDA (STREAM COPY.OBJECT)                              (* \; "Edited 16-Mar-2024 07:49 by rmk")
+                                                             (* |fsg| "20-Aug-87 14:59")
+    (TSP.SETUP.FMMENU (\\TEDIT.PRIMARYW TEXTOBJ))
+    (LET* ((XREF.ARGS (OR COPY.OBJECT (CDR (READ STREAM))))
+           (XREF.OBJ (XREF (CAR XREF.ARGS))))
+          (IMAGEOBJPROP XREF.OBJ 'REFERENCE.BY (OR (CADR XREF.ARGS)
                                                    '|Value|))
-          xref.obj)))
+          XREF.OBJ)))
 
 (xref.copyfn
   (lambda (image.obj source.stream target.stream)            (* |fsg| "12-Aug-87 11:07")
@@ -155,6 +155,7 @@
 
 (XREF.BUTTONEVENTINFN
   (LAMBDA (XREFOBJ STREAM SELECTION RELX RELY WINDOW HOSTSTREAM BUTTON)
+                                                            (* \; "Edited 16-Mar-2024 07:55 by rmk")
                                                             (* \; "Edited 26-Dec-2023 11:56 by rmk")
                                                              (* \; "Edited  9-Nov-97 08:09 by rmk:")
                                                              (* |fsg| "29-Jul-87 16:43")
@@ -187,7 +188,7 @@
                                           (TEDIT.NORMALIZECARET HOSTSTREAM))
                                      (RETFROM (FUNCTION \\TEDIT.SELECT.LINE.SCANNER)
                                             (TEDIT.GETSEL HOSTSTREAM))
-                              ELSE (TEDIT.PROMPTPRINT STREAM "Reference has not definition!" T))
+                              ELSE (TEDIT.PROMPTPRINT STREAM "Reference has no definition!" T))
                             NIL))
                   (|Change Reference| 
                        (LET ((NEW.REFERENCE (GET.REF WINDOW STREAM)))
@@ -250,15 +251,14 @@
             (t (concat "<Reference " (|fetch| objectdatum |of| obj)
                       "/" reference.by ">"))))))
 
-(xref.get.toobj
-  (lambda (tag)                                              (* |fsg| "13-Jul-87 11:13")
-          (* |This| |function| |is| |called| |in| \a |specific| |context| |where| \a 
-          |reference| |must| |be| |displayed.| i\t |is| |called| |by| |an| xref |object| 
-          |and| |should| |return| |the| imageobject |that| |the| xref |object| |is| 
-          |referencing.|)
+(XREF.GET.TOOBJ
+  (LAMBDA (TAG)                                             (* \; "Edited 16-Mar-2024 07:49 by rmk")
+                                                             (* |fsg| "13-Jul-87 11:13")
 
-    (gethash tag (windowprop (|with| textobj textobj (car \\window))
-                        'tsp.code.array))))
+    (* |;;| "This function is called in a specific context where a reference must be displayed.  It is called by an XREF object and should return the IMAGEOBJECT that the XREF object is referencing.")
+
+    (GETHASH TAG (WINDOWPROP (\\TEDIT.PRIMARYW TEXTOBJ)
+                        'TSP.CODE.ARRAY))))
 
 (tspobj.gettype
   (lambda (obj)                                              (* |ss:| "27-Jun-87 16:36")
@@ -476,14 +476,14 @@
 (FILESLOAD (COMPILED SYSLOAD)
        TMAX)
 (DECLARE\: DONTCOPY
-  (FILEMAP (NIL (3650 11069 (XREF 3660 . 4227) (XREFP 4229 . 4616) (XREF.DISPLAYFN 4618 . 5052) (
-XREF.IMAGEBOXFN 5054 . 5706) (XREF.PUTFN 5708 . 5954) (XREF.GETFN 5956 . 6430) (XREF.COPYFN 6432 . 
-7042) (XREF.BUTTONEVENTINFN 7044 . 10042) (XREF.WHENDELETEDFN 10044 . 10618) (XREF.TEDIT-TO-TEX-FN 
-10620 . 11067)) (11070 13054 (XREF.GET.DISPLAY.TEXT 11080 . 12364) (XREF.GET.TOOBJ 12366 . 12903) (
-TSPOBJ.GETTYPE 12905 . 13052)) (13055 19429 (UPDATE.XREFS 13065 . 15448) (INSERT.REF 15450 . 15862) (
-GET.REF 15864 . 16919) (GET.REFERENCE.BY 16921 . 17908) (TSP.LIST.REFS 17910 . 18362) (TSP.GET.INCODE 
-18364 . 19018) (TSP.GETCODEVAL 19020 . 19242) (TSP.PUTCODE 19244 . 19427)) (19521 20492 (
-XREF.ADD.DISPLAYFN 19531 . 20045) (XREF.GET.DISPLAYFN 20047 . 20490)) (20552 22914 (
-NGROUP.XREF.DISPLAYFN 20562 . 21522) (NGROUP.XREF.DISPLAY.TEXT 21524 . 22160) (NOTE.XREF.DISPLAYFN 
-22162 . 22912)))))
+  (FILEMAP (NIL (3691 11273 (XREF 3701 . 4268) (XREFP 4270 . 4657) (XREF.DISPLAYFN 4659 . 5093) (
+XREF.IMAGEBOXFN 5095 . 5747) (XREF.PUTFN 5749 . 5995) (XREF.GETFN 5997 . 6526) (XREF.COPYFN 6528 . 
+7138) (XREF.BUTTONEVENTINFN 7140 . 10246) (XREF.WHENDELETEDFN 10248 . 10822) (XREF.TEDIT-TO-TEX-FN 
+10824 . 11271)) (11274 13249 (XREF.GET.DISPLAY.TEXT 11284 . 12568) (XREF.GET.TOOBJ 12570 . 13098) (
+TSPOBJ.GETTYPE 13100 . 13247)) (13250 19624 (UPDATE.XREFS 13260 . 15643) (INSERT.REF 15645 . 16057) (
+GET.REF 16059 . 17114) (GET.REFERENCE.BY 17116 . 18103) (TSP.LIST.REFS 18105 . 18557) (TSP.GET.INCODE 
+18559 . 19213) (TSP.GETCODEVAL 19215 . 19437) (TSP.PUTCODE 19439 . 19622)) (19716 20687 (
+XREF.ADD.DISPLAYFN 19726 . 20240) (XREF.GET.DISPLAYFN 20242 . 20685)) (20747 23109 (
+NGROUP.XREF.DISPLAYFN 20757 . 21717) (NGROUP.XREF.DISPLAY.TEXT 21719 . 22355) (NOTE.XREF.DISPLAYFN 
+22357 . 23107)))))
 STOP
diff --git a/lispusers/tmax/TMAX-XREF.LCOM b/lispusers/tmax/TMAX-XREF.LCOM
index 45c691c2..50915cf9 100644
Binary files a/lispusers/tmax/TMAX-XREF.LCOM and b/lispusers/tmax/TMAX-XREF.LCOM differ
