Learning Emacs

For the past few weeks, on top of writing delightful documentation and exploring New York, I have been executing an herculean undertaking: learning Emacs.

10gen’s lead tech writer is an avid Emacs user: he uses Emacs for his email, his chat client, and, of course, for editing the docs. We write MongoDB’s docs in Docutils, and (mostly) easy to write. It helps to have a text editor that will do reStructuredText syntax highlighting, though, and those seem to be rare. My beloved Coda 2 does not appear to do it; Sublime Text’s highlighting is inconsistent, and its tabs a pain in the ass. TextMate is great, but even it sometimes fills me with rage with auto-indent behaviours that I can’t figure out / turn off.

So my colleague suggested I try out Emacs. It was lateish on a Tuesday afternoon, and I said “why not!” and promptly downloaded the GUI version of Emacs. He kindly gave me his Emacs configuration file so that I would have all his handy reStructuredText-facilitating extensions, and gave me a quick crash course. I suspect part of his enthusiasm was the prospect of being able to use Emacs on my computer when I needed his help with something, but a good deed is a good deed regardless. After a 45-minute pep talk, I was left feeling not unlike I did when my parents bought me my first iMac back in… 1998: “this is very cool, now how the heck do I turn it off?”

Aside: for those of you who do not recall, OS 9 hid the Restart / Sleep / Shutdown menu items in the “Special” menu. The first night I had my iMac, I ended up unplugging the computer in a fit of “oh god what have I done?” and having a cry because of all the money that had been spent on a computer that I had no idea how to use. I bought David Pogue’s “iMac for Dummies,” and life improved immeasurably.

On Wednesday, I remembered that Sacha Chua was an Emacs user, and vaguely recalled her posting a Beginner’s Guide to Emacs. I printed it out, propped it up on my desk, and have been adding to it ever since. Much like the purchase of Pogue’s book, this was an excellent life choice. There are a few things that bug me about Emacs: memorizing keystrokes isn’t something that I’ve ever been very good at, and I don’t like that (given my current configuration) I can’t highlight with shift and the arrow keys. As a learning experience, though, it’s been really pleasant, especially now that I’m starting to remember how to do things (I can now consistently write files, copy & paste, and move to the beginning and ends of lines!).

It sounds goofy, but I’ve always enjoyed the idea of being a person who is good at command line-y text editors. Whenever I see someone mysteriously navigating without a keyboard, typing furiously as windows pop up and disappear, I think it’s neat. Admitting this is both amusing and embarrassing: I’m forcing myself to learn Emacs because I think it looks cool.

Despite my somewhat goofy reasoning, Emacs is kind of fun! At a minimum, it’s made me realize that the way I’ve always interacted with files is not the only way, and it has made my emacs-loving colleague’s workflow is much less mysterious to me. I also really like that I can create a buffer that will execute a command for me: I like being able to generate the html version of whatever I’m working on and being able to click on links to the file if there’s an error.

If you’re just starting out and have an intense desire to look cool learn emacs, check out Sacha’s guide. I also suggest finding someone who is patient and kind, and willing to help you learn.

2 thoughts on “Learning Emacs

  1. The tutorial (C-h t) is useful and well worth going through several times. Getting used to marking a region with C-SPC versus using shift- takes some doing, but it’s really quite powerful once you get the hang of it – mainly because you can then use all sorts of navigational commands without getting RSI.

    Incidentally, you may want to look into mapping your Caps Lock to Control. Many people like the way it makes keyboard shortcuts easier to type.

    I find it hard to remember keyboard shortucts too, so I use M-x a lot. M-x lets you call a command by its name. You can use C-h k to find out more about which function is called by a given keyboard shortcut, and then you can use M-x to call it by name if you don’t remember where it is. For example, if you don’t remember where split-window-vertically is bound, you can use M-x split-window-vertically.

    Incidentally, M-x where-is will tell you the keyboard shortcuts if you know a function name, and C-h f (describe-function) will give you more information if you give it a function name.

    Writing-wise, Org Mode (http://www.orgmode.org) is totally awesome. I use it to write some of my more structured blog posts and web pages, and I also use it to keep this gigantic outline of things I’m planning to write about: http://sach.ac/outline . People have used it to write technical books and other lengthy documents. It’s also a fantastic planner for running your daily life. =)

    If you have any questions, please don’t hesitate to reach out. I want to help make Emacs easier to learn!

  2. Oh, another tip: use M-x icomplete-mode to turn on incremental completion, which will then show you hints when you start typing M-x [command-name]. You can use TAB to complete as far as you can, and then type in a few more characters to disambiguate. To turn this on by default whenever you start Emacs, add the following to your ~/.emacs.d/init.el (you might need to create this file):

    (icomplete-mode 1)

Leave a Reply

Your email address will not be published. Required fields are marked *