HOME

TheInfoList



OR:

Emacs (), originally named EMACS (an acronym for "Editor Macros"), is a family of text editors that are characterized by their extensibility. The manual for the most widely used variant,
GNU Emacs GNU Emacs is a text editor and suite of free software tools. Its development began in 1984 by GNU Project founder Richard Stallman, based on the Emacs editor developed for Unix operating systems. GNU Emacs has been a central component of the GNU ...
, describes it as "the extensible, customizable, self-documenting, real-time display editor". Development of the first Emacs began in the mid-1970s, and work on GNU Emacs, directly descended from the original, is ongoing; its latest version is , released . Emacs has over 10,000 built-in commands and its
user interface In the industrial design field of human–computer interaction, a user interface (UI) is the space where interactions between humans and machines occur. The goal of this interaction is to allow effective operation and control of the machine fro ...
allows the user to combine these commands into macros to automate work. Implementations of Emacs typically feature a
dialect A dialect is a Variety (linguistics), variety of language spoken by a particular group of people. This may include dominant and standard language, standardized varieties as well as Vernacular language, vernacular, unwritten, or non-standardize ...
of the
Lisp Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation. Originally specified in the late 1950s, ...
programming language, allowing users and developers to write new commands and applications for the editor. Extensions have been written to, among other things, manage files, remote access,
e-mail Electronic mail (usually shortened to email; alternatively hyphenated e-mail) is a method of transmitting and receiving Digital media, digital messages using electronics, electronic devices over a computer network. It was conceived in the ...
, outlines, multimedia, Git integration, RSS feeds, and
collaborative editing Collaborative editing is the process of multiple people editing the same document simultaneously. This technique may engage expertise from different disciplines, and potentially improve the quality of documents and increase deals. Good choices i ...
, as well as implementations of '' ELIZA'', '' Pong'', '' Conway's Life'', ''
Snake Snakes are elongated limbless reptiles of the suborder Serpentes (). Cladistically squamates, snakes are ectothermic, amniote vertebrates covered in overlapping scales much like other members of the group. Many species of snakes have s ...
'', '' Dunnet'', and '' Tetris''. The original EMACS was written in 1976 by David A. Moon and Guy L. Steele Jr. as a set of macros for the TECO editor. It was inspired by the ideas of the TECO-macro editors TECMAC and TMACS. The most popular, and most ported, version of Emacs is GNU Emacs, which was created by Richard Stallman for the
GNU Project The GNU Project ( ) is a free software, mass collaboration project announced by Richard Stallman on September 27, 1983. Its goal is to give computer users freedom and control in their use of their computers and Computer hardware, computing dev ...
. XEmacs is a variant that branched from GNU Emacs in 1991. GNU Emacs and XEmacs use similar Lisp dialects and are, for the most part, compatible with each other. XEmacs development is inactive.
GNU Emacs GNU Emacs is a text editor and suite of free software tools. Its development began in 1984 by GNU Project founder Richard Stallman, based on the Emacs editor developed for Unix operating systems. GNU Emacs has been a central component of the GNU ...
is, along with vi, one of the two main contenders in the traditional editor wars of
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
culture. GNU Emacs is among the oldest free and open source projects still under development.


History

