Emacs: Editor For Everyone

January 2, 2016

Categories: Technical Tags: Emacs

Emacs?

Yes Emacs. The arcane text editor with the legendary learning curve. The editor that sparks fear in the heart of programmers, the very people it was built for. A labyrinth so mazy that a second visit gets plastered on top of list of things never to be tried again. Life is a lot better when we are convinced of using simpler tools for what is quite clearly a simple task.

And that rationale does have a solid ground for it’s backed up with precise cost-benefit analysis. The upside of switching, on the face of it, may take even months to get level with our current workflow while the problems we face demand the best of us right now.

About me

And that’s where I stood not many months ago. I remember being thoroughly demoralized when I tried out both of Vim and Emacs before. But then what brought the change was a lazy afternoon, some curiosity and a whole lot of randomness. Naturally you will have a hard time with the last one, hence this admittedly blatant advocacy.

Needless to say, your mileage will vary. I do have a little programming background, but I say these from the perspective of someone who writes a significant amount of non-technical text everyday. If you write at least 1k words daily, I believe learning Emacs is a great favour you can do for yourself.

That damned first impression

So the foremost barrier to adoption is that Emacs is a drastically different paradigm, it’s just so alien from what we are accustomed with. I mean the first time you fire it up, it looks like something straight out of the 80s (not sure that’s not doing 80s some disservice). And what’s with the cryptic keybindings that make every tutorial read like ancient rune?

But a call for reflection

Naturally, the tools you already use have their points. I may evangelize but at least it is not the intent to bash anything here, but to nudge you towards thinking about a few questions at best. For example if I say that traditional text navigating is cumbersome with keyboard and that one needs frequent help from the mouse, can it be disputed? Or to take a step back, would you agree if I propose that this switching back and forth is relatively more disruptive to the flow of thoughts compared to an editor that all else being the same doesn’t have this problem?

All else are emphatically never the same but here is the play, in Emacs you can still use mouse but there is no place for it if you want to use it the right way. Because in Emacs all of editing and navigation is perfectly and efficiently doable with keyboards without even going for arrow keys. And overtime this mechanical process of editing and navigation becomes part of the muscle memory, and over time then one could only be left with their thoughts, as it should be.

This is not to say mouse is inherently a bad idea. Plan 9 and Acme? This is more about a great overarching philosophy and design, something you can’t really give others much credit for.

Anyway, this is more of how it is, than what it is. Not something to fret over, but to file away. But to confront the more intriguing question:

What is Emacs?

A text editor? Duh. A web browser? A PDF viewer? Music player? Mail Client? File Browser? Any of them? All of them? Yes.

None of them? Yes, that too.

Because those are something Emacs can do, but not the essence of what Emacs is. Beneath all bells and whistles what remains is that Emacs is a Lisp interpreter. It’s the forgotten VM. Buried deep down, there is a small core of hair raising C core tethering it to the physical world, taking care of stuffs like graphics and other low level effect. Alongside, it implements a bytecode interpreter for elisp, and the rest of Emacs is a ton of lisp code building a literal empire atop. Said interpreter and bytecode is optimized for text handling which facilitates its being a text editor, but elisp is a turing complete general purpose programming language. The live system with its fabled customizability or any other quality is a derivative of that fact.

Okay but what’s with those defaults

We are talking about the horrible and threadbare UI and defaults. If it’s not an accurate representation of what’s underneath, then why is it the way it is? Hmm this is a nuanced question. And the first point to start with is ideological in nature and seen quite often in free and open source softwares. The idea is that, Emacs wants to make as little assumptions about the user as possible, and Emacs hands it over to them so that they have the freedom to tweak things as they deem fit. The motive (which is distinct from the efficacy) is to liberate the user, it is just that ironically this tends to scare away a lot of new users. Secondly, lest we forget, Emacs is like ~40 years old now. Computing and software used to be vastly different. Being from that bygone era, unsurprisingly it picked up lots of cruft over the years. Finally, since its development is people driven, obviously it is more aligned to the needs of those who use and contribute to it, which tends to be programmers mostly. So out of the box, any other needs are naturally under represented.

But this is where the insane customizability and extendibility comes to the rescue because it allowes Emacs to be moulded to become a jack (and master) of many trades. It’s likely that no two Emacs guru would find each other’s setup very palatable, because by nature it’s something personal and grows with one organically.

But of course enough of these non-sequiturs, so much hassle for text editing? Really? How is it justifiable?

