The Great Emacs Experiment, Part 2

Continued from Part 1….

Emacs is not for everybody. In fact, I would never recommend it unless you were a geek (or a wanna-be geek), in the most absolute sense of the word.

In years past, I had dabbled in it quite a bit, and had read the O’Reilly book Learning GNU Emacs cover to cover, many times. It always felt comfortable, even though there were no menus, no buttons, and only a lot of scary white letters on a stark black background. Remembering complex keystrokes is the norm (people often joke that Emacs stands for “Escape-Meta-Alt-Control-Shift”), and there are plenty of esoteric hyphenated commands that you can feed it in order to handle even the most complex of tasks. But I really only used the editor for handling system files or writing code even though I knew it could be used for much, much more. For my two-week “Emacs retreat”, I had a number of big decisions to make regarding how I should approach things, and what I would use….

There are two main “flavours” of Emacs: the plain-vanilla standard Emacs pumped out by the GNU folks, including the instigator of the free software movement, Richard Stallman; and the version created by some folks who didn’t quite see eye-to-eye with Stallman’s development methodologies and direction (to put it lightly), XEmacs. XEmacs has menus, buttons, graphical elements, easily updatable packages, etc. As I wanted to avoid anything with a user-friendly GUI (although some Windows/Mac people may find XEmacs anything but), I opted for the pure and unadultered GNU Emacs.

The next stage in the experiment, to figure out what I needed to do in my daily computing rituals, and find Emacs solutions to meet them. I made a list of the most important things, and proceeded to research the packages I would need to install. Here are the main tasks, and the “mode” I chose for each one (Emacs uses modes to provide functionality for each of its editor tasks).

  • Writing code: Emacs supports dozens of computer languages, including my current favourites, Perl and Python. It also handles syntax highlighting, code folding, function tags, compiling, debugging, function/variable location (through etags) and more. It’s an excellent IDE, right out of the box.
  • Writing technical documents: Emacs has an excellent mode called AUCTeX, which provides functions for writing, navigating and compiling LaTeX documents. (LaTeX is basically a mark-up language that comes with most Linux distributions, and is also available for Windows and Mac. It produces beautiful, structured print documents and PDF files, although it’s not easily “tweakable”.)
  • Writing prose: Although Emacs is basically a text editor, it is a text editor on steroids. The basic text mode handles formatting, wrapping, split-screen windows (very handy!), bookmarks, find-replace, spell-checking, and more. If you use this in combination with LaTeX or another mark-up language, you can also create margin notes, footnotes, endnotes, bibliographical information, tables, and almost anything else you can do in a modern word processor. It’s not WYSIWYG like Word or WordPerfect, but I find it far less distracting to concentrate on the words and structure, rather than how a font or indentation looks.
  • Writing HTML: There are several modes available for Emacs, including html-helper-mode, which provide syntax highlighting, help with tags, and all the standard editor features, including editing a file live on an FTP server –very important when you are constructing a live page to be used in conjunction with dynamic content.
  • Email: VM is probably the best-known email client for Emacs. It takes a while to understand how to set up all the bits and pieces, but once it’s set up, you are an absolute master of how email comes and goes. Virtual folders, advanced editing abilities, insertion of form-based information, and all the bells and whistles of regular Emacs integration (such as piping information from a command line) are present and accounted for.
  • Contact management: There can be only one… the Insidious Big Brother Database, BBDB. It certainly takes some getting used to, but once you have, you become spoiled by how well it integrates with everything Emacs, including planner, mail and news.
  • Information organisation: This is something I have wrestled with for years, on multiple platforms. Juggling hundreds or thousands of bits and pieces of information is not for the faint of heart, and I’ve struggled with the best way to do it. Files in multiple folders become too rigid and often escape logical categorisation, a database structure means constantly performing queries instead of semi-structured browsing, and binary-format files (like those of Word) are often not searchable in other applications that need to retrieve the information. Enter the wiki, or more specifically here, the emacs-wiki mode. It’s smart enough to link pages together as you write them, you can create structured pages to group similar types of information, and it allows you to export the whole site to a website so you can access it from a regular browser anywhere? Sold!
  • Planning and scheduling: Emacs comes standard with a built-in calendar that you can use to schedule events (both one-time and repeated) and a diary that allows you to make entries for every day. However, sometimes a more robust planning system is needed, and there exists an amazing planner mode that builds upon the aforementioned emacs-wiki. With it, you can create tasks, projects, notes, etc. It certainly isn’t as friendly to use as Microsoft Outlook or a Palm Pilot, but once you get used to it, it seems just as capable. As in all things Emacsey, the greater complexity means that, at the end of the learning curve, you can do things you didn’t think possible. It also allows you to export your tasks and notes to a website… see the journal of the enigmatic Sacha Chua for an example of how this works, and while you’re there, poke around for tonnes of useful “add-ons”.
  • Browsing: This is a bit tougher. There is an older, buggy browser mode for Emacs called w3, but my experience with it has often been painful. The project was in the process of a major rewrite, but has since become rather stagnant, as the main developer apparently got a life (shame on him!). Instead, I selected w3m, which works in conjunction with the w3m command-line app to browse websites, view tables, download things, etc. Nowhere near as usable for most pages as any graphical browser, but it gets the job done (and sometimes much faster, as it doesn’t display graphics, only text).
  • Chatting: Emacs has a number of chat client modes. As I don’t really do much Instant Messenging nowadays, I skipped over those clients (but hint: anything Jabber-related will speak to all the standard IM clients, including MSN, Yahoo, ICQ, etc.). I figured I would want to solicit advice from IRC chat rooms, so I selected ERC as my client.
  • File management: Emacs comes standard with dired, which essentially allows you to browse directories, copy and move files, rename, delete, open (“fetch”), and create filters for functions such as searching, replacing, passing files to other programs, and more. Rather like Windows Explorer the OS X Finder on steroids, but nowhere near as pretty or as easy to use.
  • USENET news: One of the “killer apps” of Emacs, the GNUS reader is not only great for regular USENET newsgroup reading, but also supposedly mail (although I prefer VM for the latter). Standard split-pane: threaded news items up top, the article down below. I don’t know if it handles binaries (I don’t do much of that), but it seems that the capability is there. It does allow very rapid reading, killing and filing of newsgroup content.
  • Command-line: Emacs is very well integrated with the command line. Besides the ability to pipe data to and from the shell, there are at least two functions I find very helpful: it can run a program and display the output immediately in a buffer; and it has a full shell mode that runs in a buffer and allows you to use all standard Emacs functions there (for example, macros). Very powerful.
  • Macros: The macros capability of Emacs puts every other editor I’ve used, even the most “modern” ones, to shame. You record your strokes as a macro, then save it to a macros file for easy access. The macro itself is in elisp, and you can go and modify it to serve your purposes however you wish. It’s a little like AppleScript on the Mac, except you have many times more functions that you may call, and the elisp language is extremely versatile. (Emacs itself is written in elisp.)

