Jump to content

Emacs

From Alfawiki
Emacs
Company typeSoftware
IndustryText editors / Software development
Founded1976
FounderDavid A. Moon, Guy L. Steele Jr.
Key people
Richard Stallman (maintainer of GNU Emacs)
ProductsGNU Emacs, XEmacs, Aquamacs, Meadow, MicroEMACS, mg, JOVE, MINCE, Freemacs, Zmacs, Epsilon, PceEmacs, Hemlock, edwin

Emacs—initially known as EMACS (short for "Editor Macros")—represents a suite of highly adaptable text editors.Cite error: Closing </ref> missing for <ref> tag This integrated system was named EMACS—standing for Editing MACroS or simply E with MACroS. Over time, recursive acronyms like EMACS Makes All Computing Simple were coined. The name "Emacs" was chosen by Stallman because the letter "E" was unused on ITS.[1] A popular but unfounded tale connects the name to an ice cream parlor in Boston; however, this is considered folklore.[2] The first functional EMACS system emerged in late 1976.[3]

Stallman promoted a culture of shared development within Emacs’ evolution, insisting that all enhancements be contributed back for integration:[3]

Initially confined to PDP-10 systems running ITS, Emacs rapidly established itself as the preferred editor in that environment. Mike McMahon later adapted it for TENEX and TOPS-20 platforms. Early contributors included notable figures such as Kent Pitman, Earl Killian, and Eugene Ciccarelli. By 1979, Emacs had become the dominant editor at MIT's AI Lab and Laboratory for Computer Science.[4]

Initial Versions

Over the following years, a variety of Emacs-inspired editors emerged across different platforms. Among these were EINE (EINE Is Not EMACS) and ZWEI (ZWEI Was EINE Initially), both designed for the Lisp machine by Mike McMahon and Daniel Weinreb. Notably, Weinreb’s EINE was the first Emacs variant implemented in Lisp. Owen Theodore Anderson also contributed by creating Sine (Sine Is Not Eine). In 1978, Bernard Greenberg developed Multics Emacs, primarily written in Multics Lisp at Honeywell’s Cambridge Information Systems Laboratory. Later, maintenance of Multics Emacs was undertaken by Richard Soley, who also created the NILE editor for the NIL Project, alongside Barry Margolin. Lisp eventually became the extension language foundation for numerous Emacs versions, including GNU Emacs.

In 1981, James Gosling, later recognized for inventing NeWS and the Java programming language, developed Gosling Emacs. This was the first Emacs-like editor tailored for Unix, coded in C and utilizing Mocklisp, a Lisp-inspired extension language.

Commercially, Computer Corporation of America’s CCA EMACS, authored by Steve Zimmerman, appeared in advertisements in 1984. Initially derived from Warren Montgomery’s EMACS, CCA EMACS underwent a complete rewrite before its commercial launch in 1983. It faithfully replicated Richard Stallman’s original PDP-10 EMACS while introducing many additional commands. In 1984, CCA EMACS secured a site license at MIT for Project Athena, competing against other Emacs variants.

GNU Emacs

In 1984, Richard Stallman initiated development of GNU Emacs as a free software alternative to the proprietary Gosling Emacs. Although initially based on Gosling Emacs, Stallman replaced its Mocklisp interpreter with a genuine Lisp interpreter, necessitating an almost total rewrite. GNU Emacs became the inaugural program released under the GNU Project. Written predominantly in C, it employs Emacs Lisp—also implemented in C—as its extension language. The first public version, 13, was released on March 20, 1985; version 15.34 followed later that year as the first broadly distributed edition. Early releases used a "1.x.x" versioning scheme before jumping to "13" after version 1.12. Since 2014, GNU Emacs has embraced a rapid release model with more frequent version updates.

Providing more capabilities than Gosling Emacs—especially through a comprehensive Lisp extension language—GNU Emacs quickly became the standard editor on Unix systems. Roughly 70% of its source code is written in Emacs Lisp, which facilitates easier porting to new environments by concentrating platform-specific code within the C core.

