A text editor as a user interface

33 points by jbauer


zetashift

Oh this type of discussion is my JAM! The intersection of text, editing text and good UX is actually very interesting, as there are several ways to tackle this, but it's very different how people usually learn how to work with computers(menus, forms, modals etc), but conceptually "it's just text" should be simpler. I guess it's harder to get predictable tooling around it though.

Here are some interesting related links related to text editors(that are not Emacs related, because Emacs can be everything):

tsion

I love tools like this. A few I'm aware of:

Screwtape

Another great example of text-editor UI is git rebase -i. The default content is the current branch history, you can use your editor's commands to shuffle commits around however you like, and there's a field on each line that lets you control how that commit is handled. Even better, below the content is the human-readable documentation for how it works and what all the fields and values mean - as a quick reference, and as fodder for your editor's keyword completion.

There is a lot of scope for making pleasant, powerful UIs that serialise data for editing in a text editor, then parse it back out.

natfu

Something that often comes up with using Emacs is that every buffer (an Emacs window with specific behaviors related to file types OR usage; called modes. For example, python-mode or a temporary compilation buffer, or a search buffer if you grep into a code base, etc) is basically text.

There's a great example from tsoding where he uses multiple cursors and a directory buffer (dired) to make changes to multiple files at the same time. Note that these "modes" do not know about each other nor were they developed with that specific interaction in mind. It's just that applying one transformation (renaming a file) by selecting text naturally composes with multiple cursors.

You can see this in other places, where it's possible to select parts of a buffer (narrowing) and apply transformation to text only there. Another one: using minor-modes to map some commands to specific actions like auto-evaluating a buffer and sending to the REPL or inferring compilation commands from a major-mode, etc.

The fact a buffer and all its sub-components: regions, words, characters,... can be used as input to other buffers or commands because it's just text everywhere, is really powerful.

k749gtnc9l3w

And then it blends into editor modes / quasi-modes / special-case bindings…

One interface I use is a filesystem to access the data — then a script to create summaries in comments and commands to manipulate via the filesystem (mostly rm to mark as read) — then Vim to skim and maybe drill down (via open-the-file-by-filename bindings) and to change/remove/keep manipulation commands — then the result is just fed to shell.