Why I Still Use Emacs

At school, I’m known as the Emacs guy; when people have questions about configuring Emacs or making it work a certain way, they often come and ask me. Sometimes, some people ask me why use Emacs at all? Isn’t it a really old editor and aren’t Eclipse or Visual Studio much better? I mean, they don’t have weird key bindings and have intellisense, that’s surely better for a programmer, right?

I will attempt in this post to explain some of the reasons why I still cling to Emacs. Believe me, I don’t think I have any emotional attachment to Emacs; the reason I cannot leave it is that it seems that the grass is yellower everywhere else. I’d love to be able to use something like Eclipse for most/all of my work. Alas, I can’t (or rather, I won’t).

Emacs has a GUI and a CLI interface

I often connect to my university’s server with SSH; since Emacs is capable of running in a terminal, I can use it in those instances. On my desktop, I can use the slightly cuter GTK interface. IDEs like Eclipse are entirely GUI-based, this means that unless you can do X forwarding, you cannot use it remotely. In my case, this makes Emacs available in all instances where I need it.

The interface also consists entirely of text, so you can always use the very useful editing features that you are used to (e.g. searching, copying, etc.). One of the most common example is using the search function in a customize screen to find a certain parameter.

Emacs can be entirely controlled by the keyboard

Related to the point above, Emacs can be worked without ever touching the mouse. This is necessary for working with the CLI interface, but it also allows me to never reach for the mouse when I’m using Emacs. As many Emacs (and Vim) users will tell you, constantly reaching for the mouse can slow you down considerably.

Also, I’ve been using a laptop exclusively for the past 3 years; a track-pad is not as precise or fast as a real computer mouse, so I’m happy when I can perform operations without touching the track-pad.

Emacs has the mini buffer

The mini buffer in Emacs is usually activated with the M-x key sequence and allows the user to type the name of a command. For operations that don’t have a keyboard shortcut, it allows the user to invoke them with the keyboard. No need to hunt down in a series of nested menus to find the command that you want. The mini buffer also allows for auto-completion and history navigation, so the next time you need to run that command, you can get to it much faster. With a GUI, you’d need to re-navigate the menus.

Emacs is self documenting

Emacs comes with a complete documentation system; if I want to know what keyboard shortcuts are currently established, I can type C-h b to have the complete list. C-h k can tell me what command a particular keyboard shortcut. With C-h a, I can find the commands that match a certain regular expression, which is useful to find a command that you don’t know exists. The help system also includes a very complete tutorial and info pages on Emacs, Emacs Lisp and many packages.

Emacs is easy to configure

If you want Emacs to behave a certain way, but don’t know how, you can go to the #emacs IRC channel on irc.freeenode.net and follow these simple steps:

  1. Ask your question
  2. Copy the answer given to you by a helpful user
  3. Paste it in your .emacs
  4. Try it out

It’s that easy to add new configurations to Emacs. If editing Lisp code isn’t your cup of tea, Emacs also has the customize mode to help you out, and this will generate the Lisp code for you.

Configuration being a text file, it means that it’s a great idea to put it under revision control. Push your configurations to a central server and pull them when you use another computer.

Emacs works with all sorts of files

There aren’t many types of files that Emacs doesn’t recognize. There’s a major mode for nearly every programming language you can think of, and for languages you cannot think of.

This trimester, I have four classes that use four different languages: Java, C, C++ and Scheme. I use Eclipse for Java, because that’s required by our professor, but for the other three classes, I use Emacs. In my free time, I also like to play with Haskell and OCaml, which are both supported by Emacs. In the past, I also used Emacs to edit R code, GAMS code (a research operations language), Python code, JavaScript code, Clojure code, etc.

Eclipse is great at working with Java and Visual Studio is great at working with C#, but they’re less great with other languages. I don’t want to have to learn many different tools (with different menus, shortcuts, etc.) to work with the languages I need to use. This is a major reason why I use Emacs; all the basic operations (and sometimes not so basic) that I use are the same regardless of the language I’m editing. That’s very important in keeping my productivity high; I often delete entire lines in Eclipse (Ctrl+D) because I wanted to delete a single character. I cannot imagine what sort havoc I would wreak if I had to use 5 different editors/IDEs.

Emacs has many very useful modes