Because not all seconds are worth the same

You are essentially trading your free leisure time spent learning Emacs not with equal amount of time saved using it, rather with time and mental energy saved during critical times. Ideally one might want them to be, but not all time are worth the same value. When you need to be fast because maybe the deadline approaches, any time and effort saved is worth so much more. So despite the net time saved being (apparently) negative, it can still yield higher net benefit.

About the net benefit

Even the net time saved is going to be overwhelmingly positive overtime because knowing Emacs will probably revolutionize your workflow for good. When thinking about cost-benefit, we often don’t do a good job of enumerating the future streams of benefits. But a little investment now opens up a constant source of them.

And if you do value your free time highly….

Which is what everyone does and should, and okay, this might not be your idea of fun, but when you use Emacs, under your fingertip you have the flagship FOSS project that likely predates your OS, shaped a culture and ushered a new era. It’s the closest you can have to a Lisp Machine. I find it not just inspiring but also a lot of fun.

One of the earliest criticism of Emacs from the Vim crowd was that it’s a Great OS but with a terrible editor. This is in relation to Emacs having a feature bloat beyond being just an editor that made it somewhat sluggish on ancient hardware. And that’s at a time when “8 megabytes and swapping” made sense as a jibe. With the progress in computation, that stopped being relevant decades ago. Today Emacs is several times lighter on resource than most of the alternatives. As for the features, discovering everything in it would require you years of mastery, but of course you can choose to pay for only what you want.

Emacs is interactive. I wonder why it’s not used more to acquaint people with computation. You can modify parts of expressions, and evaluate it in one key press to watch the result in the same buffer. It’s like REPL on steroid that can easily become so much more.

Now for something completely different

These are a few examples I have amassed about writers using Emacs:

In the GNU/Linux world there are two major text editing programs: the minimalist vi (known in some implementations as elvis) and the maximalist emacs. I use emacs, which might be thought of as a thermonuclear word processor. It was created by Richard Stallman; enough said. It is written in Lisp, which is the only computer language that is beautiful. It is colossal, and yet it only edits straight ASCII text files, which is to say, no fonts, no boldface, no underlining. In other words, the engineer-hours that, in the case of Microsoft Word, were devoted to features like mail merge, and the ability to embed feature-length motion pictures in corporate memoranda, were, in the case of emacs, focused with maniacal intensity on the deceptively simple-seeming problem of editing text. If you are a professional writer - i.e., if someone else is getting paid to worry about how your words are formatted and printed - emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish.

Not exactly extensive, even though I could be missing a lot. Full blown books require a lot more refining efforts, but otherwise Emacs is perfect for doing drafts and organization. Close integration with LaTeX, or full blown Unicode support are just some of the niceties.

If I really wanted to sell you on it, I would have started with all the amazing packages that builds on Emacs. Magit, Olivetti Mode, Markdown Mode, Pandoc Mode, RefTeX mode etc. are part of my process already. But neither of us have that much time, so I will just show you the killer of them:

Org-mode!

Org-mode is easily the biggest draw of Emacs for the likes of us. It’s a rabbit hole in itself, another whole realm inside Emacs and I can’t even begin to describe it in full. Let’s just say, it’s a Swiss army knife. It’s a mode for keeping notes, maintaining TODO lists, planning projects, and authoring documents with a plain-text system (This bit is so important to me. Just plain-text thank you. Can’t stand more of proprietary non-portable formats). Take a look at the feature sets.

To quote an excerpt verbatim again: “At its core, Org-mode is a simple outliner for note-taking and list management. You can learn the basics for using it in five minutes. This may be all you need, and Org-mode will not impose more complex features on you. The full feature set is both broad and deep, easy to access, but unobtrusive.”

The wikipedia page has a section on a brief description of functionalities. One is quite likely to find a use out of it, I believe.

So where to begin

That’s the only question innit. I wish I knew of a more concrete path, but a feasible answer literally is: just fumble around a bit, and you will get the hang of it. Make sure you reach the tutorial, the built-in one is quite sufficient to start with. Watch a few Emacs Rocks videos for inspiration, there are other more technical one in youtube. Mastering Emacs is a very good book, if you prefer that. But generally there is a ton of information online, the emacs wiki is great. Here is writer talking about his process.

That’s me done with

I think every Emacs user at some point early in their Emacs life produces a rant similar to this in their nice little echo chamber, I suppose this is mine.