Emacs originated in the early 1970s as a family of text editors built on the concept of extensibility through macro languages. The first Emacs was written in 1976 by Richard Stallman as a set of macros for the TECO editor on the MIT AI Lab's PDP-10 computer. Over the following decades, Emacs evolved into a self‑documenting, highly customizable environment that transcended simple editing tasks. Its name, originally an acronym for “Editor MACroS”, reflects its macro‑based origins.

1.1 Origins and the name “Emacs”

The name “Emacs” was first used for an editor developed at the MIT AI Lab. Stallman and colleagues sought to improve upon the existing TECO editor by creating a set of user‑defined commands that provided more intuitive text manipulation. The term “Emacs” was suggested by Guy L. Steele Jr., who later contributed to its early design. The name is a portmanteau of “editor” and “macros”.

1.1.1 The early TECO implementation

The original Emacs consisted of a collection of TECO macros (TECO being a text editor and programming language). These macros implemented common editing functions such as word movement, search, and file operations. The system allowed users to redefine or extend commands on the fly, establishing the core principle of user empowerment. This early TECO-based Emacs ran on the Incompatible Timesharing System (ITS) and soon spread to other platforms.

1.1.2 Stallman's GNU Emacs

By the mid‑1980s, Stallman had begun the GNU Project, aiming to create a free Unix‑like operating system. As part of that effort, he rewrote Emacs from scratch in C and Emacs Lisp, releasing GNU Emacs in 1985. This version replaced the TECO dependency and introduced a built‑in Lisp interpreter, making the editor far more extensible and portable. GNU Emacs quickly became the standard implementation, distributed under the GNU General Public License.

1.2 Forking and lineage: GNU Emacs vs. XEmacs

In 1991, a controversial fork occurred: Lucid Inc. needed an enhanced Emacs for their programming environment and developed a version based on GNU Emacs 19, adding features like a native GUI and improved widget support. The fork was later renamed XEmacs after Lucid's demise. XEmacs and GNU Emacs diverged significantly in internal architecture, package systems, and user interface conventions. Over time, the XEmacs community dwindled, and GNU Emacs incorporated many of its innovations (e.g., font‑lock and toolbars). The last XEmacs release was in 2009, but it remains available as a historical alternative.

1.3 Significant milestones

  • 1985: Release of GNU Emacs 13 (first public version).
  • 1990s: Introduction of frames, multiple X11 windows, and the initial customize system.
  • 2000s: Added Unicode support, the built‑in package manager (package.el), and lexical scoping for Elisp.
  • 2010s: Significant performance improvements, native JSON parsing, dynamic modules, and the introduction of the Non‑GNU ELPA archive.
  • 2020s: Continued development with emphasis on built‑in language server protocol (LSP) support, tree‑sitter integration, and further GUI refinements.

Emacs is fundamentally a Lisp interpreter wrapped in a text editor. Its architecture separates the core C layer (which handles low‑level operations like redisplay and input) from the vast majority of functionality implemented in Emacs Lisp (Elisp). This design allows users to modify or extend almost every aspect of the editor without recompiling the C code.

2.1 Emacs Lisp (Elisp)

Elisp is a dialect of Lisp designed specifically for Emacs. It features dynamic scoping (with lexical scoping available since version 24), a rich set of data types including buffers, markers, and processes, and an interactive development environment. Most Emacs commands are written in Elisp.

2.1.1 The interpreter and byte‑compilation

Elisp code is interpreted by the Emacs Lisp interpreter, which evaluates expressions at runtime. To improve performance, Elisp source files can be byte‑compiled into .elc files. Byte‑compiled code runs significantly faster than interpreted code while maintaining semantic equivalence. The byte‑compiler also performs basic optimizations and warnings for common errors.

2.1.2 Major modes and minor modes

Modes are the mechanism by which Emacs alters its behavior for different types of text. A major mode defines the primary editing environment for a buffer—for example, text-mode, python-mode, or org-mode. Each buffer can have exactly one major mode. Minor modes are optional features that can be toggled independently of the major mode, such as auto-fill-mode, flyspell-mode, or eldoc-mode. Multiple minor modes can be active simultaneously.

2.1.3 Hooks and advice

