Somebody emailed me the other day, asking about how to go about learning Emacs. This is my (edited and rearranged) reply.

I know you’re something of an emacs wizard, so I thought I might as well ask you: how should I learn emacs? … I’ve used emacs for several years now but have not added very much emacs skill to my repertoire.

Well, the short answer is, you should learn Emacs by using it for about a decade. That’s a pretty lame non-answer, so let me try to elaborate.

I started using Emacs in the fall of 1997, as a freshman in college. For at least the first year or so of using Emacs, my Emacs repertoire probably consisted of tens of key bindings (not counting the myriad bindings of self-insert-command, of course), and only a handfull of major modes (c-mode, java-mode, makefile-mode, that might be about it). So basically, for at least a year, my use of Emacs didn’t differ substantially from the average user of, say, Notepad.

I distinctly remember a moment during my sophomore year, while in a professor’s office talking about some assignment or some such, being amazed by some crazy magic he worked in an Emacs buffer, making seemingly very complex edits in a dizzyingly short amount of time. I remember asking what the hell he had just done. He had a good laugh—at this point, I was known among other students as “the Emacs guy,” and yet I didn’t even know how to record or use keyboard macros. This was pretty embarrassing.

I’ve continued to use Emacs this whole time, and it turns out that I’ve learned a lot about it since then. I continue to learn about it every day. The thing is, this isn’t even about Emacs specifically. It takes about ten years of such practice to learn anything well. From Norvig (emphasis his):

Researchers (Bloom (1985), Bryan & Harter (1899), Hayes (1989), Simmon & Chase (1973)) have shown it takes about ten years to develop expertise in any of a wide variety of areas, including chess playing, music composition, telegraph operation, painting, piano playing, swimming, tennis, and research in neuropsychology and topology. The key is deliberative practice: not just doing it again and again, but challenging yourself with a task that is just beyond your current ability, trying it, analyzing your performance while and after doing it, and correcting any mistakes. Then repeat. And repeat again. There appear to be no real shortcuts: even Mozart, who was a musical prodigy at age 4, took 13 more years before he began to produce world-class music. In another genre, the Beatles seemed to burst onto the scene with a string of #1 hits and an appearance on the Ed Sullivan show in 1964. But they had been playing small clubs in Liverpool and Hamburg since 1957, and while they had mass appeal early on, their first great critical success, Sgt. Peppers, was released in 1967.

So how do you get from where you are to using Emacs so much you spend your spare time hacking on various Emacs libraries for fun? Mostly by making a point of using Emacs for all of your editing needs, and allowing Emacs to slowly take over your other computings tasks as well.

For instance, the big application that people typically expand their Emacs-fu with is using Emacs to read mail (see also Zawinski’s Law of Software Envelopment). I recommend trying Gnus. The several weeks you waste trying to figure out how to point Gnus at your mail server more than pays for itself by the amount you learn while driving yourself mad.

Emacs is called “the extensible, customizable, self-documenting real-time display editor.” I want to draw your attention to the self-documenting part. Perhaps the most critical Emacs skills to develop early on is how to navigate and interrogate Emacs’ help features, which are extensive. Type C-h C-h to get started down that path.

(related: what is the best tutorial/book on emacs lisp?)

IIRC I learned elisp via a combination of bumbling, Usenet, and Glickstein but, honestly, I think the elisp manual & tutorial (combined with the Emacs manual itself) are much better than muddling through like I did. (Though, if you’d like, you can borrow my ancient and increasingly-inaccurate copy of Glickstein.)

  • You can get to the elisp tutorial within emacs by typing the following: C-h i d m emacs lisp intro RET
  • You can get to the elisp manual within Emacs by typing the following: C-h i d m elisp RET
  • You can get to the Emacs manual within Emacs by typing the following: C-h i d m emacs RET

Here’s a breakdown of the above commands so you know what each part is about:

