This just in: Bears love plain text!
Dear Internet Friends,
Last time we met, I told you I’d take you through a multi-point course in creating your own ebooks using a set of powerful open source applications 1. Before we jump in, let’s reorient ourselves with a quick review of the subjects we’ll cover:
- Write things in plain text with a good editor
- Use lightweight document markup languages
- Use version control
- Keep backups
- Automate the “build” process for new versions of your book
We’re now at the first subject, “Write things in plain text with a good editor”. As a fellow writer, there’s only one text editor which I can recommend without reservation for the task of editing your opus: Emacs.
I’ll begin with a specious appeal to authority by quoting a favorite author of mine, Neal Stephenson. This excerpt comes from an essay of his entitled In the beginning was the command line 2:
…the engineer-hours that, in the case of Microsoft Word, were devoted to features like mail merge, and the ability to embed feature-length motion pictures in corporate memoranda, were, in the case of emacs, focused with maniacal intensity on the deceptively simple-seeming problem of editing text. If you are a professional writer–i.e., if someone else is getting paid to worry about how your words are formatted and printed–emacs outshines all other editing software in approximately the same way that the noonday sun does the stars. It is not just bigger and brighter; it simply makes everything else vanish.
My perspective on Emacs vs. Word is that we must recognize that we are choosing between two wildly different types of software application:
- An application worked on by programmers, often for no pay, targeted at an audience they understand and care very much about: themselves. The reason they care is that they use it every day to do their own work. This is the category into which Emacs falls.
- An application written by programmers, for pay, targeted at an audience they don’t understand and may or may not care about: non-technical users who use WYSIWYG 3 word processors. They most definitely do not use it every day for their own work, since no programming language compilers or interpreters will accept its complex file format as input. This is the category into which Word and other “word processors” fall.
In other words, it’s the difference between building tools for yourself that you love to use, versus building tools for strangers, tools you would never use.
First, you need to download an appropriate Emacs for your computer. See the following table for my recommendations; I’ve used all of them successfully:
|Operating System||Emacs `Type’||Website|
|Mac OS X||Aquamacs||http://aquamacs.org/|
After you’ve installed Emacs, start it up. You should be presented with a window that looks like the following:
There are a handful of commands you’ll need to know to get started doing useful work:
|Key Sequence||Command Name||Description|
|C-x C-f||find-file||Open a file for editing. (You’ll be prompted for a filename.)|
|C-x C-s||save-buffer||Save the file you’re working on.|
|C-x u||undo||Undo the last edit.|
|C-a||beginning-of-line||Jump to the beginning of the line.|
|C-e||end-of-line||Jump to the end of the line.|
|M-x shell||shell||Opens your operating system’s preferred command shell. 4|
(Note that “C-x C-f” means “while holding down the Control key, first enter x, then f.” “M-x shell” translates as “while holding down the Alt key, enter x. Then enter the command `shell’.” The other commands follow the same convention.)
There are many other commands available, but these will get you started. I highly recommend working through the built-in tutorial, which you can start by entering the key sequence “C-h t”.
One last thing: In addition to using the key sequences, you can run any of the thousands of commands in Emacs using the “M-x command” technique described above.
The Emacs Customization File
Something you will eventually need to familiarize yourself with is the Emacs customization file. Like most applications preferred by programmers, Emacs reads its configuration options from a plain text file. Generally speaking, this is a file under your home directory called “.emacs”. (Its fully spelled out location on your hard drive is something like “/Users/rloveland/.emacs” or “C:\Users\rml\.emacs”, depending on your operating system.) This file contains instructions that customize the behavior of the editor. The author of a tutorial you find online might say something like “Place the following code in your .emacs file: …”. You’ll do that by entering “C-x C-f C:\Users\rml\.emacs”. In English, that’s “While holding down the Control key, first enter x, then enter f. Then type in the location of the file”. Make your edits, and then save with “C-x C-s”.
If you try to start Emacs with a customization file that has an error, Emacs will still start up, but it will let you know something is wrong by opening up a window with an error message that looks like this:
Unlike some other applications, Emacs can still continue to operate normally despite the error. You can still visit files, edit them, save them, etc. If there is an error in your customization file, you will not be able to use the customizations that you have created, but that is all: the editor will still function without them.
If you make changes to your
.emacs file that cause problems, the easiest way to undo the changes is to visit your
.emacs file again, remove the most recent changes, and restart Emacs. If that still doesn’t work, you can tell Emacs to start without reading its customization file by opening a terminal and entering the following command:
$ emacs -q
For more information, you can read the full Emacs manual right inside Emacs itself by entering “C-h i” or “M-x info”. This will show a listing of all the available documentation. Navigate to the “Emacs” heading and press Enter. You can also read it online at http://www.gnu.org/software/emacs/manual/html\_node/emacs.
That’s probably enough information to get you started using Emacs. If this seems like a lot of trouble to go to, ask yourself whether having precise control of your work at every level, from editing to backups to document formatting to final publishing, is important to you. If you are the kind of person who likes to do things yourself, if you would like to publish your own ebooks without needing to give up a percentage (and a certain amount of control) to an outside person or company, and if you are serious about your work as a writer, Emacs deserves your consideration.
3 WYSIWYG is an acronym for “What you see is what you get”.