The research was done, the decisions had been made. Now, the hard part…. It was time to live inside of Emacs for a couple of weeks. Like a Buddhist monk winding his way up into the mountains, away from civilisation and yearning to confront and either reinforce or renounce his system of beliefs, I set my Linux box to reboot in text mode and put myself into the hands of the Church of Emacs.

To be continued…

3 Replies to “The Great Emacs Experiment, Part 2”

  1. The spirit is willing, but the flesh is weak. I’ve always wanted to become an emacs guru, but could never get past all the meta-alt-control-shifting. But there’s been this omnious shiver deep in my soul that tells me I’m missing it. Perhaps a similar odyssey would be useful. Except I’d have to hunker down and learn LaTeX. That might be enough to seal the deal against it. Sigh. I’ll be watching closely.

  2. LaTeX is actually fun after a while. By itself, it produces some gorgeous documents, but when you mix it with pdflatex and emacs, you get one hell of a document writing system. I prepare my reports in LaTeX, and have had quite a number of people comment on the wonderful cross-referenced PDFs with hyperlinks and clickable tables of contents. Those actually required very little work on my part: all I did was give it the mark-up for section and subsection titles, and it handled the rest for me.

    LaTeX can also be a bit addictive. It’s a quest of knowledge that never ends, a bit like a technological Holy Grail. You need a few good books to feed the addiction, though.

Leave a Reply