Everything Is a Command

Daniel de Haas has a post that I really like. In it, he sings the praises of the Emacs idea that everything is a command. If you’re an Emacser that may seem obvious but imagine not being familiar with Emacs and deciding to write an editor. Chances are you’d have a hard coded table that mapped keystrokes to actions or perhaps even some giant switch on key input with the appropriate code right there. That’s not just another legitimate alternative, it a terrible choice but one that the majority of editors make.

For example how would you enable the user to change the bindings if they need or want to? It’s virtually impossible. And it’s not just the basic navigation commands that can’t be remapped. There is no way to define and map alternative commands for more complicated editing commands. All that’s is easy in Emacs because

  1. Everything is a command, and
  2. Keybindings are kept in runtime editable structures.

In Emacs, even inserting a character into the current buffer when a key is pressed is a command. That means that if the user wants to perform some sort of filtering or translation of text input, it’s easy to do.

It also means, as de Haas says, that with Emacs you have a universal command palette. Every command, and therefore every action, can be brought up in a list to choose from. And it’s easy to combine those commands into a more complex action without knowing more than a modicum of Elisp.

The reddit comments to his post are also interesting. There’s a ton of ankle biting and uninformed commentary but there are also a lot of interesting comments that are on point and worth reading. Take a look at de Haas’ post and, if you have some spare time, the comments. It’s really interesting.

This entry was posted in General and tagged . Bookmark the permalink.