Hooks are lists of functions that Emacs runs at specific points, such as when a major mode is activated or a file is saved. Users can add their own functions to hooks to customize behavior. Advice is a more advanced mechanism that allows modifying the behavior of existing functions without changing their source code. Advice can wrap, before, after, or around a function, and is commonly used for debugging or temporary alterations.

2.2 Buffer, window, and frame

Emacs organizes text and user interface into three core abstractions: buffers, windows, and frames. A buffer holds editable text and its associated state. A window displays a portion of a buffer on screen. A frame is a top‑level window (in the GUI) or the terminal screen (in TTY mode) that contains one or more windows.

2.2.1 Editing buffers and their attributes

Every buffer has a name, a major mode, and a set of local variables. Buffers can be visiting a file (i.e., associated with a file on disk) or be ephemeral (e.g., the scratch buffer *scratch*). Buffer attributes include the point (cursor position), the mark (a saved position for region selection), the buffer size, and the modification status. Changes to a buffer can be undone via the undo system.

2.2.2 Windows and frame management

Windows are subdivisions of a frame that display buffers. Users can split a frame vertically or horizontally, and each window can show a different buffer. Frames themselves are separate GUI windows (or a single terminal screen). Emacs supports complex window layouts and configuration through the window.el library and various window manager packages.

2.2.3 The minibuffer

The minibuffer is a special one‑line buffer at the bottom of the frame used for interactive commands: reading file names, search queries, Lisp expressions, and command names. It supports history, completion, and recursive editing (the minibuffer itself can be entered while another minibuffer session is active). The minibuffer is an essential component of Emacs's command interface.

2.3 Keymaps and keybinding system

Emacs uses a hierarchical system of keymaps to map key sequences to commands. A keymap is a data structure that associates key events (keystrokes) with either another keymap (for prefix keys) or a command symbol. Keymaps are ordered by precedence: minor mode keymaps override major mode keymaps, which override global keymaps.

2.3.1 Prefix keys (e.g., C-x, C-c)

Prefix keys are keys that start a multi‑key sequence. Common examples include C-x (the control‑X prefix, used for file operations and buffer commands) and C-c (the user‑definable prefix, often used by major modes for mode‑specific commands). Emacs defines a large set of standard prefix keys, and packages may add their own.

2.3.2 Custom keybindings

Users can bind any key sequence to any command using the global-set-key function or the interactive key-translate mechanism. Keybindings can be made mode‑specific by modifying the major mode or minor mode keymaps. The define-key function and the kbd macro (which parses human‑readable key descriptions like "C-c C-f") are common tools for customization.

Emacs provides two primary interface modes: a fully graphical user interface (GUI) and a terminal‑based interface (TTY). Both share the same underlying command logic and keybindings, but differ in visual appearance and input handling.

3.1 Graphical user interface (GUI)

When running in a graphical environment (X11, Wayland, macOS, or Windows), Emacs displays a window with menus, toolbars, scrollbars, and a text area that supports fonts, colors, images, and mouse interaction. The GUI version allows multiple frames and supports drag‑and‑drop of files.

3.1.1 Menus, toolbars, and scrollbars

Menus are accessible via the menu bar at the top of the frame. They provide mouse‑driven access to many commands. Toolbars (optional) offer iconic buttons for common operations. Scrollbars appear on the side of windows in GUI mode, allowing scrolling with the mouse. All of these UI elements can be customized or disabled.

3.2 Terminal interface (TTY)

In a terminal, Emacs operates in character‑mode, using the terminal's capabilities (e.g., colors, underlining, cursor positioning) to render its interface. Some GUI features (images, multiple fonts, tooltips) are unavailable, but all editing functionality remains accessible via keybindings.

3.2.1 Character‑based operation and special keys

Terminal Emacs interprets escape sequences sent by the terminal emulator. It handles function keys, arrow keys, and modifier combinations as best as the terminal permits. Users often need to configure their terminal to send appropriate sequences for keys like Ctrl+arrow or Alt+key. The tty mode also supports the mouse if the terminal supports mouse reporting.

3.3 The echo area and mode line

The echo area is the bottom line of the frame (shared with the minibuffer). It displays messages, prompts, and error information. The mode line is a status line above the echo area (or at the bottom of each window) showing information such as the buffer name, major mode, position percentage, line number, and modification status. Both are highly customizable.

3.4 Help system and documentation

