Encyclopedia > Emacs

  Article Content

Emacs

Emacs is an extremely versatile text editor that is popular with programmers. It was originally written by Richard Stallman in 1976, as a set of Editor MACroS for the TECO editor.

Since its original incarnation, Emacs has been re-implemented multiple times. Nowadays, the two most popular versions are GNU Emacs (also written by Stallman) and its close relative XEmacs. The lower-case word emacs (plural emacsen) can be taken to mean the class of editors with behavior similar to the original Emacs. The capitalized word Emacs is often used synonymously with GNU Emacs.

Table of contents

Emacs History

Emacs began at the Artificial Intelligence Laboratory at MIT. Prior to its introduction, TECO was the default text editor in ITS[?], the operating system on the AI Lab's PDP-6 and PDP-10 computers. Unlike modern text editors, TECO abstracted the task of typing from editing, so that modifying a document required writing an series of instructions in the TECO command language. This behavior is similar to the program ed, which is still in use.

Carl Mikkelsen, one of the hackers at the MIT AI Lab, added a display-editing mode to TECO, which allowed the screen display to be updated each time the user entered a keystroke. This more-intuitive behavior, which is used by most modern text editors, had been pioneered by the "E" editor written at the Stanford AI Lab. In 1974, Richard Stallman, another hacker, added a macro feature to the TECO display-editing mode. This allowed the user to define keystrokes for launching TECO programs to perform various editing tasks, such as reading or writing files.

The users at the AI Lab soon accumulated a large collection of custom macros. In 1976, Guy Steele[?] began an effort to unify the many divergent macro sets. The project was completed by Stallman, who also wrote facilities for extension and self-documentation. The resulting program was called EMACS. Though built on TECO, its behavior was different enough to be considered a text editor in its own right.

"EMACS" stood for "Editor MACroS". According to Stallman, he picked the name Emacs "because <E> was not in use as an abbreviation on ITS at the time." It's also been pointed out that "Emack and Bolio's[?]" was the name of a popular ice cream store in Boston, within walking distance of MIT. The text-formatting program used on ITS was called BOLIO.

EMACS soon became the standard editor on ITS. It was also ported from ITS to the Tenex[?] and TOPS-20 operating systems by Stallman and Michael McMahon.

Several Emacs-like editors were written in the following years, including EINE (EINE Is Not EMACS) and ZWEI (ZWEI Was EINE Initially) by Michael McMahon and Daniel Weinreb. In 1978, Bernard Greenberg[?] wrote Multics Emacs at Honeywell's Cambridge Information Systems Lab. This editor was written in MacLisp, a dialect of the Lisp programming language. User-supplied extensions were also written in Lisp. The choice of Lisp provided more extensibility than ever before, and has been followed by most subsequent emacsen.

Gosling Emacs, the first Emacs-like editor to run on Unix, was written by James Gosling in 1981. It was written in C and used a stripped-down version of Lisp, known as Mocklisp[?], as an extension language.

In 1984, Stallman began writing a new emacs implementation, GNU Emacs, which became the first program in the nascent GNU project. GNU Emacs was written in C and used Emacs Lisp for extension. The first widely distributed version of GNU Emacs was 15.34, which appeared in 1985. Like Gosling Emacs, GNU Emacs ran on Unix; however, GNU Emacs had more features, in particular a full-featured Lisp as extension language. As a result, it soon replaced Gosling Emacs as the de facto Emacs editor on Unix.

Beginning in 1991, Lucid Emacs was developed by Jamie Zawinski and others at Lucid Inc., based on an early alpha version of GNU Emacs 19. The codebases soon diverged, and the separate development teams gave up trying to merge them back into a single program. This was one of the most famous early forks of a free software program. Lucid Emacs has since been renamed XEmacs; it and GNU Emacs remain the two most popular emacsen in use today.

Description of GNU Emacs

The GNU Emacs manual describes it as "the extensible, customizable, self-documenting, real-time display editor."

User Interface

Emacs stores text in objects called buffers. The user can create new buffers and dismiss unwanted ones, and several buffers can exist at the same time. Most buffers contain text loaded from text files, to be edited by the user. However, buffers can also be used for other purposes; for example, the user may create an empty buffer to store text temporarily.