Emacs development began during the 1970s at the MIT AI Lab, whose PDP-6 and
PDP-10 Digital Equipment Corporation (DEC)'s PDP-10, later marketed as the DECsystem-10, is a mainframe computer family manufactured beginning in 1966 and discontinued in 1983. 1970s models and beyond were marketed under the DECsystem-10 name, especi ...
computers used the Incompatible Timesharing System (ITS)
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
that featured a default line editor known as Tape Editor and Corrector (TECO). Unlike most modern text editors, TECO used separate modes in which the user would either add text, edit existing text, or display the document. One could not place characters directly into a document by typing them into TECO, but would instead enter a character ('i') in the TECO command language telling it to switch to input mode, enter the required characters, during which time the edited text was not displayed on the screen, and finally enter a character () to switch the editor back to command mode. (A similar technique was used to allow overtyping.) This behavior is similar to that of the program ed. By the 1970s, TECO was already an old program, initially released in 1962. Richard Stallman visited the Stanford AI Lab in 1976 and saw the lab's ''E'' editor, written by Fred Wright. He was impressed by the editor's intuitive WYSIWYG (What You See Is What You Get) behavior, which has since become the default behavior of most modern text editors. He returned to MIT where Carl Mikkelsen, a
hacker A hacker is a person skilled in information technology who achieves goals and solves problems by non-standard means. The term has become associated in popular culture with a security hackersomeone with knowledge of bug (computing), bugs or exp ...
at the AI Lab, had added to TECO a combined display/editing mode called ''Control-R'' that allowed the screen display to be updated each time the user entered a keystroke. Stallman reimplemented this mode to run efficiently and then added a macro feature to the TECO display-editing mode that allowed the user to redefine any keystroke to run a TECO program. E had another feature that TECO lacked: random-access editing. TECO was a page-sequential editor that was designed for editing paper tape on the PDP-1 at a time when computer memory was generally small due to cost, and it was a feature of TECO that allowed editing on only one page at a time sequentially in the order of the pages in the file. Instead of adopting E's approach of structuring the file for page-random access on disk, Stallman modified TECO to handle large buffers more efficiently and changed its file-management method to read, edit, and write the entire file as a single buffer. Almost all modern editors use this approach. The new version of TECO quickly became popular at the AI Lab and soon accumulated a large collection of custom macros whose names often ended in ''MAC'' or ''MACS'', which stood for ''macro''. Two years later, Guy Steele took on the project of unifying the diverse macros into a single set. Steele and Stallman's finished implementation included facilities for extending and documenting the new macro set. The resulting system was called EMACS, which stood for ''Editing MACroS'' or, alternatively, ''E with MACroS''. Stallman picked the name Emacs "because was not in use as an abbreviation on ITS at the time." An
apocrypha Apocrypha () are biblical or related writings not forming part of the accepted canon of scripture, some of which might be of doubtful authorship or authenticity. In Christianity, the word ''apocryphal'' (ἀπόκρυφος) was first applied to ...
l hacker koan alleges that the program was named after Emack & Bolio's, a popular
Boston Boston is the capital and most populous city in the Commonwealth (U.S. state), Commonwealth of Massachusetts in the United States. The city serves as the cultural and Financial centre, financial center of New England, a region of the Northeas ...
ice cream store. The first operational EMACS system existed in late 1976. Stallman saw a problem in too much customization and ''de facto'' forking and set certain conditions for usage. He later wrote: The original Emacs, like TECO, ran only on the PDP-10 running ITS. Its behavior was sufficiently different from that of TECO that it could be considered a text editor in its own right, and it quickly became the standard editing program on ITS. Mike McMahon ported Emacs from ITS to the TENEX and TOPS-20 operating systems. Other contributors to early versions of Emacs include Kent Pitman, Earl Killian, and Eugene Ciccarelli. By 1979, Emacs was the main editor used in MIT's AI lab and its Laboratory for Computer Science.


Implementations


Early implementations

In the following years, programmers wrote a variety of Emacs-like editors for other computer systems. These included EINE (''EINE Is Not EMACS'') and ZWEI (''ZWEI Was EINE Initially''), which were written for the Lisp machine by Mike McMahon and Daniel Weinreb, and Sine (''Sine Is Not Eine''), which was written by Owen Theodore Anderson. Weinreb's EINE was the first Emacs written in Lisp. In 1978, Bernard Greenberg wrote Multics Emacs almost entirely in Multics Lisp at
Honeywell Honeywell International Inc. is an American publicly traded, multinational conglomerate corporation headquartered in Charlotte, North Carolina. It primarily operates in four areas of business: aerospace, building automation, industrial automa ...
's Cambridge Information Systems Lab. Multics Emacs was later maintained by Richard Soley, who went on to develop the NILE Emacs-like editor for the NIL Project, and by Barry Margolin. Many versions of Emacs, including GNU Emacs, would later adopt Lisp as an extension language.
James Gosling James Arthur Gosling (born 19 May 1955) is a Canadian computer scientist, best known as the founder and lead designer behind the Java (programming language), Java programming language. Gosling was elected a member of the National Academy of E ...
, who would later invent
NeWS News is information about current events. This may be provided through many different Media (communication), media: word of mouth, printing, Mail, postal systems, broadcasting, Telecommunications, electronic communication, or through the te ...
and the
Java programming language Java is a high-level, general-purpose, memory-safe, object-oriented programming language. It is intended to let programmers ''write once, run anywhere'' ( WORA), meaning that compiled Java code can run on all platforms that support Jav ...
, wrote Gosling Emacs in 1981. The first Emacs-like editor to run on
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
, Gosling Emacs was written in C and used Mocklisp, a language with Lisp-like syntax, as an extension language. Early Ads for Computer Corporation of America's ''CCA EMACS'' (Steve Zimmerman) appeared in 1984. 1985 comparisons to GNU Emacs, when it came out, mentioned free vs. $2,400.


GNU Emacs