Initially developed under closed conditions, GNU Emacs opened its development process in 1999. It transitioned from a single CVS trunk to Bazaar distributed version control in 2008 and later migrated to Git in 2014. Richard Stallman has served as the primary maintainer but has occasionally stepped back. From 2008 to 2015, Stefan Monnier and Chong Yidong managed maintenance; John Wiegley assumed leadership in 2015 before resigning in 2018. Eli Zaretskii then took over as lead maintainer, with Stefan Kangas joining in 2023 and Andrea Corallo in 2024.

By early 2014, more than 579 individual contributors had participated in GNU Emacs’ ongoing development.

XEmacs

Originating from an early alpha version of GNU Emacs 19 in 1991, Lucid Emacs was developed by Jamie Zawinski and colleagues at Lucid Inc., marking one of the pioneering major forks in the free software landscape. This project was eventually renamed XEmacs. Although development has significantly decelerated, with the last stable version 21.4.22 released in January 2009 and a beta version appearing in June 2025, many features initially exclusive to XEmacs have since been integrated into GNU Emacs.

Additional GNU Emacs Forks

Prominent forks encompass:

  • Aquamacs – built upon GNU Emacs (versions 24 and 25), designed to seamlessly blend with the Apple Macintosh graphical interface.
  • Meadow – a Japanese adaptation of GNU Emacs for Windows, enhancing multilingual capabilities and offering flexible installation through Netinstaller.

Various Emacs Variants

To accommodate older or less capable hardware, smaller Emacs derivatives were created, addressing the original GNU Emacs demand for at least 1 MiB RAM typical of 1980s workstations. Despite modern machines easily running full-featured Emacs, these lightweight alternatives remain useful for minimal setups or rapid editing.

Significant variants include:

  • MicroEMACS, initially developed by Dave Conroy and Daniel Lawrence, spawning several versions.
  • mg, a public domain offshoot of MicroEMACS that mimics GNU Emacs behavior; it is the default editor on OpenBSD and macOS.
  • JOVE, Jonathan Payne’s simplified UNIX Emacs variant without programmability.
  • MINCE, a CP/M and DOS version that evolved into Borland’s Sprint word processor.
  • Perfect Writer, a CP/M word processor bundled with early Kaypro computers.
  • Freemacs, a DOS-based editor designed to fit within a 64 KiB memory footprint using macro-driven extensions.
  • Zmacs, developed for MIT Lisp Machines and implemented in ZetaLisp.
  • Epsilon, produced by Lugaru Software, supports multiple operating systems and features a C-like scripting language.
  • PceEmacs, an editor integrated with SWI-Prolog.
  • Hemlock, written in Spice Lisp and Common Lisp as part of CMU Common Lisp, influencing several Lisp environments.
  • edwin, an Emacs-like editor included with MIT/GNU Scheme.

Editors Featuring Emacs Emulation

  • The Cocoa text system employs similar terminology and supports numerous Emacs navigation bindings by utilizing the Command key instead of the Control key.
  • Eclipse (IDE) includes support for Emacs-style keybindings.
  • Epsilon (text editor) defaults to an Emacs emulation mode while also providing a vi mode.
  • GNOME Builder incorporates an Emacs emulation feature.
  • GNU Readline, a command-line editing library, supports standard Emacs navigation keys as well as vi emulation.
  • IntelliJ IDEA offers keybindings compatible with Emacs users.
  • JED contains an Emacs emulation mode.
  • Joe's Own Editor can emulate Emacs keybindings when invoked appropriately.
  • MATLAB provides Emacs keybinding support within its editor interface.
  • Multi-Edit includes options for using Emacs-style shortcuts.
  • The KornShell features an Emacs line-editing mode that predates GNU Readline.
  • Visual Studio Code supports various extensions enabling Emacs keybinding emulation.
  • Oracle SQL Developer offers a built-in configuration that mimics Emacs keybindings for customizable keyboard shortcuts.

Features