Each Emacs screen (which is a single window on a windowing system, or the entire screen on a text terminal) can display one or more buffers at a time. If more than one buffer is displayed, the display area is split into multiple sections (which Emacs refers to, confusingly, as windows.) On a windowing system, multiple screens of Emacs can also be created (which Emacs refers to as frames.)

The user issues editing commands by entering keystrokes. In addition to the usual commands for inserting and deleting text, Emacs provides a host of more exotic commands, such as moving the editing point to the next sentence, opening all files in a directory, and performing a search-and-replace operation. Most of these commands can be activated with a combination of keystrokes. Recent versions of Emacs also provide graphical menus for the most common commands. (Most commands, even simple ones such as a for inserting the character a, are actually calls to Emacs Lisp functions, described below.)

Emacs supports many encoding systems, including UTF-8. A version with full Unicode support is being developed.

For visually impaired and blind users there is a subsystem called Emacspeak which may be loaded. It allows the editor to be used through audio feedback only.

Customization

The low-level source code of Emacs is written in the C programming language. This includes the display engine, as well as an interpreter for Emacs Lisp (a dialect of the Lisp programming language.) The majority of the editing code is written in Emacs Lisp. At run-time, the interpreter loads and evaluates (executes) this Lisp code.

The user can extend and customize the Lisp code from within Emacs itself. Emacs provides extensive facilities to support this, including commands for looking up the documentation of loaded functions and variables (this is known as self-documentation.) By re-evaluating the user-supplied Lisp code, the behavior of Emacs can be modified "on the fly", without having to recompile or even restart the editor. Lisp is a good choice of language for this purpose, because it allows functions to be treated as data.

As a result, it is very easy to add custom functionality to Emacs. Emacs includes many standard extensions, such as Emacs/W3, a web browser; Gnus, a tool for reading e-mail and Usenet discussions; an implementation of the game Tetris; and Doctor, an implementation of ELIZA that performs basic Rogerian psychotherapy. In addition, Emacs can serve as an IDE, allowing programmers to edit, compile, and debug their code from within a single interface.

The downside to Emacs' design is a performance overhead from loading and interpreting the Lisp code. Two joke acronyms for EMACS are Eight Megabytes And Constantly Swapping, and Emacs Makes A Computer Slow. Modern computers generally have enough memory and processor power, compared to the systems on which Emacs was first implemented, that this issue is largely moot. Nevertheless, this is a frequent point raised by Emacs' detractors during editor wars.

There are two other methods for customizing Emacs, though neither is as flexible as writing Emacs Lisp code. Firstly, Emacs provides commands for recording keyboard macros, which are commands that stand for a sequence of keystrokes. Secondly, the "Customize" package, included in recent versions of Emacs, allows users to set common customization variables using a graphical interface.

Internals

The contents of buffers are stored as a contiguous sequence of characters divided by a gap, known as the buffer gap[?], where the editing point resides. Changes are made to the buffer by moving the gap and/or altering the characters next to the gap. This design allows most editing operations to be very efficient, as not much memory has to be modified. The competing form of storage for documents is to store each line of the document in a small buffer.

See Emacs Lisp for a description of the Emacs Lisp interpreter.

Distribution

Emacs is free software, distributed under the terms of the GNU GPL.

The source code and binaries are available via FTP from the GNU project website (below.) They are also widely available from other sites on the Internet. Vendors of Unices (both free and proprietary) frequently provide Emacs bundled in the operating system.

Emacs runs on a large number of platforms, including GNU/Linux and most Unices, Mac OS, and Microsoft Windows.

Development

Emacs is part of the GNU project, and is under active development. Several, but not all, of the developers are affiliated with the Free Software Foundation (FSF).

Until the release of Emacs 21.1, Emacs development was relatively closed. The project has since adopted a public development mailing list and anonymous CVS access. However, it remains Emacs policy to accept significant code contributions only if the contributing author assigns the copyright for the code to the FSF. (This does not apply to bug reports or minor code contributions.) This policy is intended to facilitate copyleft enforcement.

The latest release of GNU Emacs is version 21.3. Development takes place in a single CVS trunk, which is at version 21.3.50. The current maintainer is Richard Stallman.

External Links



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
Indian reservation

... Indian Reservation[?] San Xavier Indian Reservation[?] Tohono O'Odham Nation[?] Brighton Indian Reservation[?] Big Cypress Indian Reservation[?] Miccosukee ...

 
 
 
This page was created in 60.8 ms