Richard Stallman began work on GNU Emacs in 1984 to produce a
free software Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
alternative to the proprietary Gosling Emacs. GNU Emacs was initially based on Gosling Emacs, but Stallman's replacement of its Mocklisp interpreter with a true Lisp interpreter required that nearly all of its code be rewritten. This became the first program released by the nascent GNU Project. GNU Emacs is written in C and provides
Emacs Lisp Emacs Lisp is a Lisp dialect made for Emacs. It is used for implementing most of the editing functionality built into Emacs, the remainder being written in C, as is the Lisp interpreter. Emacs Lisp code is used to modify, extend and customi ...
, also implemented in C, as an extension language. Version 13, the first public release, was made on March 20, 1985. The first widely distributed version of GNU Emacs was version 15.34, released later in 1985. Early versions of GNU Emacs were numbered as ''1.x.x'', with the initial digit denoting the version of the C core. The ''1'' was dropped after version 1.12, as it was thought that the major number would never change, and thus the numbering skipped from ''1'' to ''13''. In September 2014, it was announced on the GNU emacs-devel mailing list that GNU Emacs would adopt a rapid release strategy and version numbers would increment more quickly in the future. GNU Emacs offered more features than Gosling Emacs, in particular a full-featured Lisp as its extension language, and soon replaced Gosling Emacs as the ''de facto'' Unix Emacs editor. Markus Hess exploited a security flaw in GNU Emacs' email subsystem in his 1986 cracking spree in which he gained
superuser In computing, the superuser is a special user account used for system administration. Depending on the operating system (OS), the actual name of this account might be root, administrator, admin or supervisor. In some cases, the actual name of the ...
access to Unix computers. Most of GNU Emacs functionality is implemented through a
scripting language In computing, a script is a relatively short and simple set of instructions that typically automation, automate an otherwise manual process. The act of writing a script is called scripting. A scripting language or script language is a programming ...
called
Emacs Lisp Emacs Lisp is a Lisp dialect made for Emacs. It is used for implementing most of the editing functionality built into Emacs, the remainder being written in C, as is the Lisp interpreter. Emacs Lisp code is used to modify, extend and customi ...
. Because about 70% of GNU Emacs is written in the Emacs Lisp extension language, one only needs to port the C core which implements the Emacs Lisp interpreter. This makes porting Emacs to a new platform considerably less difficult than porting an equivalent project consisting of native code only. GNU Emacs development was relatively closed until 1999 and was used as an example of the ''Cathedral'' development style in '' The Cathedral and the Bazaar''. The project has since adopted a public development mailing list and anonymous CVS access. Development took place in a single CVS trunk until 2008 and was then switched to the Bazaar DVCS. On November 11, 2014, development was moved to Git. Richard Stallman has remained the principal maintainer of GNU Emacs, but he has stepped back from the role at times. Stefan Monnier and Chong Yidong were maintainers from 2008 to 2015. John Wiegley was named maintainer in 2015 after a meeting with Stallman at MIT. As of early 2014, GNU Emacs has had 579 individual committers throughout its history.


XEmacs

Lucid Emacs, based on an early alpha version of GNU Emacs 19, was developed beginning in 1991 by Jamie Zawinski and others at
Lucid Inc. Lucid Incorporated was a Menlo Park, California, Menlo Park, California-based computer software development company. Founded by Richard P. Gabriel in 1984, it went bankrupt in 1994. History The first CEO was Tony Slocum, formerly of IntelliCorp ...
One of the best-known early forks in
free software Free software, libre software, libreware sometimes known as freedom-respecting software is computer software distributed open-source license, under terms that allow users to run the software for any purpose as well as to study, change, distribut ...
development occurred when the codebases of the two Emacs versions diverged and the separate development teams ceased efforts to merge them back into a single program. Lucid Emacs has since been renamed XEmacs. Its development is currently inactive, with the most recent stable version 21.4.22 released in January 2009 (while a beta was released in 2013), while GNU Emacs has implemented many formerly XEmacs-only features.


Other forks of GNU Emacs

Other notable forks include: *Aquamacs – based on GNU Emacs (Aquamacs 3.2 is based on GNU Emacs version 24 and Aquamacs 3.3 is based on GNU Emacs version 25) which focuses on integrating with the Apple Macintosh user interface *Meadow – a Japanese version for Microsoft Windows, which ported the Emacs text editor for
UNIX Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
-based operating systems to
Microsoft Windows Windows is a Product lining, product line of Proprietary software, proprietary graphical user interface, graphical operating systems developed and marketed by Microsoft. It is grouped into families and subfamilies that cater to particular sec ...
with some added functions. The name comes from the phrase "Multilingual enhancement to GNU Emacs with ADvantages Over Windows". Meadow utilizes Netinstaller, similar to the one used for Cygwin installation. This allows users to install Meadow in the way the user wanted, making it easier to get started with Meadow.


