Getting started with lightweight alternatives to GNU Emacs

Slimmed-down (in size and features) alternatives allow you to take your text editor anywhere you go.
84 readers like this.
Text editor on a browser, in blue

I work on a lot of servers, and sometimes I find a host that hasn't installed GNU Emacs. There's usually a GNU Nano installation to keep me from resorting to Vi, but I'm not used to Nano the way I am Emacs, and I inevitably run into complications when I try to save my document (C-x in Nano stands for Exit, and C-s locks Konsole).

While it would be nice to have GNU Emacs available everywhere, it's a lot of program for making a simple update to a config file. My need for a small and lightweight emacs is what took me down the path of discovering MicroEmacs, Jove, and Zile—tiny, self-contained emacsen that you can put on a thumb drive, an SD card, and nearly any server, so you'll never be without an emacs editor.

Editing macros

The term "emacs" is a somewhat generic term in the way that only open source produces, and a portmanteau. Before there was GNU Emacs, there were collections of batch process scripts (called macros) that could perform common tasks for a user. For instance, if you often found yourself typing "teh" instead of "the," you could either go in and correct each one manually (no small feat when your editor can't even load the entire document into memory, as was often the case in the early 1980s), or you could invoke a macro to perform a quick swap of the "e" and "h."

Eventually, these macros were bundled together into a package called editing macros, or EMACS for short. GNU Emacs is the most famous emacsen (yes, the -en suffix is used to describe many emacs, as in the word "oxen"), but it's not the only one. And it's certainly not the smallest. Quite the contrary, GNU Emacs is probably one of the largest.

Fortunately, GNU Emacs is so popular that other emacs implementations tend to mimic most of the GNU version's basic controls. If you're looking for a basic, fast, and efficient editor that isn't Vim, you'll likely be happy with any of these options.

MicroEmacs

µemacs

MicroEmacs, also known as uemacs (as in the Greek letter µ, which denotes "micro" in scientific notation), was written by Dave Conroy, but there's a long list of users who have cloned it and modified it. One user who maintains a personal version of µemacs is a programmer named Linus Torvalds, and his copy is available from his website, kernel.org (which also, incidentally, includes a small side project of his called Linux).

Size

It takes me five seconds to compile µemacs at the slowest setting I can impose on my computer, and the resulting binary is a mere 493KB. Admittedly, that's not literally "micro" compared to the typical size of a GNU Emacs download (1 millionth of 70MB is 70 bytes, by my calculation), but it's respectably small. For instance, it's easy enough to send it to yourself by email or over Signal, and certainly small enough to keep handy on every thumb drive or SD card you own.

By default, Linus's version expects libcurses, but you can override this setting in the Makefile so that it uses libtermcap instead. The resulting binary is independent enough to run on most Linux boxes:

$ ldd em
linux-vdso.so.1
libtermcap.so.2 => /lib64/libtermcap.so.2
libc.so.6 => /lib64/libc.so.6
/lib64/ld-linux-x86-64.so.2

Features

The keyboard shortcuts are just as you'd expect. You can open files and edit them without ever realizing you're not in GNU Emacs.

Some advanced features are missing. For instance, there's no vertical buffer split, although there is a horizontal split. There's no eval command, so you won't use µemacs for Lisp programming.

The search function is also a little different from what you may be used to: instead of C-s, it's M-s, which could make all the difference if your terminal emulator accepts Ctrl+S as a freeze command. The help page for µemacs is very complete, so use M-x help to get familiar with what it has available.

License

The license for µemacs is custom to the project with a non-commercial condition. You're free to share, use, and modify µemacs, but you can't do anything commercial with it.

While not as liberal a policy as I typically prefer, it's a good-enough license for personal use; just don't build a business around it.

GNU Zile

GNU Zile

GNU Zile claims to be a development kit for text editors. It's meant as a framework to enable people to quickly develop their own custom text editor without having to reinvent common data structures. It's a great idea and probably very useful, but as I have no interest in making my own editor, I just use the example implementation that ships with its codebase as a pleasant, lightweight emacs.

The build process for the example editor (supposedly called Zemacs, although the binary it renders is named zile) is the standard Autotools procedure:

$ ./configure
$ make

Size

Compiling it from source takes me a minute on one core or about 50 seconds on six cores (the configuration process is the long part). The binary produced in the end is 1.2MB, making this the heaviest of the lightweight emacsen I use, but compared to even GNU Emacs without X (which is 14MB on my system), it's relatively trivial.

Of the lightweight emacsen I use, it's also the most complex. You can exclude some library links by disabling features during configuration, but here are the defaults:

$ ldd src/zile 
linux-vdso.so.1
libacl.so.1 => /lib64/libacl.so.1
libncurses.so.5 => /lib64/libncurses.so.5
libgc.so.1 => /usr/lib64/libgc.so.1
libc.so.6 => /lib64/libc.so.6
libattr.so.1 => /lib64/libattr.so.1
libdl.so.2 => /lib64/libdl.so.2
libpthread.so.0 => /lib64/libpthread.so.0
/lib64/ld-linux-x86-64.so.2

Features

Zile acts a little more like GNU Emacs than µemacs or Jove, but it's still a minimal experience. But some little touches are refreshing: Tab completion happens in a buffer, you can run shell commands from the mini-buffer, and you have a good assortment of functions available. It's by no means a GNU Emacs replacement, though, and if you wander too far in search of advanced features, you'll find out why it's only 1.2MB.

I've been unable to find in-application help files, and the man page bundled with it is minimal. However, if you're comfortable with Emacs, Zile is a good compromise between the full 14MB (or greater, if you're using a GUI) version and the extremely lightweight implementations.

Jove

Jove

Jove was my first tiny emacs and remains the smallest I've found yet. This was an easy discovery for me, as it ships with Slackware Linux and, with a surreptitious symlink, quickly became my personal replacement for the Vi binary. Jove is based on GNU Emacs, but the man page cautions that feature parity is by no means to be expected. I find Jove surprisingly feature-rich for such a small binary (in fact, this article was written in Jove version 4.17.06-9), but there's no question that renaming .emacs to .joverc does not behave as you might hope.

Size

It takes me five seconds to compile Jove at the slowest setting (-j1) and about a second using all cores. The resulting binary, confusingly called jjove by default, is just 293KB.

The Jove binary is independent enough to run on most Linux boxes:

$ ldd jjove
linux-vdso.so.1
libtermcap.so.2 => /lib64/libtermcap.so.2
libc.so.6 => /lib64/libc.so.6
/lib64/ld-linux-x86-64.so.2

Features

Jove has good documentation in the form of a man page. You can also get a helpful listing of all available commands by typing M-x ? and using the Spacebar to scroll. If you're entirely new to emacs, you can run teachjove to learn Jove (and emacs, accordingly).

Most common editing commands and keybindings work as expected. Some oddities exist; for example, there's no vertical split, and Tab completion for paths in the mini-buffer is non-existent. However, it's the smallest emacs I've found and yet has a full GNU Emacs feel to it.

Try Emacs

If you've only ever tried GNU Emacs, then you might find that the world of emacsen is richer than you may have expected. There's a rich tradition behind emacs, and trying some of its variants, spin-offs, and alternate implementations is part of the joy of being comfortable with how emacsen work. Get to know emacs; carry a few builds around everywhere you go, and you'll never have to use a substandard editor again!

What to read next
Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

10 Comments

I would start this post with a HUGE caveat: all "emacs alternatives" presented here (unlike the real emacs flavours), are nothing more than using "emacs mode" on a text editor. Emacs isn't just an editor with some contrived keyboard scheme, but a full blown Lisp interpretor, where you can rewrite it's core functions on the fly during operation. Without that you have no ability to expand or configure the editor either through scripts, commands evaluation, modules (meaning no magit, org-mode, etc), tools integration (shells, compilers, debuggers), nothing but the aforementioned clunky keyboard shortcuts and whatever features the editor writers decided to hard-code into the editor.

Hi Seth, let me start by saying that I really appreciate your writings!
I'm a really avid user of Emacsen, starting with the bundled MicroEMACS (as it was spelled) on Amiga OS 2.0 in early '90s.
Non-extensible Emacsen are usually called "Ersatz Emacs", nowadays my favourite is "mg" that stands for micro GNU Emacs: packages are available on many distros albeit my favourite fork is https://github.com/troglobit/mg since it focuses on portability and compatibility with GNU Emacs (I also maintain a Slackbuild for that, compiled size is ~180 kB with -Os).

In reply to by sethkenlon

I believe the macros which gave emacs its name are Lisp macros. Lisp macros are functions that rewrite bits of code. This allows anyone to effectively extend the programming language to better express the solution to whatever problem they are solving. They are the number one feature most unique to the Lisp family of languages.

If you lock your console with control S, try control Q to unlock it.

Luckily, konsole alerts the user when Ctrl-S has locked it, and how to unlock it. Still, this tip is probably worthy of an article...but it would be a really short article. Thanks for writing it out clearly, though; it's a good point to make.

In reply to by Karel Vervaeke (not verified)

At least the example you mention in the beginning is solvable with TRAMP. Don't run Emacs on your server just open the documents remotely :D

Great point, of course. GNU Emacs makes it really difficult to invent scenarios where it can't fix a problem!

In reply to by Malte Gerdes (not verified)

I think jed (https://www.jedsoft.org/) is an excellent small emacs.

Agreed! Jed is an excellent small emacs. It comes installed on Slackware by default, and it was on my short list to include here, but I eventually decided against it for some trivial reasons (its size footprint fills the same "slot" as Jove, but its list of linked libs matches Zile, so for the purposes of this list it felt redundant in two separate ways).

I do intend to cover it in detail in a future article of its own!

In reply to by JohanSanden (not verified)

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.