Emacs is fundamentally a text editor focused on text manipulation, yet it also handles document formatting and printing by integrating with external applications such as LaTeX, Ghostscript, or web browsers. It offers commands to operate on and emphasize semantic units like words, sentences, paragraphs, and programming elements including functions. The editor supports keyboard macros to automate repetitive editing processes.

GNU Emacs features a real-time display capability, rendering changes immediately on the screen as they happen—a pioneering innovation. This approach differs from older line editors such as QED, ed, and Edlin, which required explicit commands to refresh the display after edits.

General architecture

Almost all of Emacs’ functionality, encompassing core editing tasks, is realized through functions authored in a Lisp dialect named Emacs Lisp (Elisp). Created specifically for porting Emacs to GNU and Unix systems, Emacs Lisp operates atop a robust core implemented in C programming language, ensuring compatibility across various operating systems and hardware platforms without changing the Lisp semantics. Both variables and functions can be modified dynamically without restarting Emacs, with foundational features compiled asynchronously during runtime. Contemporary GNU Emacs supports compilation of Emacs Lisp into both bytecode and native code.

Customization is governed by variables, classes, and data structures that update dynamically. The use of Lisp's symbolic expressions (sexprs) facilitates uniform customization and feature development within the same format, unlike editors such as VS Code, which separate configuration from interface languages. Emacs’ transparent design exposes its internals to users directly, reducing the divide between utilizing and programming the editor while preserving a stable and responsive environment for all users.

Interactive data

The central text editing data structure in Emacs is the buffer, a memory segment holding data (typically text) along with attributes including:

  • The point: the position of the editing cursor;
  • The mark: a user-set location used in conjunction with point to define
  • The region: a continuous selection of text;
  • The name and inode of the file currently visited by the buffer;
  • The default directory used for executing operating system commands;
  • The buffer’s mode settings, encompassing one major mode alongside multiple minor modes;
  • The buffer encoding;
  • Various buffer local variables and Emacs Lisp internal state.

Modes organize Emacs’ capabilities by linking specific behaviors and keybindings to the buffer’s content type. Major modes customize commands for particular tasks such as editing source code, hex data manipulation, file system navigation, or interacting with git. Meanwhile, minor modes offer supplementary functionality that can apply across different major modes (for example, auto-save-mode). Minor modes may be enabled either locally or globally; major modes are assigned per individual buffer. Additional buffer-related attributes can be altered live by focusing on that buffer.

User inputs—such as keystrokes or mouse actions—invoke Emacs Lisp commands, which are functions intended for interactive execution. Key mappings are fully customizable, and commands can execute arbitrary user-defined Emacs Lisp code. Even basic input like printable characters triggers Emacs Lisp functions—for instance, self-insert-command inserts characters at the current point.

As an example, pressing in a text buffer runs , inserting a single 'f' at point. The numeric argument (here 1), known as the universal argument, governs repetition or other command-specific behavior. This argument can be provided via prefixes such as or , which translate into . If no prefix is supplied, commands execute once by default.

Universal arguments may also take negative or zero values where applicable; functions interpret these according to their own logic. For example, a sorting command might reverse its order if given a negative argument, or undo/redo operations may traverse history backward or forward accordingly.

Command syntax

Emacs employs a standardized command syntax to succinctly represent keystrokes for executing functions, recognizing modifier keys such as C- (Control), A- (Alt), S- (Shift), M- (Meta), s- (Super), and H- (Hyper). While some of these keys may not be physically available on all keyboards, they can generally be configured. Keys with names longer than one character are enclosed in angle brackets. For instance, is denoted as C-A-S-<f9>, and the command for incremental file search is represented by M-s f C-M-s. Commands lacking predefined shortcuts, such as scratch-buffer, are executed through sequences like M-x scra <return>, with Emacs completing the shortest unique key sequence automatically.

Dynamic interface

