GNU Emacs 22.3 for VAX OpenVMS 7.3 (with 19.28 and 21.2)

GNU Emacs 22.3 for VAX OpenVMS 7.3 (with 19.28 and 21.2)

Three weeks ago I released a kit with Emacs 19.28 and 21.2 for OpenVMS VAX 7.3. Today’s kit adds GNU Emacs 22.3 – the last Emacs with any VMS support in it – and makes it the default. All three versions install side by side from one kit, and all three are tested on VAXstations 4000/96, 4000/60 and 4000/90 and a simulated MicroVAX 3900. 22.3 also runs on a VAXstation 3100 M38.

Claude Code assisted again, which is to say, did much of the hard work.

Downloads, with SHA-256 sums in SHA256SUMS.TXT:

  • Binary kit (73 MB): three BACKUP savesets, the installer, the test suite and a README.TXT.
  • Source kit (196 MB): the complete source of all three versions as built, plus the three unmodified upstream archives they came from.
  • README.TXT and SHA256SUMS.TXT.

What is new

  • Emacs 22.3, from Eric Brown’s OpenVMS x86-64 port of 22.3 (which itself carries Thien-Thi Nguyen’s 21.2 VMS layer forward). Plain EMACS now starts it; EMACS19 and EMACS21 still start the others, and a site can pick the default with the logical name GNU_EMACS_DEFAULT.
  • 22.3 is fast enough to live in. The first build started in 12 seconds on a 4000/96 and took 12 seconds for a file-name completion; this one starts in 2.5 seconds in batch and 6 with a terminal, and completes in about 3 (just over a second the second time). Most of the old time was a GNU 22.3 bug in VMS file names that made 76 start-up probes each search the whole load path, and a check that read every page of the 5.8 MB dump file at every start.
  • The dump check is now on demand. Emacs checks at start only that its dump file belongs to the image being run (and refuses a mismatched one with a clear message). The full check of every byte is still there: DEFINE EMACS_DUMP_CHECK FULL at start-up, or M-x vms-verify-dump-file in a running Emacs.
  • Font lock is off by default in 22.3 on the VAX: paging through a C file is about twice as fast without it. One line in your .emacs, (global-font-lock-mode 1), turns it back on.
  • 21.2 got faster and saner subprocesses. M-x shell of a 600-file DIRECTORY went from 11 seconds to under 2 on a 4000/96; a subprocess that runs one command now actually exits, so its sentinel runs; a failing command reports its VMS status instead of “user defined signal 1”; delete-process no longer hangs on an idle DCL; INQUIRE in a subprocess command no longer hangs it. All of these are in 22.3 too.
  • M-x vms-resize asks the terminal its size and redraws; the kept editor asks the terminal before it attaches, so a resized window is picked up when you come back to Emacs.
  • Fits in 32 MB, measured for the first time: with 22.3 and a shell running on a 32 MB VAXstation 3100 there are still 13 MB free. On a simulator with 16 MB, 22.3 still passes its built-in test suite.

Installing

Exactly as before: the savesets in binary, the .COM, .EL and .TXT files in ASCII (or unzip on the VAX, which gets both right), then as SYSTEM:

$ @EMACS_KIT_INSTALL CHECK
$ @EMACS_KIT_INSTALL

It installs 22.3 under SYS$SYSDEVICE:[GNU.EMACS22] beside the other two, offers to add the login lines to SYLOGIN.COM (it asks first), and runs the regression suite for all three. Installing over the previous kit is safe: every file ends up as exactly one version.

@SYS$SYSDEVICE:[GNU]EMACSTEST ALL from any account runs the suite yourself: 342 checks for 22.3, with its one known bug named in the output rather than hidden.

Porting 22.3 to the VAX

Eric Brown’s 22.3 port targets VSI C on x86-64. The VAX has Compaq C V6.4 from 2000 and VMS 7.3’s C library. It took 47 commits on top of his tree; the interesting ones:

  • The compiler took 22.3’s portable C without a single language error. Everything that broke was configuration, the build, or a C library entry point x86-64 has and VAX 7.3 does not (lstat, symlink, readlink, fchmod).
  • alloca. In 21.2, Compaq C for VAX inlined a function that calls its alloca builtin and then kept using stack-relative addresses after the stack had moved – every file-name completion crashed. For 22.3 the VAX build uses Emacs’s own alloca.c instead, as 19.28 always did. The whole class is gone: all 66 optimised modules were listed in machine code and scanned, and the scanner was first shown to find the old bug in 21.2’s listing.
  • The first dump failed loading files.el: “Wrong type argument: listp”, then a crash printing the error. One bug, found in the machine listing: Emacs’s call2 passes the address of its first argument as an array of all three, which is only true of a real VAX CALLS argument list – and the compiler had inlined call2 into defmacro, where the “array” was two unrelated stack words. Emacs has a switch for exactly this, NO_ARG_ARRAY; the VAX needed it and nobody had needed it before.
  • The installed tree found three more that a build tree never showed: dired dropped the first two characters of every file name (so RET opened a “new” file), an installed 22.3 looked for its terminal descriptions in /etc/termcap, and the kept editor corrupted the heap at every C-z by freeing a string it did not own. Each is one small commit now.

Fixes that are not VAX-specific are on their way to Eric Brown for his x86-64 port.

Rebuilding

The source kit has each version’s complete tree. For 22.3, unzip it under your own account on a VAX with Compaq C and MMS, then

$ SUBMIT/NOPRINT/LOG_FILE=SYS$LOGIN:E22.LOG -
      /PARAMETERS=(CONFIGURE) dev:[dir]BUILD_EMACS22.COM

configures, builds and dumps it (about 25 minutes on a 4000/96, 6 on a simulator), and /PARAMETERS=(INSTALL) as SYSTEM installs it. The dump is 11,385 blocks.

Known limitations

  • Terminal only; no DECwindows.
  • A 4000/60 is about two and a half times slower than a 4000/96: 22.3 starts there in about 16 seconds with a terminal, and the first completion in a big directory takes about 9.
  • In 21.2, text sent to a subprocess the instant it starts can arrive cut to its first character; send once the program has prompted. (22.3 waits for the program to read.)
  • In a -batch script, 22.3 runs process sentinels only in waits that redisplay.
  • M-! in 22.3 can be slow in some accounts: M-! SHOW TIME took about 2 seconds as one user on a 4000/96 and a 4000/90, but 0.6 seconds as another user on the same machine. It depends on the account, not the machine, and the cause is not found yet.
  • The first C file you open loads cc-mode, which takes 18 seconds on a 4000/96 and 55 on a 4000/60, once per Emacs session.
  • A VAXstation 3100 M38 is about 2.5 times slower than a 4000/60: 22.3 starts there in about 41 seconds with a terminal.
  • 19.28 is frozen as it is: run-at-time does not fire in batch mode.
  • The full list is in README.TXT, section 8.

How this was done

The same way as last time: a Claude session that plans and reviews, and a fresh Claude Code session for each run with a written brief, on two VAXstations and a simulator – with the rule that nothing counts until a script fails without the fix and passes with it, on the simulator and on real hardware, with the transcripts kept. This round, the lesson was to test the installed tree interactively before calling a version the default: three real bugs lived only there.

Credits: Eric Brown for the OpenVMS x86-64 ports of 21.2 and 22.3 this builds on, Thien-Thi Nguyen for the 21.2 VMS port, Richard Levitte for the 19.28 VMS port, and Claude Code (Anthropic’s Claude models) for much of the porting, testing and writing.