Occasionally someone will stop by my office to look at some code I’m working on and I’ll pull it up in Emacs.  Within a few seconds most people ask what editor I’m using and why.  After all, it is 2009; surely there exists something better than a 30 year old editor that uses a variant of Lisp as an extension language?  Well, I’ve looked and if a better editor exists, I haven’t found it yet.

Language Support

I’ve been using Emacs as my primary editor for the seven years.  I’ve written C++, Perl, Python, Scheme, Common Lisp, XML, and Latex in Emacs; each of which was syntax highlighted and indented appropriately.  Emacs has allowed me to become proficient at a single editor while still assisting me with all of my text editing tasks.

Source Code Control Support

Over the years I’ve had to edit code that has been stored in Perforce, Subversion, git and CVS.  Emacs has support for all of these source code control systems.  For most day to day editing tasks involving check in/out and adding/removing files I don’t even need to leave Emacs.

Smart Search and Replace

Emacs has the best search and replace of any editor that I’ve used.  It searches and replaces using case “smartly”.  In just about every case it does exactly what I intended for it to do by default.

For example replacing “foo” with “bar” in the string “Foo foo FOO”  results in “Bar bar BAR”.  Each “foo” string was was replaced with a “bar” string that was capitalized to match.  If I had replaced “Foo” with “bar”, the string would have become “bar foo FOO” instead; only replacing strings that matched the case exactly.

Ediff

Ediff is a standard Emacs package that is perfect for cleaning up code before committing.  It allows you to perform a diff between two buffers (one buffer being the current version in the source code repository if you’re using git, SVN, CVS, or Perforce) and highlights the changes.  The key to ediff though is that it allows you to use the “A” and “B” keys to yank changes back and forth between the two buffers. Typically I use this to remove any new line insertions and hunks of debug code that I’ve added before committing.

TRAMP

TRAMP (Transparent Remote Access, Multiple Protocols) is an Emacs package that allows you to edit files on remote systems as if they existed on your local machine.  The only difference is a slight delay when reading/saving the file as it has to be done through the connection to the remote machine, which is obviously not as fast as reading/writing to a local disk.

While I typically use FUSE to mount remote directories through SSH, this is only a solution in Linux.  TRAMP allows Windows users to edit files on any remote machine that they can FTP or SSH into.

Community

The Emacs community is active and helpful.  One of the most useful sites is the Emacs Wiki.  Here users post tips, questions and answers, along with helpful bits of elisp that they’ve written.  If I want to do something new with Emacs, the Wiki is usually the first place I look.  If you’re thinking about trying Emacs, you could do much worse then checking out the Emacs Newbie section on the wiki.