Emacs distinguishes its interface components with specific terminology: buffers store content and are shown within windows, which are tiled sections of the terminal or graphical user interface; these windows exist inside frames, analogous to conventional operating system windows. Windows may feature scroll bars, line numbering, a header line for navigation assistance, and a mode line displaying buffer information. The bottom area of a frame functions as an 'echo area' for messages and includes a 'minibuffer' for entering commands.

Buffers operate independently from windows; multiple windows can simultaneously display the same buffer to view different portions concurrently. Likewise, several buffers can share identical text content while applying distinct major modes. Emacs instances are not restricted to single frames; it supports multiple frames presenting one process across various monitors or remote connections.

Emacs can function as a headless editing server daemon, enabling client connections via frames. This server mode facilitates background process handling, input gathering from pipes or network ports, scheduled task execution, and maintains persistent states such as undo history and command logs. Its capabilities overlap with terminal multiplexers like GNU Screen and tmux.

By decoupling display from editing logic, Emacs maintains consistent operation across devices beyond basic terminals, offering graphical WIMP components on advanced text terminals, though graphical frames remain the preferred visual environment.

Customization and extensibility

  • Users can record sequences of actions into macros to automate intricate or repetitive workflows. Although macros are frequently created for temporary use and then discarded, they may also be saved for repeated application.
    • Thanks to Emacs Lisp’s unified feature structure, macros can encompass key presses, commands, mouse interactions, other macros, and any executable operations. They support recursion and can be defined within other macros.
  • During startup, Emacs executes an Emacs Lisp script such as , , , or . It first processes if available, which sets up fundamental features including graphical display and the package manager. Following this, Emacs loads the first found initialization file while ignoring others. Common configuration tasks include:
    • Adjusting global variables or calling functions to modify default behavior (e.g., )
    • Creating or overriding key bindings to customize or extend shortcuts (e.g., )
    • Loading and initializing additional extensions—most are not active by default
    • Setting up event hooks that trigger code at specific moments, like recompiling source files after saving ()
    • Running supplementary scripts for modular setups typically stored in or
  • The customize system offers an interactive interface for modifying configuration options such as color themes. It provides search capabilities, descriptive information, multiple-choice selections, revert functionality, and live updates without requiring a restart. Customized preferences are saved automatically.
  • Themes specify fonts and color schemes through Emacs Lisp files and can be chosen via the customize interface.
  • Modes enable editing support tailored to various programming languages (e.g., emacs-lisp-mode, c-mode, java-mode, ESS for R) by adjusting syntax highlighting and key bindings accordingly. Additional modes include spreadsheet editing with dismal and structured text editing features.

Self-documentation

The original Emacs incorporated a help library that documented every command, variable, and internal function, effectively making it self-documenting by offering users detailed information about features and the system's current status. Each function includes a documentation string that users can access on demand, a concept later embraced by programming languages such as Lisp, Java, Perl, and Python. Additionally, the help facility connects users directly to the source code of each function, whether it is native or provided by third parties.

Emacs also contains an integrated tutorial authored by Stuart Cracraft and Richard Stallman, which starts automatically if no file is opened.

Church of Emacs

The Church of Emacs, founded by Richard Stallman, is a satirical religion created for Emacs enthusiasts. It humorously labels vi as the editor of the beast (with vi-vi-vi symbolizing 666 in Roman numerals), though it does not discourage vi's usage; instead, it criticizes proprietary software. ("Utilizing a free version of vi is not considered sinful but rather a form of penance.") This parody religion maintains its own newsgroup, , to support its community. In response, vi advocates have established a rival group known as the Cult of vi.

Stallman playfully refers to himself as St I GNU cius, a saintly figure within the Church of Emacs, alluding to the early Christian martyr Ignatius of Antioch.

Terminology

The word emacs is occasionally pluralized as emacsen, drawing a parallel with terms like boxen and VAXen to indicate various Emacs versions.

See also

Bibliography

External links

  1. ↑ ...
  2. ↑ ...
  3. ↑ 3.0 3.1 Cite error: Invalid <ref> tag; no text was provided for refs named 519a
  4. ↑ ...