Emacs is famously self‑documenting. The help command (C-h) opens a help menu that provides access to documentation for commands, variables, functions, keybindings, and packages. The built‑in Info reader displays the Emacs manual and other manuals in a hypertext format. Users can also access documentation for Elisp symbols via describe-function (C-h f) and describe-variable (C-h v).

Emacs offers a comprehensive set of text editing capabilities, ranging from basic insertion and deletion to sophisticated multiple‑cursor and rectangular editing.

4.1 Basic text editing

Standard editing operations in Emacs are performed via keyboard commands. The default keybindings are modeled after the original Emacs conventions (e.g., C-f for forward character, C-b for backward, C-n next line, C-p previous line).

4.1.1 Insertion, deletion, and navigation

Insertion: typing printable characters inserts them at point. Deletion includes DEL (backward delete character), C-d (forward delete character), C-k (kill line from point to end), and C-w (kill region). Navigation commands move point by character, word, line, sentence, paragraph, and page. Emacs also provides movement commands for beginning/end of buffer (M-<, M->).

4.1.2 Kill ring and the mark

Deleted or “killed” text is stored in the kill ring, a circular list of recent deletions. The yank command (C-y) inserts the most recent kill, and subsequent M-y cycles through older kills. The mark is a position in the buffer (set with C-SPC or C-@) that, together with point, defines a region for operations like copying (M-w), killing, or indentation.

4.2 Search and replace

Emacs provides powerful search and replace features that operate on the current buffer or a region.

4.2.1 Incremental search (isearch)

Incremental search (C-s for forward, C-r for backward) searches as the user types. Characters are added to the search string and Emacs immediately moves point to the first match. Multiple matches are navigated with repeated C-s or C-r. The search string can include case folding, regexp patterns, and other options.

4.2.2 Regular expression support

Emacs supports Emacs‑specific regular expressions (similar to POSIX extended) in many commands. The search-forward-regexp (C-M-s) and replace-regexp commands allow pattern‑based searching and substitution. Regular expressions can reference matched groups with \1, \2, etc.

4.3 Multiple cursors and rectangular editing

While not built‑in by default, multiple cursor functionality is available through the multiple-cursors package. Emacs natively supports rectangular editing via C-x r t (insert text in rectangle) and C-x r k (kill rectangle). The rectangle-mark-mode (C-x SPC) allows interactive rectangle selection and editing.

Emacs is designed to be extended at every level. Users can add new features, modify existing ones, and install third‑party packages to tailor the editor to their workflow.

5.1 The package system (ELPA, MELPA, Non‑GNU ELPA)

Starting with GNU Emacs 24, a built‑in package manager (package.el) allows users to download and install extensions from repositories.

5.1.1 Using package.el

To install a package, users invoke M-x package-install and type the package name. The manager handles dependencies and keeps installed packages up to date via M-x package-list-packages. Users can configure which repositories to use by setting package-archives.

The three main repositories are:

  • ELPA (Emacs Lisp Package Archive): The official GNU repository, maintained by the Free Software Foundation, containing only free software.
  • MELPA (Milkypostman’s Emacs Lisp Package Archive): A community‑run repository with a vast collection of packages, many updated directly from their source repositories.
  • Non‑GNU ELPA: An official but separate repository for packages that are not GNU projects but are still free software.

5.2 Customization methods

Users can customize Emacs interactively or by writing Lisp code.

5.2.1 Setting variables (customize and setq)

The customize interface (M-x customize) provides a graphical way to browse and change user options. Many variables can be saved to the user’s initialization file. For quick one‑time changes, the setq function is used in Elisp, e.g., (setq-default indent-tabs-mode nil).

5.2.2 Writing user configuration (init.el)

The primary configuration file is ~/.emacs.d/init.el. This file is loaded when Emacs starts. It can contain setq calls, keybindings, mode hooks, package initializations, and any arbitrary Elisp. Users often organize their configuration into multiple files and load them with require or load.

5.2.3 Creating and installing packages

Advanced users can distribute their own extensions as packages. A package typically includes an Elisp file with a provide statement, a Commentary section, and optionally other files (e.g., images, info manuals). Packages are distributed via a repository or shared as tarballs.

5.3 Notable extensions

The Emacs ecosystem includes thousands of packages. The following are among the most widely used:

5.3.1 Org‑mode: outlining, note‑taking, and task management

Org‑mode is a major mode for structured plain‑text files. It supports hierarchical outlines, TODO lists, deadlines, tables, literate programming, export to HTML/LaTeX/PDF, and agenda views. It is often described as “about as close as you can get to a perfect editor for personal organization.”

5.3.2 Magit: a Git interface

Magit provides a complete Git porcelain inside Emacs. It displays the state of a repository in a status buffer and allows staging, committing, branching, merging, rebasing, and viewing history with intuitive keybindings. Magit is widely praised for its usability and depth.

5.3.3 Dired: file manager

Dired (Directory Editor) lists directory contents and supports file operations (copy, move, delete, rename, compress, etc.) using Emacs keybindings. It can be extended with additional features like wdired (editing filenames inline) and image previews.

5.3.4 ERC and Rcirc: IRC clients

ERC is a full‑featured IRC client built into Emacs. Rcirc is a simpler alternative. Both support multiple servers, channels, nick completion, and logging. ERC also supports notifications, scripting, and integration with other Emacs packages.

5.3.5 ESS: statistical programming

ESS (Emacs Speaks Statistics) provides major modes for R, SAS, Stata, S‑Plus, and other statistical languages. It offers syntax highlighting, interactive REPL integration, code evaluation, and help documentation.

5.3.6 SLIME: Common Lisp development

SLIME (Superior Lisp Interaction Mode for Emacs) connects to a Common Lisp implementation via a socket. It provides an interactive REPL, inspector, debugger, compiler notes, and symbol completion. SLIME is the de facto standard for Common Lisp development in Emacs.

Emacs has a long‑standing, passionate user and developer community that spans decades. Its culture is characterized by strong opinions, shared humor, and a commitment to freedom and extensibility.

6.1 The Emacs community

The community is distributed but vibrant, with communication happening across several channels.

6.1.1 Mailing lists, newsgroups, and forums

The GNU Emacs project maintains official mailing lists (e.g., emacs‑devel, help‑gnu‑emacs). Historically, the Usenet newsgroup gnu.emacs.help was a central hub. Today, discussion also takes place on Reddit (r/emacs), Stack Exchange (Emacs Stack Exchange), and various IRC channels (#emacs on Libera.Chat). The community is known for being welcoming to newcomers while maintaining high technical standards.

6.1.2 EmacsConf and other events

EmacsConf is an annual online conference featuring talks about Emacs usage, development, and packages. Local meetups and workshops occur in various cities, often organized by user groups. Other events include “Emacs Hangouts” and hackathons.

6.2 Emacs humor and memes

Over the years, Emacs has spawned a distinctive set of in‑jokes and memes that reflect its philosophy and idiosyncrasies.

6.2.1 “Emacs is a great operating system, lacking only a decent editor”

This quip, attributed to various sources, humorously captures the fact that Emacs has evolved into a computing environment capable of running shells, web browsers, email clients, and games, all within its own framework. The joke underscores that Emacs is far more than a text editor.

6.2.2 The religious wars with vi/Vim

The rivalry between Emacs and vi/Vim is one of the oldest in computing culture. Jokes and debates about the merits of each editor—keybindings, memorability, extensibility, and philosophy—are common. The community often references the “editor war” tongue‑in‑cheek, with Emacs users sometimes calling themselves “the Church of Emacs” (a reference to Richard Stallman’s playful religious metaphors). Despite the rivalry, many developers use both editors for different tasks.

6.3 Learning resources

Emacs provides extensive documentation, and the community offers many avenues for learning.

6.3.1 The Emacs manual and info system

The official GNU Emacs Manual is available within Emacs via the Info reader (C-h i). It covers basic operation, customization, and advanced topics. The Emacs Lisp Reference Manual provides a thorough description of the language and API. Both manuals are updated with each release.

6.3.2 Tutorials, books, and online guides

The built‑in tutorial (C-h t) teaches beginners the fundamental keybindings and concepts. Several reference books have been published, such as _Learning GNU Emacs_ and _Writing GNU Emacs Extensions_. Online guides, screencasts, and blogs (e.g., emacs.stackexchange.com, emacsredux.com, sachachua.com) offer practical advice and tricks. The community emphasizes learning by doing and by reading the source code of packages.