Why I love Emacs

Emacs isn't a mere text editor; it places you in control and allows you to solve nearly any problem you encounter.
189 readers like this
189 readers like this

I'm a habitual Emacs user. I didn't choose Emacs as much as it chose me. Back when I was first learning about Unix, I stumbled upon a little-known feature in a strange application called Emacs, which was apparently hidden away on my computer. Legend had it (and was proven true) that if you typed emacs into a terminal, pressed Alt+X, and typed tetris, you could play a falling-blocks game.

Tetris in Emacs

That was my introduction to GNU Emacs. While it was frivolous, it was also an accurate indication of what Emacs is all about—the idea that users can reprogram their (virtual) worlds and do whatever they want with an application. Playing Tetris in your text editor is probably not your primary goal on an everyday basis, but it goes to show that Emacs is, proudly, a programming platform. In fact, you might think of it as a kind of precursor to Jupyter, combining a powerful programming language (called elisp, to be exact) with its own live environment. As a consequence, Emacs is flexible as a text editor, customizable, and powerful.

Elisp (and Common Lisp, by extension) aren't necessarily the easiest languages to start out on, if you're used to Bash or Python or similar languages. But LISP dialects are powerful, and because Emacs is a LISP interpreter, you can build applications, whether they're Emacs plugins or prototypes of something you want to develop into a stand-alone project. The wildly popular org-mode project is just one example: it's an Emacs plugin as well as a markdown syntax with mobile apps to interpret and extend its capabilities. There are many examples of similarly useful applications-within-Emacs, including an email client, a PDF viewer, web browser, a shell, and a file manager.

Two interfaces

GNU Emacs has at least two user interfaces: a graphical user interface (GUI) and a terminal user interface (TUI). This sometimes surprises people because Emacs is often pitted against Vi, which runs in a terminal (although gVim provides a GUI for a modern Vi implementation). If you want to run GNU Emacs as a terminal application, you can launch it with the -nw option:

$ emacs -nw

With a GUI, you can just launch Emacs from your application menu or a terminal.

You might think that a GUI renders Emacs less effective, as if "real text editors run in a terminal," but a GUI can make Emacs easier to learn because its GUI follows some typical conventions (a menu bar, adjustable widgets, mouse interaction, and so on).

In fact, if you run Emacs as a GUI application, you can probably get through the day without noticing you're in Emacs at all. Most of the usual conventions apply, as long as you use the GUI. For instance, you can select text with your mouse, navigate to the Edit menu, select Copy, and then place your cursor elsewhere and select Paste. To save a document, you can go to File and Save or Save As. You can press Ctrl and scroll up to make your screen font larger, you can use the scroll bar to navigate through your document, and so on.

Getting to know Emacs in its GUI form is a great way to flatten the learning curve.

Emacs keyboard shortcuts

GNU Emacs is infamous for complex keyboard combinations. They're not only unfamiliar (Alt+W to copy? Ctrl+Y to paste?), they're also notated with arcane terminology ("Alt" is called "Meta"), and sometimes they come in pairs (Ctrl+X followed by Ctrl+S to save) and other times alone (Ctrl+S to search). Why would anyone willfully choose to use this?

Well, some don't. But those who do are fans of how these combinations easily flow into the rhythm of everyday typing (and often have the Caps Lock key serve as a Ctrl key). Those who prefer something different, however, have several options.

  • The evil mode lets you use Vim keybindings in Emacs. It's that simple: You get to keep the key combinations you've committed to muscle memory, and you inherit the most powerful text editor available.
  • Common User Access (CUA) keys keep all of the usual Emacs key combinations but the most jarring ones—copy, cut, paste, and undo—are all mapped to their modern bindings (Ctrl+C, Ctrl+X, Ctrl+V, and Ctrl+Z, respectively).
  • The global-set-key function, part of the programming side of Emacs, allows you to define your own keyboard shortcuts. Traditionally, user-defined shortcuts start with Ctrl+C, but nothing is stopping you from inventing your own scheme. Emacs isn't precious of its own identity. You're welcome to bend it to your will.

Learn Emacs

It takes time to get very good with Emacs. For me, that meant printing out a cheat sheet and keeping it next to my keyboard all day, every day. When I forgot a key combo, I looked it up on my cheat sheet. If it wasn't on my cheat sheet, I learned the keyboard combo, either by executing the function and noting how Emacs told me I could access it quicker or by using describe-function:

M-x describe-function: save-buffer

save-buffer is an interactive compiled Lisp function in ‘files.el’.

It is bound to C-x C-s, <menu-bar> <file> <save-buffer>.
[...]

As you use it, you learn it. And the more you learn about it, the more empowered you become to improve it and make it your own.

Try Emacs

It's a common joke to say that Emacs is an operating system with a text editor included. Maybe that's meant to insinuate Emacs is bloated and overly complex, and there's certainly an argument that a text editor shouldn't require libpoppler according to its default configuration (you can compile Emacs without it).

But there's a greater truth lurking behind this joke, and it reveals a lot about what makes Emacs so fun. It doesn't make sense to compare Emacs to other text editors, like Vim, Nano, or even VSCodium, because the really important part of Emacs isn't the idea that you can type stuff into a window and save it. That's basic functionality that even Bash provides. The true significance of Emacs is how it places you in control and how, through Emacs Lisp (Elisp), nearly any problem can be solved.

What to read next
Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

13 Comments

For me the most fascinating thing about Emacs was (and still is) that you can extend it to all kinds of use cases and situations. The learning curve is sometimes very high, but when a package works Emacs is a helper that doesn't get in your way. And if everything fails just type M-x doctor and everything is easier ;-)

Emacs is also really great as a windowing interface for users remotely logging in over a text terminal interface. You can launch shells in Emacs buffers and copy/paste text between them and document buffers.

This was a really big deal when I was in college and my access to the university's VAXes were via 80x24 text terminals (whether hard-wired or dial-up).

I also think that the "Gnus" news reader (shipped with most builds of Emacs) is the best NNTP news reader ever written.

The joke about Emacs being "an operating system with a text editor included" is not so much a complaint, but a reference to the fact that it is a really good application platform thanks to an incredibly robust LISP programming environment.

> Emacs is also really great as a windowing interface for users remotely logging in over a text terminal interface.

I second that. Even in today's world of GUI based IDEs, there are many times in which you only have a terminal when you are supporting a client remotely. I can troubleshoot things while having a view of the configuration or source code in view using eshell or compare files from two different locations using TRAMP mode (I hate the term but that's how's called).

I have been using Emacs user since my professor made me use it back at school (version 18 if memory serves me well).

In reply to by David C.

The word "tramp" here in New Zealand means "to hike" -- that is, take a long walk for leisure purposes through a natural setting. One might "go for a tramp" or "go tramping" over a weekend. The term within Emacs seems quite appropriate, at least regionally!

In reply to by Papo Anaya

Great point. I feel like when one discovers dired-mode, it can be a game changer. When I found out dired-mode and shell, I basically stopped closing Emacs....ever.

In reply to by David C.

I've got a fun little tale: Back before I'd ever heard of Unix, let alone used it, on the Digital Equipment Corporation's DECsystem-10, running a very non-Unix-like OS, TOPS-10, It had two editors at the time: a character-based editor, TECO (the Text Editor and COrrector) and a line-based editor, SOS (Son of Stopgap). Well, our systems programmer found this new-fangled screen-based editor and installed it: FINE (Fine is Not Emacs). I had no idea what that meant except that it was a fantastic editor. Fast-forward through several OS's to Linux, and lo and behold, I see the name emacs... and find the parent of an old friend there to greet me.

Ah TECO! the infamous paper tape editor.

Emacs was originally short for "Editing MACroS" and the first version was written in TECO.

Back in the days when I was working on Multics, we used to play a game with TECO, as most of its commands were single characters IIRC: type in your initials/name and see what it does.

I see from the wikipedia article that we were not alone in this.

In reply to by Kevin Cole

That's a new game for me. I like it. Lacking single-character commands, my initials combined with Ctrl essentially cuts a newline character. Not terribly exciting, but them's the rules.

In reply to by dgrb

Emacs is the only editor I use. It can be extended with many useful add-ons.

A better Cheat Sheet is the official GNU Emacs cheat sheet.
https://www.gnu.org/software/emacs/refcards/pdf/refcard.pdf

Allowing for subjectivity, I'm biased to the cheat sheet I created. I think at the end of the day, though, the "best" cheat sheet is the one that works for $USER.

In reply to by Rick

Some of those key binding make sense if you're old enough: I started using emacs c1981.

The W in C-W and Alt-W stood for "wipe" and the Y in C-Y for "yank".

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.