Getting Started with Emacs

Ah, I see you’ve heard rumors of a secret editor used by ancient mystics to craft code like nobody’s business? The legends are true,1 however, you’ve probably heard that it requires 10 years of study before you can master the system we call Emacs.

Mastery is an illusive goal, but you can be useful quite quickly, and I will guide you… at least, for a little while.

Choose a Version

Emacs, like many successful open source projects, has many variations. With a single, notable exception2, it shouldn’t really matter at this point.

I would recommend you install a graphical version of Emacs. I know, it doesn’t look as old-school as something running in a terminal, but that’s fine. It still looks more venerable than Sublime. If you are running on a Mac, grab Aquamacs.

If you are a VI user, I hear good things about Spacemacs.

What about the Keyboard?

Mastering any IDE requires that you master all the cool keystrokes. If you are using Aquamacs, many of the standard Mac shortcuts work as you’d expect. If you aren’t on a Mac, just use the menu and toolbar. Sure, it isn’t much better than Notepad, but that is good for now.

Use the arrows. They act just like they do in any other Editor.

If you are VI user, you may want to eschew what I just said, and install Evil mode. Don’t worry, using a VI interface is fine. Emacs’ power isn’t in its keyboard shortcuts. It is what is under the hood.

What about Emacs Pinkie?

The traditional key bindings for Emacs began as simple mnemonics, but I’ll admit, they suck. They are rooted in eons lost to time; where keyboards had limited keys to choose.

We call the Control and Alternate keys, modifiers, and with most keyboards, those modifiers are on both sides of your keyboard. Use them so that both hands are involved. For instance, get to the end of the current line using Control-e, however don’t use the control on the left side of the keyboard, use it on the right.

Speaking of Control, on most keyboards, that sucker is too far away. Use your operating system to re-bind it to the Caps Lock which is closer to the keyboard.

One problem with my advice is Mac’s do not typically have a Control key on the right side. I would recommend installing KeyRemap4MacBook and have the Return key act like a Control key, but only when it is pressed in combination with another key. Doing both steps gives you two Control keys at the same position on each side of the keyboard.

How to Learn

While you can get by with arrow keys and selecting items from the menu, I know you, and you won’t be happy until you’ve more proficient than that. Start with hitting Control-h and then the t key, to start up the Emacs tutorial.

Next, watch Jekor’s Online Emacs Screencasts. He has a really nice way of introducing the concepts of getting around the Beast.

What About Org Mode?

It is true. After the power and flexibility of crafty Emacs to your nefarious wishes, org-mode is the next best reason to use Emacs. Yes, you must use it.

The nice thing about org-mode is that it is just text files (that end in .org), so it doesn’t take much to start taking notes. However, once you see the power it offers…well, start with this screencast, and then go through this org-mode tutorial.

Summary Advice

In interview with Magnar Sveen, he gives some good advice in learning Emacs:

  • Learn Emacs on its own. Don’t try to “learn Emacs and Clojure” for instance. I would suggest learn new tools before you have to use it.
  • Grab a friend who already knows it. I would suggest that if you don’t have that, at least learn it with a friend who is also learning it.
  • Everyone has their own way of learning something new, so whether you make flash cards, graphical notes, or whatever, use what you know works for you.

Unless Sacha Chua got you first, let me know if I can help.

Footnotes:

1

If you are not sure that Emacs is the One for you, perhaps catch the enthusiasm in some of the Emacs Rocks videos, or my Why Emacs essay.

2

Many of us greybeards call XEmacs, the One True Distraction.