Emacs/Emacs philosophy

Designers of UNIX tools often talk about the UNIX philosophy: "A tool should do one thing and one thing well". UNIX developers love their succinct, powerful, command-line tools that they can string together in myriad ways.

And then there's Emacs, a tool which despite its laudable UNIX roots has been mocked for its sprawling natural: the sarcastic vi user sitting next to you may well come up with hackneyed lines about your use of an Eight-meg Memory use Constantly Swapping operating system with a mediocre editor implemented on top of it.

And yet, I would argue that Emacs does indeed represent the UNIX philosophy quite well.

The missing maxim: extensibility edit

I would argue that the early UNIX philosophers forgot to add something to their guide. Something that is so implicitly true for command line tools that it's easy to miss, but becomes a lot more visible when you use things that are interactive.

What they should have said is: "Do one thing well... and also be Turing complete"

What do I mean you say!? How can a tool both do only one thing and also everything? Well, the thing is... it's all well and good doing one thing well, but your actions don't exist in isolation, your tool has to interact with other tools to achieve your overall task.

At the command line this is easy, if you want your grep command to send mail, you just pipe into mail like so

grep root /etc/shadow | mail dave@haxxor.net

But once you start doing things interactively things become difficult. Input and output cease to be simple streams of characters, but a complicated interleaving pattern of events.

In this landscape the analogue of the pipe becomes the application scripting language. And to truly satisfy the UNIX philosophy you have to be highly extensible. And so we meet:

EMACS: the turing complete text editor edit

And this is how we are to understand emacs. A text editor that tries to be as simple as possible in the UNIX philosophy, but also highly extensible.

Now extensibility is hardly something that only emacs offers. Many tools have plugin frameworks and scripting. But emacs is slightly different:

  • Its scripting language, emacs lisp, is simple to use, with many forms of interaction with the editor implemented as language-level features
  • As many features as possible are implemented using this extensibility language
  • Numerous features are provided to help you interact with emacs lisp, and moreover normal day-to-day activities encourage you to interact with emacs lisp.

Emacs is an editor with extensible scripting at its core, not merely provided as an afterthought that only plugin writers understand.