Fun with ersatz-emacs on NetBSD 3.0
Ersatz-Emacs: a Micro-Emacs
Ersatz-Emacs is a tiny Micro-Emacs.
Chris Baird created Ersatz-Emacs, starting with MicroEMACS 3.6 as released to mod.sources and the Public Domain by Daniel Lawrence in 1986, and was itself based on the work of Steve Wilhite and George Jones to MicroEMACS 2.0 (then also public domain) by Dave Conroy.
Chris Baird stripped out most of the features he personally never used from 3.6, played with it for twelve years, completed the key-bindings chart, and wrote a man-page. He called his version "Ersatz-Emacs", referring to a well-known rant from Richard Stallman in a memo,
The key-bindings chart, a handy overview of keybindings, is called "ERSATZ.keys", and is dated on September 14th, 2000.
Ersatz-Emacs is a capable editor, with support for working on multiple files, using multiple windows, and working with keyboard macro's,
I revived an old Arm board, which comes with NetBSD 3.0, and has only a minimal set installed. This means that adding software can be challenging.
Building Ersatz-Emacs on NetBSD 3.0, however, is a piece of cake.
I downloaded the tar-ball for Ersatz-Emacs on this system, unpacked the tar-ball and ran 'make'. And behold, it compiled :)
The compilation ends with the building of an executable, called 'ee'.
Why a Micro-Emacs
I like the elegance of a very small editor, and using the terminal, tmux and terminal applications.
Early 2020, when I started out learning to use GNU Emacs (with vanilla key-bindings), using a Micro-Emacs helped me a lot. A Micro-Emacs felt less intimidating than the full fledged Emacs. I know that this is not rational thinking, and this is all in my head, but it worked.
Ersatz-Emacs is very small indeed. The executable ee is just 39K.
ldd ee ee: -ltermcap.0 => /usr/lib/libtermcap.so.0 -lc.12 => /usr/lib/libc.so.12
Smaller than ed
For comparison: ed on the same Arm NetBSD 3.0 box is 58K.
ldd ed ed: -lcrypt.0 => /lib/libcrypt.so.0 -lc.12 => /lib/libc.so.12
Windows and buffers
Ersatz-Emacs can work with several files and several buffers, and the screen can be split into multiple windows. Like any other Micro-Emacs, windows can only split horizontally (one above the other).
Splitting windows uses the well-known keybindings:
- C-x 2 to split the screen and add a window
- C-x o to go move the-other-window
- C-x 1 to show only one window
Scroll the-other-window up or down with M-C-v and M-C-z.
You won't need much time to get going with Ersatz-Emacs. The keybindings for cursor-movement, searching, and basic editing are the same as in vanilla GNU Emacs, and so is the method for copying or deleting a region.
Filling paragraphs works also the same as in Emacs:
- First set the right margin, with C-u [column-number] C-x f
- Put the cursor (point) somewhere in a paragraph
- Hit M-q
Read the Friendly Manual
Have a look at the great key-bindings chart, and the ee man-page, both shipped in the tar-ball.
You can find the tar-ball at: http://rho.tuxfamily.org/museum/