1. Computing

Discuss in my forum

Emacs is a text editor developed back in the '70ties when computer operators and programmers used primarily text-based terminal windows to interact with computers. It is a powerful program, but all that power is hidden behind non-intuitive key-bindings. It would be a mistake, however, to think that Emacs is outdated. While it takes longer to learn how to use Emacs than it takes to learn a common word processor, it is worth the effort. It takes longer to learn how to fly an airplane than to learn how to drive a car, but it can save you a lot of time in the long run to make the investment.

In a GUI-based word processor you are limited to the choices offered by the menus and buttons in the window, just like driving a car limits you to following the roads. Emacs forces you to climb into an airplane and learn how to use short cut key bindings and automate editing functions, leaving the constraints of a GUI-based environment behind. While it may require some thinking ahead, once you are in the air you can go to your destination much more efficiently.

To get started, find Emacs or XEmacs in the programs menu of your Linux desktop or type in "emacs &" in a shell window. After emacs starts up, press the Esc-key followed by the x-key and type in "help-with-tutorial" and hit return. A tutorial should start up within Emacs that shows you the basics.

One of the strengths of Emacs is the ease with which you can define and use keyboard macros. Whenever you need to perform repetitive operations, for example when systematically editing a table, you can record the sequence of key strokes and replay the sequence a specified number of times with a few quick key strokes.

Emacs recognizes many different file types and uses suitable color coding of the text. For example if you edit an HTML file, the tags will be colored to be easily identifiable and readable.

To exit Emacs type Ctrl-x Ctrl-c. Emacs still comes with most Linux distributions, including all the major distros. Ubuntu users can install it with the Add/Remove function from the Applications menu. By the way, Emacs stands for Editor MACroS and was originally written by Richard Stallman, Guy Steele, and Dave Moon.

The complete documentation can be found here.

December 29, 2009 at 10:43 pm
(1) lulz says:

> It is a powerful program, but all that power is hidden behind non-intuitive key-bindings.

How are ‘C-f for forward’, ‘C-b for back’, ‘C-n for next’, and ‘C-p for previous’ not intuitive?

April 8, 2010 at 10:54 pm
(2) David Spector says:

I’ve used EMACS for many years (starting in the 70s with the version 18 that was redone by the great programmer Bernard S. Greenberg for Multics). Some of the keybindings are certainly intuitive. Others, such as c-Y (“yank”) are a learning hurdle when you are used to other editors.

The best feature of EMACS was not mentioned in this article: you can easily program it to do almost anything you can imagine, using a very practical version of the Lisp programming language. For example, you can limit access to a small section of the file with a builtin function, apply another function that you yourself wrote to the entire file, and no matter what your function does, it can only make changes in that small section. When the containing function continues, the limitation is automatically removed. All this takes only one pair of parentheses, the name of the limiting function and its two arguments. Just one example of the ease of extending the editor.

You can also write your own functions and bind them to any sequence of keystrokes you like, even replacing the default keybindings. Makes extending the keyboard interface easy as pie.

Of course, I’m only mentioning the tip of the iceberg, and simplifying a bit, too. But one of the reasons I enjoyed programming under Unix was the availability of EMACS at all of the companies at which I worked. I easily ported my customization file from one job to another. My most useful extension was the ability to have files containing lists of commands and pathnames. “Clicking” on a command would execute it, capturing the output; clicking on a pathname would open that file in EMACS. I could work on any number of projects concurrently using this feature.

EMACS, in my view, is the best text editor for people who aren’t afraid to learn and customize. It is especially good for writing computer programs (even large ones).

David Spector
Springtime Software

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

©2014 About.com. All rights reserved.