C-h i
brings up the Emacs interface to Info, the GNU documentation system
d
goes to the Info root menu (in case you were already somewhere else in Info)
m emacs RET
opens the Info menu item named emacs

For real-time help from friendly experts, try the #emacs IRC channel on Freenode. Eventually, you might try IRCing from within Emacs; there are several IRC clients, including two which ship with Emacs itself.

Comments

  1. Jacob

    I know emacs pretty well after 5 years. Of course I will know it better in 10 years though. I would definitely suggest looking through the emacs manual. Also I think its worthwhile to start grabbing some amazing packages like ido-mode, these can get you excited about elisp when you see the productivity boosters you can get out of extending the editor yourself.

    Jacob, 14 July 2009

  2. Heh. Just had this conversation at work and I asked my co-worker about how long he had been using emacs. He settled on about 15 years. I then asked when it was that he became comfortable using emacs and he said "just a few weeks ago".

    Shawn, 14 July 2009

  3. Great post! The weird thing about emacs is the more I learn about it the less I feel like I know. It's a tinkerer's dream (or nightmare), because there are always new tweaks to make or features to add.

    Kyle Sexton, 14 July 2009

  4. I've been cheating on Emacs with Eclipse lately. This post makes me want to get back into using Emacs full time again. Thanks!

    Nate Drake, 14 July 2009

  5. ido-mode is included in CVS Emacs. I have CVS Emacs packages on my PPA: https://launchpad.net/~hexmode/+archive/ppa

    A couple more package to look at (also included in Emacs CVS) are ERC (for IRC) and org-mode (for... everything else.)

    Mark A. Hershberger, 14 July 2009

  6. mark

    I learned vim for about 4 years and then gave up.

    For me the problem was that it seemed so specific to the editor. And the editors - both vim and emacs - ignore the GUI world largely.

    Perhaps I would have lived with Textmate, if I would use a Mac (but I dont like the mac fanboys so..)

    My opinion is that if an editor takes decades to master, the editor is wrong.

    The user must by definition be right. A tool needs to help, not require permanent learning to master it.

    Because life already is permanent learning and simple things should stay simple and not bound to any specific editor.

    mark, 14 July 2009

  7. Troll

    Wow, you spent ten years learning how to use emacs. In the same period of time you have earned a PhD, learned a few foreign languages, scaled a few mountains, learned several other computer languages like F#, Ruby, Scala, C# 4.0, started your own dot com, and gotten into great physical shape.

    Frankly, I am glad that I have some great IDEs and editors that are easy to use. I'd prefer to do other things with my life.

    Are you really just that cheap that you won't shell out a few dollars for Resharper or some other great tool?

    Jonathan, 14 July 2009

  8. ^^^ quick! give me your hand, you missed the boat...

    David, 14 July 2009

  9. Aaron

    I've been using emacs since before 1990 ... however I'm allergic to using the control key all the time so I use viper-mode. Of course this gets me flack from both camps. But I like it because the movement commands are all on the home row and only require a single keystroke. Now if only mainline emacs would hurry up and implement the horizontal scroll bar that xemacs has ...

    Aaron, 14 July 2009

  10. The funny thing is that I've only begun learning about Textmate macros and what not, and yet that's probably a far less difficult program to learn than emacs.

    Jake, 14 July 2009

  11. I think that there is some confusion between mastering emacs, and using emacs. You can learn to use emacs in 1/2 an hour. Is that a shockingly long time? Yes. Great design usually makes its uses obvious.

    But emacs makes up for that initial investment with accelerating returns --- where Notepad, or even Eclipse, you stop gaining power and knowledge relatively quickly, emacs is like the universe: no matter how long you look at it, there is always more to learn --- and the best part is the more you learn, the faster you can learn more.

    So I don't care if I get a PhD before I master emacs. I will have faught, been conquered by, and subsumed within a worthy foe. I will see the world differently for having used emacs. Users of notepad will still be editing text.

    ...or maybe not. But it's a fun thought to think, isn't it?

    Sam Bleckley, 15 July 2009

  12. This is like the old arguments about the Linux Command line. People who don't use it don't get it. I've been using it for about five years. I still haven't "learned it", but the little bit I know saves me a huge amount of time, and I never had to put aside any time to study it. I just had to learn how to use the man pages and a few other references, e.g. apropos. [HTML_REMOVED]

    You never have to "memorize" commands, you just look them up, and you use them.. Use a command twice and you know it. One great thing about learning this way is that you only learn commands that are actually useful to you.

    OOPS! Next time I post in a blog, I think I'll compose the post on emacs.

    blackbelt_jones, 15 July 2009

  13. Todd Lucas

    I would recommend printing out a cheat sheet and having it on your desk when you're editing.

    I print out cheat sheets for many development related topics (SVN, Mercurial, CSS, Emacs, etc.) and I put them into a three-ring binder that is always within arm's reach.

    Edward's point about challenging yourself is right on the mark. For example, if you want to copy a rectangle of text and you don't know how. Instead of taking a shortcut using some other technique, take step back. First, look up the sequence of operations and key combinations, then try until it works. Once it does, practice a few times.

    The next time you have to do the same thing, if you don't remember, repeat the process. Once you've done this a few times, it'll stick.

    Also, as he points out, recording macros are key. Learn how to use them.

    Todd Lucas, 15 July 2009

  14. I gave up on Emacs after about 2 years of using it daily (back in '98-ish). It just didn't feel right, I think mainly due to the scope of it. It is a behemoth that does just about everything in a mediocre fashion rather than one thing in a good fasion. [HTML_REMOVED]

    It also violates the UNIX philosophy of loose coupling.

    I traded it for a few separate tools (vim, python, shell scripts, insight, mutt etc). The separation allows me to learn at an appropriate rate for each tool rather than one rate for all tools.

    Please note, I have no problem with emacs and this is not a religious war, but it just doesn't suit my thinking.

    Chris Smith, 15 July 2009

  15. Overmoderating

    The moderation here is really offensive. The fact is that is that emacs needs more modernization, more layers of abstraction in terms of help docs, documentation and configuration.

    My .emacs file should be auto-generated by the packages I use, not me. I shouldn't have to touch elisp.

    In fact there should be awesome modes like defunkt's aggregation of modes at my fingertips. A new user should be given all of these, the default emacs should be incredibly simple to get into.

    Expert users can modify emacs like experts, that's what I do. But when I don't know something why is google + emacswiki so much better than emacs itself at finding help? Why do most solution consist of copying code around.

    Don't mark people as trolls, they have a point, being useful in emacs off the bat is possible, it is an issue of defaults.

    OSS has always catered to the expert but sometimes this pro-expert philosophy ignores the advances we've seen recently in editors like textmate (HTML rendering within, easy integration, snippets) and eclipse. Emacs is capable it just needs to be easy to configure at the start for newbies.

    If you still disagree, do this right now. Change the font. Yes change all fonts to Times right now, then to courier, then to Sans (oh you need emacs23 for this one).

    All of the fonts. Do it. It is hard, there are a billion font options and getting to them is not the easiest.

    Step 2, turn on single line scrolling. Why did I have to eval-expression and run a setq ? Is this not a setting? I should be able to EXPLORE settings, this is what GUIs allow.

    Step 3, using only the mouse and the menus, search and replace across an entire directory.

    The rest of the world has this crap, why don't we!

    Overmoderating, 15 July 2009

  16. Andrew

    [HTML_REMOVED] A tool needs to help, not require permanent learning to master it.

    A hammer is a simple tool; I can pick it up and bang in a nail with no prior experience (although even so I'll still probably bend the first few nails...). A nailgun is a more powerful tool, but using one without training is highly reccomended against. An industrial robot is an even more powerful tool, but I doubt you could even turn the thing on unless you had specific training or you built the thing yourself.

    There's an awful lot to recommend the hammer; the market for hammers certainly hasn't gone away. But if I'm a builder, and I put nails into things pretty often, every day, then I'm going to use a nailgun rather than tire myself out with a hammer and get less work done. Emacs is the nailgun. Or the robot, if you get into it. To stretch an analogy a bit too far, it's kind of like a robot with a "nailgun mode" switch ;)

    Andrew, 16 July 2009

  17. I half-agree with overmoderating. Johnathan wasn't a real troll, and it was wrong to label him as such.

    No, he didn't have a point, but he did have a point of view, a pretty common one. Many many people are going to see the title about learning emacs in ten years and say "f* that". He merely provided the opportunity to address what many people are thinking.

    Now, if Johnathan doesn't want to use emacs, that's his choice, and it's not my place or anyone's place to say whether that is right or wrong. However, I think he's completely wrong in his understanding of the article. [HTML_REMOVED]

    I am at the beginning of my ten years and barely know emacs at all, but I understand this article because of my experience with the linux Command Line Interface. The seven years that it's taken me to master BASH to the extent that I have are seven years that I could have spent doing the same tasks on GUIs. The term "user-friendly" is actually a misnomer. It refers to the new user, the beginner. Ten years down the road, if I'm still using tools that are designed for spanking new users, I'm going to be operating way below my potential. Johnathan can do whatever he wants. I want to invest that ten years of computer experience that I'm going to have anyway in such a way that I can grow in my abilities. With computing, hard applications to learn are often the easiest to live with.

    Anyway, the ten years it takes to learn emacs are the same ten years you would have spent using something else and perhaps not growing in abilitiles. And anything you would have done with another tool (including getting a PHD or climbing Mount Kissmiass, etc.) you would have been able to do while using emacs and gaining computing ability. It's not like that's all you'd be doing for the ten years, and, if I may say so, johnathan, that's a pretty stupid reading. Forgive me, but it is.

    And by the way, if anybody wants to know how to learn BASH (or I'm guessing the guitar or anything else worthwhile) it's pretty much exactly like this.

    blackbelt_jones, 16 July 2009

  18. Ed, I think the article was excellent and spoke more to learning in general and more to the point, taking on challenges for personal enrichment.

    I love emacs even though I now there are a lot more "user friendly" ways to do the things I do in emacs. I love it for exactly the same reason you are writing about which is the challenge. I'll also admit that there is a bit of an ego thing for me as well. Total geek cred when I tell people I use emacs to post to my blog, organize my life, take notes, code in Python and UniBASIC, listen to music, and chat on IRC.

    norm, 14 November 2009

  19. Pete

    Ed, great article. Really really great. I have been using emacs for three years or so, and I'm still a n00b. I've recently taken up org-mode as my primary day planner and outliner, partly because I freakin' love the way it flows and it fits my brain, but also partly for the reasons you laid out in your gnus example (which is still waaay too much for me to deal with): the time I've wasted on hammering on org-mode (not to mention my head against the monitor) has already more than paid for itself in the learning experience that it's provided.

    Also, I had been composing venomous replies to some of these comments, but let me just make one blanket statement instead, both to the trolls (yes there were a couple) and to the people who simply disagree with the idea you've laid out here: This is what makes people like us different from people like them. And that's all right too.

    Pete, 6 January 2010

  20. Chris

    Really nice article. Nothing to add to it other than showing appreciation for your time to make this interesting perspective available.

    Chris, 9 January 2010

  21. tuxy

    In my engineering field I have experienced quite often that the more difficult a tool is to learn the richer the rewards when you do learn it, emacs is one of those things, I tried, gave up but always would go back, there is just something about that editor, that keeps it on my mind,and oh how I hate to be defeated by anything even the great beast emacs, so I set out again on a venture to come to terms with this monstrously versatile and powerful piece of software, oh how I am enjoying myself.

    tuxy, 20 March 2010

Add a comment

Posting...