Various Emacs editors

In the past, projects aimed at producing small versions of Emacs proliferated. GNU Emacs was initially targeted at computers with a 32-bit flat address space and at least 1  MiB of RAM. Such computers were high end
workstation A workstation is a special computer designed for technical or computational science, scientific applications. Intended primarily to be used by a single user, they are commonly connected to a local area network and run multi-user operating syste ...
s and minicomputers in the 1980s, and this left a need for smaller reimplementations that would run on common
personal computer A personal computer, commonly referred to as PC or computer, is a computer designed for individual use. It is typically used for tasks such as Word processor, word processing, web browser, internet browsing, email, multimedia playback, and PC ...
hardware. Today's computers have more than enough power and capacity to eliminate these restrictions, but small clones have more recently been designed to fit on software installation disks or for use on less capable hardware. Other projects aim to implement Emacs in a different dialect of Lisp or a different programming language altogether. Although not all are still actively maintained, these clones include: * MicroEMACS, which was originally written by Dave Conroy and further developed by Daniel Lawrence and which exists in many variations. * mg, originally called MicroGNUEmacs and, later, mg2a, a public-domain offshoot of MicroEMACS intended to more closely resemble GNU Emacs. Now installed by default on OpenBSD and macOS. * JOVE (Jonathan's Own Version of Emacs), Jonathan Payne's non-programmable Emacs implementation for
UNIX-like A Unix-like (sometimes referred to as UN*X, *nix or *NIX) operating system is one that behaves in a manner similar to a Unix system, although not necessarily conforming to or being certified to any version of the Single UNIX Specification. A Uni ...
systems. * MINCE (MINCE Is Not Complete Emacs), a version for
CP/M CP/M, originally standing for Control Program/Monitor and later Control Program for Microcomputers, is a mass-market operating system created in 1974 for Intel 8080/Intel 8085, 85-based microcomputers by Gary Kildall of Digital Research, Dig ...
and later DOS, from
Mark of the Unicorn Mark of the Unicorn (MOTU) is a music-related computer software and hardware supplier developed by Jason Linhart, Craig Finseth, Scott Layson Burson, Brian Hess. It is based in Cambridge, Massachusetts and has created music software since 1984. ...
. MINCE evolved into Final Word, which eventually became the Borland Sprint word processor. * Perfect Writer, a
CP/M CP/M, originally standing for Control Program/Monitor and later Control Program for Microcomputers, is a mass-market operating system created in 1974 for Intel 8080/Intel 8085, 85-based microcomputers by Gary Kildall of Digital Research, Dig ...
implementation derived from MINCE that was included circa 1982 as the default word processor with the very earliest releases of the Kaypro II and Kaypro IV. It was later provided with the Kaypro 10 as an alternative to WordStar. * Freemacs, a DOS version that uses an extension language based on text macro expansion and fits within the original 64 KiB flat memory limit. * Zmacs, for the MIT Lisp Machine and its descendants, implemented in ZetaLisp. * Epsilon, an Emacs clone by Lugaru Software. Versions for DOS, Windows, Linux, FreeBSD, Mac OS X and OS/2 are bundled in the release. It uses a non-Lisp extension language with C syntax and used a very early concurrent command shell buffer implementation under the single-tasking MS-DOS. * PceEmacs is the Emacs-based editor for SWI-Prolog. * Hemlock, originally written in Spice Lisp, then
Common Lisp Common Lisp (CL) is a dialect of the Lisp programming language, published in American National Standards Institute (ANSI) standard document ''ANSI INCITS 226-1994 (S2018)'' (formerly ''X3.226-1994 (R1999)''). The Common Lisp HyperSpec, a hyperli ...
. A part of CMU Common Lisp. Influenced by Zmacs. Later forked by Lucid Common Lisp (as Helix), LispWorks and Clozure CL projects. There is also a Portable Hemlock project, which aims to provide a Hemlock, which runs on several Common Lisp implementations. * edwin, an Emacs-like text editor included with MIT/GNU Scheme.


Editors with Emacs emulation