Emacs is usually made fun of for having a Tetris game in its default distribution. “Why the *@!& does an editor have a Tetris implementation!?” people ask. I agree that Tetris is not terribly useful, but what Tetris shows is what’s possible to implement in Emacs by its users. Here are some non-trivial modes that I use that are extremely useful:

  • calc-mode: a calculator that can work in RPN or infix mode, that has support for large integers, rational numbers, complex numbers, vectors, algebraic expressions, etc. The things you can do in that calculator could be the subject of an entire book. And it’s easily accessible: C-x * * to bring it up and again to make it disappear. It integrates quite nicely into my work-flow.
  • epa-mode: an integration with gnupg making it seamless to open encrypted files, modify them and encrypting them again. I use it for my master password instead of a more involved solution like KeePass. It can also be used to encrypt part of a file by selecting the text and executing the command M-x epa-encrypt-region (no need to find that in a menu ;))
  • org-mode: people have switched to Emacs for this one mode; it’s a mode to edit structured documents (sections, subsections, lists, etc.) It’s used to maintain todo lists, to take notes, to plan projects, etc. There are many videos on the web about it, I suggest you watch them, because org-mode has too many features to list them in this simple bullet point.
  • ido-mode: when people in Eclipse need to view another opened file, they click on the correct tab; to open a file, they double click on the file in the project list. Emacs users use the keyboard for both activities, but by default, the interface is pretty minimal and not terribly efficient. This is where ido-mode comes in: it makes it much faster to open files and switch buffers by showing the list of choices, filtering it as you type, giving you the option of having flex completion (i.e. “abc” would match the string “a##b#c”), etc. Watching a veteran ido user switch buffer can make the spectator dizzy.
  • anything: anything is similar to OS X’s QuickSilver utility; you activate it, start typing what you want and it’ll show you all the possible results, organized by categories. By default, it looks at the files in the current directory, and the opened buffers I believe, but you can configure it to find all sorts of things, such as Emacs commands, man pages, recently opened files, functions, etc.
  • occur-mode: a small mode that I use quite often; you give it a regular expression and it’ll find in that buffer all the occurrences of that regex and display them in a new window that you can navigate. Quite useful!
  • ibuffer: ibuffer can be used to perform operations on many files. For example, if you wanted to replace all instances of “foo” with “bar” in all the opened C files, you’d go to ibuffer, mark the C files, press U and all the files would be changed.
  • tramp: you can open files over an SSH link, an FTP link, you can open files using sudo, etc.

And there are many, many other very useful extensions to Emacs that I haven’t mentioned here. The good extensions are designed in such a way that they can easily be integrated without disrupting your workflow.


Emacs is not perfect, it is lacking in many regards:

  • It has no multi-threading support
  • Elisp is not a great language, and is quite slow
  • Using multiple major modes in a file sucks (e.g. PHP + HTML + JavaScript)
  • Most programming modes have no semantic understanding of the language they support, and thus offer no facilities like intellisense, or re-factoring. (I’m not sure what the progress of the semantic mode is; please comment if you know.)

But I think that for the most part, it compares favorably to the modern IDEs. In the next few years, I imagine that Emacs will start gaining and solidifying the IDE features that many users want. I don’t know what IDEs will do; I would hope that they’d take a step back and learn some of Emacs’ lessons and offer an experience that power users can appreciate more.

EDIT: I’ve tried to fix the newlines problem; let me know if this comes out better.

About these ads

66 thoughts on “Why I Still Use Emacs

  1. As you may know, Guile is working on improving its Elisp mode to the point where it’ll be a drop-in replacement for the existing Elisp interpreter. This should make for a good speed boost, given how many things in the Emacs world are done in Elisp. It will also allow writing Emacs code in Scheme and even JavaScript, which will help make writing Emacs extensions more accessible to the hoi polloi as well as the elite. :-)

  2. In addition to your reasons, I use emacs because I can make it do whatever I need it to do — in particular, it’s not difficult to make modes for specific libraries that follow their own conventions, and it’s not hard to modify the way stuff is formatted for projects from various sources.

    It’s also easy to hook up things like running whitespace-cleanup, linting, and tests on file save or keystroke.

    It’s also easy to do things like making a macro that runs a SQL query on a dev database, formats the results, and sticks them in a buffer, or other “combination of a few normally-external-to-the-editor tools” tasks.

    • I realize that I didn’t list all my reasons. Macros are definitely up there in the features that I use regularly. I don’t do much Elisp coding myself, but it’s nice to know that when I need to create or customize something, that process is very direct: write code, execute code. I admit that I don’t know how to write code for Eclipse or other IDEs, but the task seems much more involved.

  3. It’s not the same, but you can enable Emacs style keybindings in Eclipse when you’re forced to use a lesser editor. It’s frustratingly limited, but the basic navigation and editing commands work, as well as C-x C-s and C-x C-f. It eases the pain somewhat.

  4. This really should be ‘Why you should use a badass multitasker Text Editor rather than a unitasker IDE”. Vim and TextMate both have the majority of those features (and many, many, many more). Sublime’s still a pup but it’s got some of those features.

    • None of those is “turtles all the way down” like emacs with elisp. I like it because I’m not at some exposed apis’ mercy.

      • In all fairness, there are someplaces where they are not turtles – you can’t define advice for builtin functions, for instance, in such a way that it always runs.

        I’ve always found the fact that the emacs printer is not extensive to be a problem (related to the first one).

  5. Nice article all in all, though I did have an issue with the claim that elisp is slow, and not a great language. It is a superb language for what it was created for, making Emacs extensible. Speed wise, the VM that executes the byte compiled files is quite fast and I am not sure where you got the idea that it is slow.

    Happy hacking, Alfred.

  6. I began using emacs because of org-mode 6 months ago. However, I find it quite difficult to get used to it. I haven’t given up though. There is no alternative.

  7. All GUI text editors and IDEs I have I use can open a file remotely over sftp using GIO, KIO or similar. No X-Forwarding needed. This also has the advantage that if you lose your connection you can still save your work locally.

    Keyboard shortcuts + a keyboard driven launcher (for things like claculators) address most of the rest. Ubuntu’s new HUD should almost entirely eliminate needed to use the mouse or navigate nested menus.

    • I really like Vim, and I’m pretty good with it. I guess I just prefer Emacs’ philosophy of integrating with other tools and being extensible. I think the `:he design-not` topic in Vim explains why I don’t use it as much nowadays.

  8. Pingback: 为什么我还在使用 Emacs ? » 全信息

  9. Pingback: Why I Still Use Emacs | richestill.com

  10. First, Emacs is my editor of choice and I agree with most of what you said. However…

    I often wonder if the “keyboard is faster than mouse” argument is really true (or true in as many cases as vi and emacs users like to believe). UI research has shown that users (and don’t think that doesn’t include you) often report keyboard-only interfaces as faster even when a stopwatch says that they were really faster using a mouse–it seems the extra mental effort involved in keyboard-only interfaces makes the time go subjectively faster.

    I think that the sheer number of things that emacs does would make for an unwieldy giant menu structure. Don’t assume though that just because some operation feels faster with the keyboard that it really is.

  11. Pingback: Why I Still Use Emacs « Tyson Zinn « Tyson Zinn

  12. Pingback: Why I Still Use Emacs « that dismal science

  13. I can’t believe you left out “Because it has macros, and it can record keyboard/search actions and replay them.”

    Macros are the single, killer feature that no editor available aside from emacs has. Some may have limited macro features, but nothing that compares to the programmability of emacs.

    I can start a macro, dump it as lisp, edit the lisp, and replay it over and over again. This saves countless hours of coding time when editing documents and code.

    • Are you sure that’s a unique feature of emacs?

      Although being an emacs user, I can assure you vim can record a macro, dump it, save and replay later.

      IMHO, emacs’s killer feature is that it can be used for everything and not only edit text. It’s a full environment. Being able to augment completion for irc client, console, editor, and mail client in the same way is a thing really few systems can acomplish.

  14. Pingback: Using Emacs | Irreal

  15. “when people in Eclipse need to view another opened file, they click on the correct tab; to open a file, they double click on the file in the project list.”
    And that’s your limit, if you don’t try and use it.
    When I use eclipse, I use my keyboard, just like you do in emacs.
    CTRL+O for opening files, CTRL+E as well as +page up and +page down to navigate through open files, CTRL+Tab for header/source switch (if you’re on C++ anyway), CTRL+ALT+T for searching classes and vars, etc. Then arrow keys and enter, and so on.

    Simpler editors like emacs have their areas to shine just like IDEs do, but I certainly would not put them into one category. IDEs syntactically understand languages, thus provide navigational features not only for opening files but navigating to classes, objects, variables, declarations; whatever. They also help you with your project and build environment.
    I don’t know if your emacs does that – how you have set it up – but an editor is not an IDE.

    • Clearly you’ve never used something like SLIME with Common Lisp or Geiser with a Scheme dialect. Emacs can “syntactically understand” more languages than your average IDE, I’d be willing to bet.

  16. I remeber being like this…. then I got a job, had to be actually productive, and so I switched to an IDE. Using Visual Studio with Resharper is so much more efficient on large projects. I still use vim for bits and pieces (quick server stuff and python experiments), but seriously – if you have deadlines and a lot of code to parse (mentally I mean), a good IDE and it’s tools are the way to go.

    • I think this is unnecessarily snarky – I have a ‘real job’ working on large software projects and I used emacs to get real work done every day. Admittedly, our project is in Common Lisp, where Emacs is an unparalleled IDE. I’ve no doubt that the IDEs you use are suited to your work. It is silly to suggest that emacs isn’t for “real work,” though.

      Lots of people use it for real work.

    • Haha, well I used to have to use Emacs (in school) and I hated it. Then I “got a job, had to be actually productive” and so I started using Emacs.

      Seriously though, you haven’t made much of an argument here. What specifically makes Visual Studio so great for larger projects?

    • I’m a veteran software engineer that has been writing code in both large and small corporations, from small client-side native projects to full-on enterprise-level super-complex distributed server systems that serve >1k QPS. I’m not alone in this, either — most of my cohorts in the industry use tools like vim or emacs to do their daily work. If you’ve used anything modern on the web, chances are a great portion of it was written using editors, not IDEs.

      Of all of the IDEs I’ve used (Eclipse, Visual Studio, MonoDevelop, etc.) and all of the editors I’ve used (emacs, vim, jed, pico, nvi, etc.) the only one I’ve ever stuck with was emacs: it gets out of the way and lets you focus on the task at hand. If you need more assistance, you can either pick up an elisp package to manage it, or write it yourself.

      In general, I find that features like intellisense are neat and shiny and all, but seriously, if you’re relying on the IDE to tell you what is available in the API, you need to learn your APIs better. It’s great for exploratory coding, or quick one-offs, but it’s no substitute for API docs. When I’m writing code, I already know what it is that I need to write, and which APIs to make use of — things like code completion or Intellisense generally get in the way more than they help because they either steal focus, or confuse and throw me off my train of thought with a collection of somewhat related methods or values that aren’t actually what I need.

      The /one/ thing I do pine for is a proper refactoring tool for languages that have well-defined grammars, such as C# or Java, but this functionality isn’t something I’m going to make use of all the time — and it’s definitely something that emacs can be adjusted to do via semantic, CEDET, or other external tools that are better suited to the function (see also Java’s own parsing API, go’s APIs, etc.).

      • I should also note: if you’re writing code using the test-driven design method, intellisense is completely useless because most of the time, your API doesn’t exist yet.

  17. Emacs is what I use for most of my work, and I hate it. However, I am stuck with it, because the alternative environments I have explored are significantly worse.


  18. Pingback: first trimester

  19. Pingback: inspired minds

  20. Pingback: QCK Team Reader – 为什么我还在使用 Emacs ?

  21. I used to use Emacs but abandoned it because it lacks so many features that I need to build a large project. No code sugguestion, no auto-make, no code folding,… modern IDE is the presence and future.

  22. wonderful publish, very informative. I wonder why the opposite experts of this sector don’t notice this. You must proceed your writing. I am confident, you’ve a huge readers’ base already!

  23. I’ve recently switched back to Emacs after years of other editors and the main reason for it was bloat on the Eclipse version we use in work. It’s funny, because the original reason I moved to another editor was because of performance and memory issues on old PCs. Compared with a badly configured Eclipse environment, with multiple views/configuration and external tools, Emacs is now the leaner, faster candidate.

  24. Great article, thank you. One thing to add re using Emacs vs using and IDE. For most of the IDEs that I’ve bumped into, it hasn’t been hard to use both at the same time. I routinely edit simple things in the IDE (because it’s, y’know, simple…) and for more complex edits (certainly including edits that require a macro), I switch over to Emacs. Almost all IDEs nowadays check open files to see if they’ve been edited externally, and allow you to reload them without much fuss. I very, very rarely find a situation where I need both features of the IDE and features of Emacs in the same context.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s