ZWEI and Zmacs on the MIT CADR and LM-3
ZWEI is the reusable editing system; Zmacs is its general file, buffer, and Lisp development editor. The distinction is visible in the source: the standard ZWEI command table, editing primitives, redisplay, modes, and editor streams stand below a Zmacs command-table overlay and Zmacs-specific buffer, file, source, and window machinery.
This page covers architecture, features, modes, and observed behavior. The binding companion gives the complete preserved System 46 Standard tree and the configured System 303 fixed tables, Help, intercept, pointer-hook, and mode-composition layers. The reimplementation specification turns those inventories into release-bounded text, command-loop, lifecycle, failure, visual, and conformance contracts.
Two public evidence sets
MIT CADR System 46 snapshot
The museum pins mietek/mit-cadr-system-software at revision 8e978d7. Its src/nzwei/ directory contains ZWEI structures, redisplay, commands, modes, mouse support, Dired/Mail support, generated QFASL files, self-documentation, and an exact generated command listing. It also contains Zmacs structures and tags which name an original NZWEI; ZMACS file, but that Zmacs implementation file is absent from the public snapshot.
This is an important preservation boundary. The System 46 standard ZWEI map and built help output are directly inspectable. The complete Zmacs overlay cannot be reconstructed from the public source tree alone, so this museum does not silently substitute a later source file and label it System 46.
The system declaration names 31 active modules, of which 25 source files are present. Those 25 total 635,071 bytes with aggregate manifest SHA-256 fb2f381f464aed8f05d2c4be8c9113c2b3e63a0ad9fe66fa9088a3e95a4791a1. A non-evaluating audit found 345 literal concrete DEFCOM names and 17 mode entry commands generated by 11 major- and 6 minor-mode declarations: 362 source-defined command symbols in the preserved subset. Its 450 expanded literal SET-COMTAB events are assignments, not 450 distinct live keys.
The tracked System 46 generated command listing records 348 named ZWEI/Zmacs commands and the direct bindings exposed when that artifact was generated. emacs.comdif and nzwei.comdif in the same directory record contemporary compatibility and change notes. The on-line help recovery article explains how those artifacts and source declarations were recovered.
LM-3 System 303 tree
The maintained public LM-3 Fossil repository is pinned at check-in 4df393c, tag system-303. Unlike the System 46 snapshot, it contains the complete ZWEI system declaration and Zmacs source used for this analysis. The three central files have these local identities:
| File | Bytes | SHA-256 |
|---|---|---|
l/sys/zwei/comtab.lisp |
64,703 | 5e54ab5e70fd7e2e6086fb16d8a83efe27d65173abeaa78e0825804b3866e600 |
l/sys/zwei/zmacs.lisp |
115,156 | 513f39d440a6612ff7d3d540a62b397fe6348456bd36a450262ff6fa372799d0 |
l/sys/zwei/modes.lisp |
68,224 | 732303cda32a8c931ae4f112b7f54d3803a49e2c8206f90e39759235bcad975a |
The repository is a maintained preservation tree. “System 303” on this page means this exact tagged check-in and the load band recorded by the harness, not an assertion that every line shares one original creation date.
The active declaration resolves to 42 ZWEI files totaling 1,706,505 bytes, with aggregate manifest SHA-256 87af558ea62e894f8f279f73365b1dee69786f09fb657928a90cd76c61d19a1a. Each lexical-path-ordered record is the UTF-8 zwei/<file>.lisp pathname, one NUL byte, and the 32-byte binary file SHA-256; records are concatenated without a terminator and hashed again. Static audit found 671 literal concrete DEFCOM names plus 31 generated mode commands, for 702 source-defined command symbols. It expanded 800 literal keyboard assignments and found 285 named-command occurrences. These are source denominators, not claims about a pristine historical release or a modified live session.
How ZWEI represents editing
Text is an interval made of line objects. Buffer pointers, or BPs, identify a line and position and can move as text changes. Windows display intervals and retain their own point, mark, and display state. This separation permits two windows to show the same buffer at different positions while sharing changes.
The command loop dynamically binds the current editor, window, interval, point, mark, mode state, command tables, histories, syntax tables, and streams. A command returns a redisplay degree, allowing a character insertion, a line change, and a full window reformat to request different amounts of work.
The System 303 system declaration shows the scale of the subsystem. Separate modules implement:
- structures, macros, screen integration, redisplay, and text primitives;
- movement, insertion/deletion, indentation, Lisp parsing, and search;
- kill, minibuffer, and undo histories;
- fonts, keyboard macros, modes, mouse commands, and self-documentation;
- general commands, files, Dired and directory comparison, spelling, patching, possibilities/warnings, and editor streams;
- Zmacs section, buffer, file, and top-level behavior.
Command tables are composed, not copied
A ZWEI command table stores direct characters, mouse gestures, a named-command alist, an optional parent table, and an optional Control-key indirection. A leaf can also be an alias, prefix table, or menu command. Lookup follows those links until it finds a command or an undefined slot.
System 303 builds Zmacs by composition:
STANDARD-COMTABdefines general editing;STANDARD-CONTROL-X-COMTABsupplies the standard prefix;ZMACS-COMTABoverrides editor-specific keys and inherits the standard table;ZMACS-CONTROL-X-COMTABoverrides files, buffers, and windows and inherits the standard prefix;- major and minor modes can put local command tables in front of those layers.
This explains a historical bug discussion preserved in bugs.old: mode-aware Zmacs should consult the mode table, the Zmacs table, and the ZWEI table. It also explains why counting only literal forms in comtab.lisp is not a count of the effective runtime map.
Feature inventory
Search, transformation, and generated result buffers
- forward and reverse incremental search, Lisp-aware match search, literal and query replace, multi-string replacement, and tag-table-wide operations;
- occurrence lists, matching-line filters, sorting, reversing, and keyboard- macro-driven transforms;
- “possibility” buffers used to visit a sequence of search results, warnings, callers, or other source locations;
- source comparison and merging.
Buffers, files, windows, and directories
- named buffer history, create/select/list/edit/kill/revert/rename operations, read-only state, and modified-buffer review;
- file find/visit/read/write/save/append/prepend/copy/rename/delete/undelete, file properties, directories, and background file finding;
- one, two, and several-window layouts, another window, window growth, two views of one region, and buffers chosen for each pane;
- Dired and directory-difference editors with their own major modes and local commands.
Lisp and system development
- evaluate or compile regions, definitions, buffers, changed sections, and files; compile-and-load and FASL update;
- edit definitions, callers, object users, methods, combined methods, and flavor relationships;
- argument lists, documentation, variable description, macro expansion, disassembly, trace/untrace, and package/readtable/base attributes;
- tag tables over files, buffers, packages, or systems;
- compiler-warning navigation and patch creation, resumption, completion, and release operations;
- a ZTOP mode in which a ZWEI buffer and editor stream feed a Lisp top-level, preserving editable input history and package state.
Text production and appearance
- Text, Bolio, and TeX editing; paragraph filling; comment filling; column and prefix control; spelling correction; and word abbreviations;
- font selection and character/word/region font changes;
- text-justifier font and underline control;
- printing buffers, regions, files, and all buffers.
Help and customization
The Help dispatcher can give a basic introduction, describe a key or named command, search command names, show where a command is bound, describe variables, repeat a help query, and show recent input. Meta-X normally offers the active named-command alists; Control-Meta-X can request any loaded ZWEI command. Users can install functions, keyboard macros, and mouse macros on keys, and can edit the implementation of the command installed on a key.
Self-documentation walks the command-table structure rather than consulting a fixed wall chart. The tracked System 46 _comnd.1 file is therefore evidence of a particular built environment, while the source tables establish how the list was produced.
Editor streams, ZDT, and ZTOP
System 303 also contains two interactive Lisp embodiments of ZWEI. They share the editing machinery but are not alternate names for Zmacs:
ZDTinitializes the generic editor-stream command table, creates a singleEDITOR-TOP-LEVELwindow if necessary, and selects or deselects it. The source also registers that editor top level on theTop-Lsystem key with the labelLISP(Edit). ZDT has no independent fixed keymap; it uses the eight-cell editor-stream overlay listed in the binding reference.- ZTOP is a Zmacs-buffer Lisp top level. Its major mode installs pre- and post-command hooks, editable input history, an eight-cell local table, and a mode-line state that distinguishes reading, editing, and waiting for explicit activation.
The generic editor-stream command hook normally submits buffered input automatically when point remains at the end after eligible input. If point has moved away, Require Activation mode can defer submission until End or C-Return. This state-dependent behavior is visible in stream.lisp but would be lost in a flat command-name or key list.
Modes in the pinned trees
Modes are executable configurations: they set syntax, indentation, variables, and local command tables. They are not only labels on the mode line.
| Evidence set | Major modes in the inspected source | Minor modes in the inspected source |
|---|---|---|
| System 46 source-present subset | Dired, Mail, Lisp, MIDAS, Text, Bolio, Fundamental, PL1, Electric PL1, TECO, Macsyma | Atom Word, Emacs, Auto Fill, Overwrite, Word Abbrev, Electric Shift Lock |
| System 303 active subsystem | Dired, Edit Buffers, directory differences, Lisp, Scheme, T, MIDAS, Text, Bolio, Fundamental, PL1, Electric PL1, C, TECO, Macsyma, TeX, Possibilities, Warnings, ZTOP | Mail, Return Indents, Atom Word, Emacs, Any Bracket, Auto Fill, Overwrite, Word Abbrev, Electric Shift Lock, Electric Font Lock, Require Activation Mode 1, Require Activation Mode |
The table deliberately includes application modes defined outside the general modes file. Dired, directory differences, Edit Buffers, Possibilities, Warnings, Mail, and ZTOP embody task-specific editor state rather than merely selecting a file language.
Runtime observations
The Xvfb CADR harness booted Experimental System 303.0, ZWEI 129.0, and microcode 323 from a private disk copy. The exact run boundary was:
| Item | Recorded value |
|---|---|
| Session | eine-zwei-20260718, generation 1; 2026-07-18 00:27:52–00:47:42 EDT |
| Disk | base and private-start SHA-256 bb16e46ad81decfe1efe691d36b6aa4ce3fd4ffb82474365de3520989d397cb5 |
| System source | public revision 4df393c68d7f083ce42d5c377039d26043cc18a9031ace28258dc97f4137eb91; private tree SHA-256 21f5215de973aa6ccbddb817f2d64edd95ee1014c3028a9b0711ea7c741b807e |
| Other private source trees | Chaos SHA-256 34ab197641aae909e9a224edc307020fddec263e732207a74573d51dac0daa87; site SHA-256 adbb720339db225e6635977a869cf3f3d50b507e614b37a976f4a6548d212a81 |
| Public source revisions at start | L d1250f90044f09b6c92014a9aef65f9574e1bcbf8a7163004e53cc6dbed0f2d6; System 4df393c68d7f083ce42d5c377039d26043cc18a9031ace28258dc97f4137eb91; usim 330d8248ec2e12af071e287920e681600f75df9ffd854aada5f8a64c9adad64d; usite 8f717978b458b40adf1e238aaf177f5bc54ef46881268e03b787ba57b0d30a0e; Chaos db2953fde68d726a605d1d1699bab6c926ef252bd4991f692bae6ee5a634764e |
| Private source snapshot | copied 2026-07-18 00:27:48 EDT at the same System, usite, and Chaos revisions shown above; the three tree hashes at copy equaled their start hashes, and all changed_since_copy flags were false |
| Emulator | start and execution SHA-256 707a77d23e28ea1c45ae0eb0145dc181fa7ba649b9defc30044d4f847ac2c5be |
| Private machine artifacts | promh.mcr SHA-256 2c667f99f014a7130a55b255d31df02588d9396beace78abfe9325269e4ff3e6; promh.sym e9e3dd6a541511dd9541ae96b99dae19cb185d8b79fa09959f21fa52224f233d; ucadr.sym 9071decf16fa8f11d7970c4662db0d6e95600fe43ec86ac41c77b37dbd7caa2a |
| Toolchain | manifest SHA-256 3adae999bbe420182f22adc2499fcc82449a46eaf580a362de9c0e718fa6b37d |
| Selected window | LOCAL-CADR [running], XID 2097202, x=0, y=0, 768×963 |
After answering the boot date/time question with N, the ordered editor actions were: evaluate the identity probe; evaluate (ED T); insert a small Lisp definition; press Help twice; invoke Meta-X; run Text Mode; invoke Meta-X again; and run Lisp Mode. The identity evaluation of (LIST (FBOUNDP 'ED) (FBOUNDP 'ZWEI:ED) (FIND-PACKAGE "EINE") (FIND-PACKAGE "ZWEI")) returned (T T NIL #<Package ZWEI ...>): both editor entry points exist, while this world has no EINE package. That does not prove that no isolated residual EINE-named compiled symbol exists.
Directly observed behavior was:
(ED T)openedZMACS (LISP)in a new buffer;Helpdisplayed the live dispatcher and its current choices;Meta-Xopened a completingExtended command:minibuffer;Text Modechanged the mode line toZMACS (Text);Lisp ModerestoredZMACS (LISP).
Four 768×963 framebuffer captures record those states. The raw captures and sidecars remain in the ignored session; exact unmodified PNG copies selected for the museum are tracked in the curated screenshot catalog:
| Portable filename | Action and observed state | PNG SHA-256 | Decoded-pixel SHA-256 |
|---|---|---|---|
zmacs-lisp-buffer.png |
(ED T); fresh ZMACS (LISP) buffer |
ed9cbcd15f31e3248ab4521eddc64b265465b070de20d515dc7bfeb18b62e710 |
5aa59c3d5d588371d79ee6b4d139791f5cdded6ad3c6fcde0d82820d5b327cee |
zwei-help-menu.png |
Help, then Help; live dispatcher and current choices |
e0d6bf39d9de90b8c94ba93aeb2a70bbe1bec1e8ebbefebf80ffa371ac420c48 |
b56f866686fe6414758656dff8b60f3657fc35aa63978f70402e34fb0b8cd83d |
zmacs-text-mode.png |
Meta-X Text Mode Return; mode line becomes ZMACS (Text) |
f96bf56b32e26334545e0c3b69c86f7eb8626e358d5d874d6f1ddad8d605a18c |
7399f7f888fe8d7994c51dad2be0dc76d238694cc1ac395d1c54928575ee63cb |
zmacs-lisp-mode.png |
Meta-X Lisp Mode Return; mode line returns to ZMACS (LISP) |
ccd97819c88c1cc4c9cc5acf017c54a5dd3dd551239ac5b8a1bdf433a4d7530c |
5000ef126c07750a8e2107a95a6ad3574413eb68e72823cb1efb0f37cd1fe5a3 |

Runtime observation — (ED T) opened a fresh ZMACS (LISP) buffer in System 303-0 Zmacs on 2026-07-18. The image records the editor's pane, mode line, and who-line layout before test text was inserted.

Runtime observation — pressing Help twice displayed the live ZWEI documentation dispatcher in System 303-0 Zmacs on 2026-07-18. This confirms the choices exposed by that loaded world rather than merely repeating a manual table.

Runtime observation — Meta-X Text Mode Return changed the same System 303-0 Zmacs buffer's visible mode line to ZMACS (Text) on 2026-07-18.

Runtime observation — Meta-X Lisp Mode Return restored ZMACS (LISP) and displayed the command completion message in System 303-0 on 2026-07-18.
These are runtime evidence, not manual figures. A content-specific review found their limited use beside historical and behavioral analysis supportable as fair use for criticism, comment, scholarship, and research. That conclusion does not depend on treating the entire LM-3 tree as openly licensed: the restrictive LMI notice found in the tree belongs to the unrelated Tape subsystem, while the visible ZWEI and window-system source identifies MIT copyrights. The catalog records the complete rationale and excludes the PNGs from any project-wide license.
The ignored session run record is 6,794 bytes with SHA-256 1ca81f78ed8e93b8a86330ab237da8112fc4e7f9d0ad9c5f4d280445e46008df. Shutdown completed without force; the emulator and Xvfb exited zero, the base disk was unchanged, and the harness records no incomplete state.
The full local runtime evidence and action sequence remain under the ignored CADR computer-use session tree. See the CADR computer-use harness article for the provenance schema and its current warm-resume limitation.
What the manuals and generated help do not prove
- A command name in generated help proves that the command was registered in that built environment; it does not prove that every dependency was usable.
- A literal key form proves an initial table entry. Parent tables, modes, aliases, patches, and user installation determine the effective binding.
- The System 46 tags prove that a Zmacs source file existed when the tag table was made. They do not recover the absent file's contents.
- Six System 46 binding targets are absent from the source-present command set. Two are explicitly unconverted TECO operations; three are named in tags from missing modules; the Dired complement-no-delete target remains an open question. A configured cell is not proof that its target loaded successfully.
- In System 303,
*ZMACS-BUFFER-NAME-READING-COMTAB*is declared but never initialized or referenced by the exact active corpus. It is evidence of stale or unfinished state, not an active table merely because its variable exists. - System 303's extended-pattern finite-state search explicitly signals an error when asked to run backward. Ordinary reverse string search is a separate path; the limitation is specifically complex backward extended search.
- Dired's short
EandVlabels conceal type-sensitive behavior. On a directory entry, Edit enters another Dired view and View opens a directory viewer rather than treating the entry as a text file. - A fresh Mail composition selects Text mode and enables the Mail minor mode, but the retain-existing-contents path skips that reset. A retained Mail buffer can therefore preserve prior editor state.
- Edit Buffers documents
Uas canceling all requested operations, but the inspected implementation writes column zero three times rather than clearing the three operation columns. Static analysis therefore suggests that some save, revert, or print marks can survive. This is a probable implementation bug, pending runtime verification. - ZWEI's reusable editor streams, Dired, ZTOP, and Mail modes show multiple editor embodiments. They are not evidence for four independent editor lineages.
Sources
- MIT CADR System 46,
comtab.115,modes.49, anddoc.31, revision8e978d7; verified 2026-07-18. - LM-3 System 303,
sysdcl.lisp,comtab.lisp,zmacs.lisp,modes.lisp,search.lisp,dired.lisp, andstream.lisp, check-in4df393c; verified 2026-07-18. - Daniel L. Weinreb, A Real-Time Display-oriented Editor for the LISP Machine, 1977; verified 2026-07-18.