* The Cocoa text system uses some of the same terminology and understands many Emacs navigation bindings. This is possible because the native UI uses the Command key (equivalent to Super) instead of the
Control key In computing, a Control key is a modifier key which, when pressed in conjunction with another key, performs a special operation (for example, ). Similarly to the Shift key, the Control key rarely performs any function when pressed by itself. ...
. * Eclipse (IDE) provides a set of Emacs keybindings. * Epsilon (text editor) Defaults to Emacs emulation and supports a vi mode. * GNOME Builder has an emulation mode for Emacs. * GNU Readline is a line editor that understands the standard Emacs navigation keybindings. It also has a vi emulation mode. * IntelliJ IDEA provides a set of Emacs keybindings. * JED has an emulation mode for Emacs. * Joe's Own Editor emulates Emacs keybindings when invoked as . * MATLAB provides Emacs keybindings for its editor. * Multi-Edit provides Emacs keybindings for its editor. *
KornShell KornShell (ksh) is a Unix shell which was developed by David Korn (computer scientist), David Korn at Bell Labs in the early 1980s and announced at USENIX Annual Technical Conference, USENIX on July 14, 1983. The initial development was base ...
has an Emacs line editing mode that predates Gnu Readline. * Visual Studio Code has multiple extensions available to emulate Emacs keybindings. * Oracle SQL Developer can save and load alternative keyboard-shortcut layouts. One of the built-in layouts provides Emacs-like keybindings, including using different commands to achieve closer behavior.


Features

Emacs is primarily a text editor and is designed for manipulating pieces of text, although it is capable of formatting and printing documents like a
word processor A word processor (WP) is a device or computer program that provides for input, editing, formatting, and output of text, often with some additional features. Early word processors were stand-alone devices dedicated to the function, but current word ...
by interfacing with external programs such as
LaTeX Latex is an emulsion (stable dispersion) of polymer microparticles in water. Latices are found in nature, but synthetic latices are common as well. In nature, latex is found as a wikt:milky, milky fluid, which is present in 10% of all floweri ...
, Ghostscript or a
web browser A web browser, often shortened to browser, is an application for accessing websites. When a user requests a web page from a particular website, the browser retrieves its files from a web server and then displays the page on the user's scr ...
. Emacs provides commands to manipulate and differentially display
semantic Semantics is the study of linguistic Meaning (philosophy), meaning. It examines what meaning is, how words get their meaning, and how the meaning of a complex expression depends on its parts. Part of this process involves the distinction betwee ...
units of text such as words, sentences,
paragraph A paragraph () is a self-contained unit of discourse in writing dealing with a particular point or idea. Though not required by the orthographic conventions of any language with a writing system, paragraphs are a conventional means of organizing ...
s and
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
constructs such as functions. It also features ''keyboard macros'' for performing user-defined batches of editing commands. GNU Emacs is a ''real-time display'' editor, as its edits are displayed onscreen as they occur. This is standard behavior for modern text editors but EMACS was among the earliest to implement this. The alternative is having to issue a distinct command to display text, (e.g. before or after modifying it). This was common in earlier (or merely simpler) line and context editors, such as QED (BTS, CTSS, Multics), ed (Unix), ED (CP/M), and Edlin (DOS).


General architecture

