Emacs

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by CYD (talk | contribs) at 22:38, 28 January 2002 (* added emacs history, more external links). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

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 text editor Teco.

Since its original incarnation, Emacs has been re-implemented multiple times. The two most popular versions nowadays are GNU Emacs (also written by Stallman) and its close relative XEmacs. Strictly speaking, the lower-case word emacs (plural emacsen) refers to the class of editors that use roughly the same key bindings as GNU Emacs; the capitalized word Emacs is often synonymous with GNU Emacs.

Emacs History

Emacs began at the Artificial Intelligence Laboratory at MIT. Beginning in 1974, staff hacker Richard Stallman added display-editing capability to TECO, the text editor on the AI Lab's Incompatible Timesharing System (ITS.) "Display-editing" meant that the screen display was updated as the user entered new commands; compare the behavior of ed.

The users at the AI Lab Large accumulated a collection of custom macros, TECO programs that could be launched from within the display editing mode. In 1976, Stallman wrote the first Emacs ("Editor MACroS"), which organized these macros into a single command set and added facilities for extension and self-documentation. It soon became the standard editor on ITS.

Several Emacs-like editors were written in the following years, such EINE (EINE Is Not EMACS) and ZWEI (ZWEI Was EINE Initially), written by Daniel Weinreb and Mike McMahon.

Multics Emacs was written in 1978 by Bernard Greenberg at Honeywell's Cambridge Information Systems Lab. The 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 Emacs implementations.

Gosling Emacs was written by James Gosling in 1981. It was the first Emacs to run on Unix, and was written in C with Mocklisp as an extension language.

In 1984, Stallman began a new implementation of Emacs, 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, but it had more features and a more advanced extension language. 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 the attempt 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

Architecture

The GNU Emacs manual describes it as "the extensible, customizable, self-documenting, real-time display editor." The low-level source code is written in the C programming language. This includes the display engine, and 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.

Emacs is an example of a buffer gap editor: the contents of a document are stored in a data structure, which consists of a single buffer with a gap where the current edit point resides. With this design, editing operations such as adding or deleting a few characters do not have to modify much memory, and operations such as searching are relatively simple. The competing form of storage for documents is to store each line of the document in a small buffer.

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 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.1, released on October 20, 2001. Development takes place in a single CVS trunk, which is at version 21.2.50. The current maintainer is Richard Stallman.


External Links