Eshell's unnamable quality

Eshell's unnamable quality

There are many great packages. Packages like smartparens and company, that extend Emacs with invaluable functionality. But some packages are special, because they do more… they extend Emacs' extensibility. They increase Emacs' potential, make it applicable to more domains, let you slurp up more of your operating system and add opportunities for code reuse.

Some of them are:

  • eshell
  • exwm
  • exwm-edit
  • piper

These packages touch on a grander concept I will introduce shortly, but first I must explain what I see in Eshell.

The Way of Eshell is to abandon the concept of a terminal emulator, abandon the past and move into the future. The project has no plans to support escape codes (aka control codes) or interactive behavior, because controlling the shell buffer in realtime is considered out of scope for commands run by the shell.

Commands should be simple input-output machines and have no knowledge about their context. There is no need for each command to have twenty different command-line flags to shape the output into the form you want it – that's better done by an universal text-shaping tool, such as a text editor. You can alternatively use Unix commands like uniq, column and sort, but once you've exhausted what the commands can do, you may still have to make ad-hoc changes to the output as if in a text editor, so why not be in a text editor while you're doing it?

And better, once you're done editing the output with your everyday text-editing skills, you should be able to pipe it into another command without running into doubts as to which combination of echo, tee, xargs and cat applies this time (doubts strong enough that many have never thought of piping into vi). So you get to have a command pipeline without having to execute the pipeline in one step!

You don't need to iterate in a "compile-cycle" process until you get the whole pipeline just right. You can see what happens at each step, you don't need to pollute your shell history with irrelevant failed attempts, you can hone your text-editing arts, you'll have access to all the info your editor knows (say, the name of the file that's currently open in another window), you don't need to look up the specific shell commands to extract a specific piece of git information or system information (because you can get that info the same way you always do in your editor), and you'll never need to learn about commands like uniq, column or sort, or for that matter what even is Unix. Unix-nostalgia aside, that is scalable, beautiful and future-proof.

When you learn to abandon the Unix tools in favour of a more reusable and extensible workflow, you'll glimpse the deeper Zen underlying Emacs. The article Programs Are A Prison explains better than I can. Notice that it mentions that a good program should be "invisible", that it should lack boundaries, and eshell is a vivid example of that. Eshell is a much less distinct "application" than an external terminal window, and less distinct than ansi-term and even the polite shell mode. There is less of a sense that "Now I'm in the shell" or "Now I'm out of the shell". Its buffer is as malleable as any other buffer, and since you may do part of your command editing in separate buffers from eshell itself, it blurs the boundary of where the shell begins and ends.

What links here

Created (5 years ago)