Almost all of the functionality in Emacs, including basic editing operations such as the insertion of characters into a file, is achieved through functions written in a dialect of the
Lisp programming language Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation. Originally specified in the late 1950s, ...
. The dialect used in GNU Emacs is known as
Emacs Lisp Emacs Lisp is a Lisp dialect made for Emacs. It is used for implementing most of the editing functionality built into Emacs, the remainder being written in C, as is the Lisp interpreter. Emacs Lisp code is used to modify, extend and customi ...
(Elisp), and was developed expressly to port Emacs to GNU and
Unix Unix (, ; trademarked as UNIX) is a family of multitasking, multi-user computer operating systems that derive from the original AT&T Unix, whose development started in 1969 at the Bell Labs research center by Ken Thompson, Dennis Ritchie, a ...
. The Emacs Lisp layer sits atop a stable core of basic services and platform abstraction written in the C programming language, which enables GNU Emacs to be ported to a wide variety of operating systems and architectures without modifying the implementation semantics of the Lisp system where most of the editor lives. In this Lisp environment, variables and functions can be modified with no need to rebuild or restart Emacs, with even newly redefined versions of core editor features being asynchronously compiled and loaded into the live environment to replace existing definitions. Modern GNU Emacs features both
bytecode Bytecode (also called portable code or p-code) is a form of instruction set designed for efficient execution by a software interpreter. Unlike human-readable source code, bytecodes are compact numeric codes, constants, and references (normal ...
and native code compilation for Emacs Lisp. All configuration is stored in variables, classes, and data structures, and changed by simply updating these live. The use of a Lisp dialect in this case is a key advantage, as Lisp syntax consists of so-called symbolic expressions (or sexprs), which can act as both evaluatable code expressions and as a data serialisation format akin to, but simpler and more general than, well known ones such as
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing data. It defines a set of rules for encoding electronic document, documents in a format that is both human-readable and Machine-r ...
,
JSON JSON (JavaScript Object Notation, pronounced or ) is an open standard file format and electronic data interchange, data interchange format that uses Human-readable medium and data, human-readable text to store and transmit data objects consi ...
, and YAML. In this way there is little difference in practice between customising existing features and writing new ones, both of which are accomplished in the same basic way. This is operatively different from most modern extensible editors, for instance VS Code, in which separate languages are used to implement the interface and features of the editor and to encode its user-defined configuration and options. The goal of Emacs' open design is to transparently expose Emacs' internals to the Emacs user during normal use in the same way that they would be exposed to the Emacs developer working on the git tree, and to collapse as much as possible of the distinction between using Emacs and programming Emacs, while still providing a stable, practical, and responsive editing environment for novice users.


Interactive data

The main text editing
data structure In computer science, a data structure is a data organization and storage format that is usually chosen for Efficiency, efficient Data access, access to data. More precisely, a data structure is a collection of data values, the relationships amo ...
is the '' buffer'', a memory region containing data (usually text) with associated attributes. The most important of these are: * The ''point'': the editing cursor; * The ''mark'': a settable location which, along with the point, enables selection of * The ''region'': a conceptually contiguous collection of text to which editing commands will be applied; * The name and
inode An inode (index node) is a data structure in a Unix-style file system that describes a file-system object such as a file or a directory. Each inode stores the attributes and disk block locations of the object's data. File-system object attribu ...
of the file the buffer is ''visiting'' (if any); * The ''default directory'', where any OS-level commands will be executed from by default; * The buffer's ''mode''s, including a ''major mode'' possibly several ''minor mode''s * The ''buffer encoding'', the method by which Emacs represents buffer data to the user; * and a variety of ''buffer local variable''s and Emacs Lisp state. ''Modes'', in particular, are an important concept in Emacs, providing a mechanism to disaggregate Emacs' functionality into sets of behaviours and keybinds relevant to specific buffers' data. ''Major modes'' provide a general package of functions and commands relevant to a buffer's data and the way users might be interacting with it (e.g. editing source code in a specific language, editing hex, viewing the filesystem, interacting with git, etc.), and ''minor modes'' define subsidiary collections of functionality applicable across many major modes (such as auto-save-mode). Minor modes can be toggled on or off both locally to each buffer as well as globally across all buffers, while major modes can only be toggled per-buffer. Any other data relevant to a buffer but not bundled into a mode can be handled by simply focussing that buffer and live modifying the relevant data directly. Any interaction with the editor (like key presses or clicking a mouse button) is realized by evaluating Emacs Lisp code, typically a ''command'', which is a function explicitly designed for interactive use. Keys can be arbitrarily redefined and commands can also be accessed by name; some commands evaluate arbitrary Emacs Lisp code provided by the user in various ways (e.g. a family of eval- functions, operating on the buffer, region, or individual expression). Even the simplest user inputs (such a printable characters) are effectuated as Emacs Lisp functions, such as the self-insert-command , bound by default to most keyboard keys in a typical text editing buffer, which parameterises itself with the locale-defined character associated with the key used to call it. For example, pressing the key in a buffer that accepts text input evaluates the code , which inserts one copy of the character constant ?f ''at point''. The 1, in this case, is determined by what Emacs terms the ''universal argument'': all Emacs command code accepts a numeric value which, in its simplest usage, indicates repetition of an action, but in more complex cases (where repetition doesn't make sense) can yield other behaviours. These arguments may be supplied via command prefices, such as , or more compactly , which expands to . When no prefix is supplied, the universal argument is 1: every command implicitly runs once, but may be called multiply, or in a different way, when supplied with such a prefix. Such arguments may also be non-positive where it makes sense for them to be so - it is up to the function accepting the argument to determine, according to its own semantics, what a given number means to it. One common usage is for functions to perform actions in reverse simply by checking the sign of the universal argument, such as a sort command which sorts in obverse by default and in reverse when called with a negative argument, using the absolute value of its argument as the sorting key (e.g. -7 sorting in reverse by column index (or delimiter) 7), or undo/redo, which are simply negatives of each other (traversing forward and backward through a recursive history of diffs by some number of steps at a time).


Command language

Because of its relatively large vocabulary of commands, Emacs features a long-established ''command language'', to concisely express the keystrokes necessary to perform an action. This command language recognises the following shift and modifier keys: , , , , , and . Not all of these may be present on an IBM-style keyboard, though they can usually be configured as desired. These are represented in command language as the respective prefices: C-, A-, S-, M-, s-, and H-. Keys whose names are only printable with more than one character are enclosed in angle brackets. Thus, a keyboard shortcut such as (check dependent formulas and calculate all cells in all open workbooks in Excel) would be rendered in Emacs command language as C-A-S-, while an Emacs command like (incremental file search by filename-matching regexp), would be expressed as M-s f C-M-s. Command language is also used to express the actions needed to invoke commands with no assigned shortcut: for example, the command scratch-buffer (which initialises a buffer in memory for temporary text storage and manipulation), when invoked by the user, will be reported back as M-x scra , with Emacs scanning the namespace of contextually available commands to return the shortest sequence of keystrokes which uniquely lexicate it.


Dynamic display

Because Emacs predates modern standard terminology for
graphical user interface A graphical user interface, or GUI, is a form of user interface that allows user (computing), users to human–computer interaction, interact with electronic devices through Graphics, graphical icon (computing), icons and visual indicators such ...
s, it uses somewhat divergent names for familiar interface elements. Buffers, the data that Emacs users interact with, are displayed to the user inside ''windows'', which are tiled portions of the terminal screen or the GUI window, which Emacs refers to as ''frames''; in modern terminology, an Emacs ''frame'' would be a window and an Emacs ''window'' would be a panel or split. Depending on configuration, windows can include their own scroll bars, line numbers, sometimes a 'header line' typically to ease navigation, and a ''mode line'' at the bottom (usually displaying buffer name, the active modes and point position of the buffer among others). The bottom of every frame is used for output messages (then called 'echo area') and text input for commands (then called 'minibuffer'). In general, Emacs display elements (windows, frames, etc.) do not belong to any specific data or process. Buffers are not associated with windows, and multiple windows can be opened onto the same buffer, for example to track different parts of a long text side-by-side without scrolling back and forth, and multiple buffers can share the same text, for example to take advantage of different major modes in a mixed-language file. Similarly, Emacs instances are not associated with particular frames, and multiple frames can be opened displaying a single running Emacs process, e.g. a frame per screen in a multi-monitor setup, or a terminal frame connected via ssh from a remote system and a graphical frame displaying the same Emacs process via the local system's monitor. Just as buffers don't require windows, running Emacs processes do not require any frames, and one common usage pattern is to deploy Emacs as an ''editing server'': running it as a headless daemon and connecting to it via a frame-spawning client. This server can then be made available in any situation where an editor is required, simply by declaring the client program to be the user's EDITOR or VISUAL variable. Such a server continues to run in the background, managing any child processes, accumulating stdin from open pipes, ports, or fifos, performing periodic or pre-programmed actions, and remembering buffer undo history, saved text snippets, command history, and other user state between editing sessions. In this mode of operation, Emacs overlaps the functionality of programs like screen and tmux. Because of its separation of display concerns from editing functionality, Emacs can display roughly similarly on any device more complex than a
dumb terminal A computer terminal is an electronic or electromechanical hardware device that can be used for entering data into, and transcribing data from, a computer or a computing system. Most early computers only had a front panel to input or display ...
, including providing typical graphical WIMP elements on sufficiently featureful text terminals - though graphical frames are the preferred mode of display, providing a strict superset of the features of text terminal frames.


Customizability and extensibility

* User actions can be recorded into macros and replayed to automate complex, repetitive tasks. This is often done on an ad-hoc basis, with each macro discarded after use, although macros can be saved and invoked later. ** Because of the uniformity of Emacs' features' definition in terms of Emacs Lisp, what counts as a "user action" for the purposes of macro-automation is flexible: macros may include, e.g., keypresses, commands, mouse clicks, other macros, and anything that can be effectuated via these. Macros can thus be recursive, and can be defined and invoked inside of macros. * At startup, Emacs executes an Emacs Lisp script named (recent versions also look for , , and , as well as similar variations on . Emacs reads first if it exists, and it can be used to configure or short-circuit core Emacs features before they load, such as the graphical display system or
package manager A package manager or package management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computer in a consistent manner. A package manager deals wi ...
. It will then execute the first version or that it finds, ignoring the rest. This personal customization file can be arbitrarily long and complex, but typical content includes: ** Setting global variables or invoking functions to customize Emacs behaviour, for example ** Key bindings to override standard ones and to add shortcuts for commands that the user finds convenient but don't have a key binding by default. Example: ** Loading, enabling and initializing extensions (Emacs comes with many extensions, but only a few are loaded by default.) ** Configuring ''event hooks'' to run arbitrary code at specific times, for example to automatically recompile source code after saving a buffer () ** Executing arbitrary files, usually to split an overly long configuration file into manageable and homogeneous parts ( and are traditional locations for these personal scripts) * The ''customize'' extension allows the user to set configuration properties such as the color scheme interactively, from within Emacs, in a more user-friendly way than by setting variables in : it offers search, descriptions and help text, multiple choice inputs, reverting to defaults, modification of the running Emacs instance without reloading, and other conveniences similar to the preferences functionality of other programs. The customized values are saved in (or another designated file) automatically. * ''Themes'', affecting the choice of fonts and colours, are defined as Emacs Lisp files and chosen through the customize extension. * ''Modes'', which support editing a range of programming languages (e.g., emacs-lisp-mode, c-mode, java-mode, ESS for R) by changing fonts to highlight the code and keybindings modified (foreword-function vs. forward-page). Other modes include ones that support editing spreadsheets (dismal) and structured text.


Self-documenting

The first Emacs contained a ''help'' library that included documentation for every command, variable and internal function. Because of this, Emacs proponents described the software as ''self-documenting'' in that it presents the user with information on its normal features and its current state. Each function includes a documentation string that is displayed to the user on request, a practice that subsequently spread to programming languages including
Lisp Lisp (historically LISP, an abbreviation of "list processing") is a family of programming languages with a long history and a distinctive, fully parenthesized Polish notation#Explanation, prefix notation. Originally specified in the late 1950s, ...
,
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
,
Perl Perl is a high-level, general-purpose, interpreted, dynamic programming language. Though Perl is not officially an acronym, there are various backronyms in use, including "Practical Extraction and Reporting Language". Perl was developed ...
, and Python. This help system can take users to the actual code for each function, whether from a built-in library or an added third-party library. Emacs also has a built-in
tutorial In education, a tutorial is a method of transferring knowledge and may be used as a part of a learning process. More interactive and specific than a book or a lecture, a tutorial seeks to teach by example and supply the information to complete ...
. Emacs displays instructions for performing simple editing commands and invoking the tutorial when it is launched with no file to edit. The tutorial is by Stuart Cracraft and Richard Stallman.


Culture


Church of Emacs

The ''Church of Emacs'', formed by Richard Stallman, is a parody religion created for Emacs users. While it refers to vi as the ''editor of the beast'' (vi-vi-vi being 6-6-6 in Roman numerals), it does not oppose the use of vi; rather, it calls it
proprietary software Proprietary software is computer software, software that grants its creator, publisher, or other rightsholder or rightsholder partner a legal monopoly by modern copyright and intellectual property law to exclude the recipient from freely sharing t ...
anathema. ("Using a free version of vi is not a sin but a penance.") The Church of Emacs has its own
newsgroup A Usenet newsgroup is a repository usually within the Usenet system for messages posted from users in different locations using the Internet. They are not only discussion groups or conversations, but also a repository to publish articles, start ...
, , that has posts purporting to support this parody religion. Supporters of vi have created an opposing ''Cult of vi''. Stallman has jokingly referred to himself as ''St I  GNU cius'', a saint in the Church of Emacs. This is in reference to
Ignatius of Antioch Ignatius of Antioch (; ; died 108/140), also known as Ignatius Theophorus (), was an early Christian writer and Patriarch of Antioch. While en route to Rome, where he met his Christian martyrs, martyrdom, Ignatius wrote a series of letters. This ...
, an early Church father venerated in Christianity.


Terminology

The word ''emacs'' is sometimes pluralized as ''emacsen'', by phonetic analogy with boxen and VAXen, referring to different varieties of Emacs.


See also

* Comparison of text editors * Conkeror * GNU TeXmacs * List of text editors *
List of Unix commands This is a list of the shell commands of the most recent version of the Portable Operating System Interface (POSIX) IEEE Std 1003.1-2024 which is part of the Single UNIX Specification (SUS). These commands are implemented in many shells on moder ...
*
Integrated development environment An integrated development environment (IDE) is a Application software, software application that provides comprehensive facilities for software development. An IDE normally consists of at least a source-code editor, build automation tools, an ...


References


Bibliography

*
PDF
*
PDF
* * * * * * *


External links

*


Architectural overview
{{GNU 1970s in computing 1976 software Free file comparison tools Free integrated development environments Free software programmed in C Free software programmed in Lisp Free text editors Hex editors Linux integrated development environments Linux text editors MacOS text editors OpenVMS text editors Unix text editors Windows text editors