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 project and a flagship project of the free software movement.
The program's tagline is "the extensible self-documenting text editor." Most functionality in GNU Emacs is implemented in user-accessible Emacs Lisp, allowing deep extensibility directly by users and through community-contributed packages. Its built-in features include a file browser and editor (Dired), an advanced calculator (Calc), an email client and news reader (Gnus), a Language Server Protocol integration, and the productivity system Org-mode. A large community of users have contributed extensions such as the Git interface Magit, the Vim emulation layer Evil, several search frameworks, the window manager EXWM, and tools for working with a wide range of programming languages.
History
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, and in 1984, Richard Stallman began work on GNU Emacs, to produce a free software replacement 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 then-nascent GNU Project. GNU Emacs is written in C and provides Emacs Lisp, 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 major version skipped from "1" to "13". A new third version number was added to represent changes made by user sites. In the current numbering scheme, a number with two components signifies a release version, with development versions having three components.
GNU Emacs was later ported to the Unix operating system. It 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's email subsystem in his 1986 cracking spree, in which he gained superuser access to Unix computers.
Although users commonly submitted patches and Elisp code to the net.emacs newsgroup, participation in GNU Emacs development was relatively restricted 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 today uses the Git] DVCS.
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 oversaw maintenance from 2008.; see also "Stallman on handing over GNU Emacs, its future and the importance of nomenclature" On September 21, 2015, Monnier announced that he would be stepping down as maintainer effective with the feature freeze of Emacs 25. Longtime contributor John Wiegley was announced as the new maintainer on November 5, 2015. Wiegley was joined by Eli Zaretskii in July, 2016, and Lars Ingebrigtsen in September, 2020. Wiegley stepped down in 2018, and Ingebrigtsen concluded his term with the release of Emacs 29.1, leaving Zaretskii as lead maintainer. Stefan Kangas was appointed as co-maintainer in 2023, and Andrea Corallo joined Zaretskii and Kangas in 2024.
Licensing The terms of the GNU General Public License (GPL) state that the Emacs source code, including both the C and Emacs Lisp components, are freely available for examination, modification, and redistribution.
Older versions of the GNU Emacs documentation appeared under an ad-hoc license that required the inclusion of certain text in any modified copy. In the GNU Emacs user's manual, for example, this included instructions for obtaining GNU Emacs and Richard Stallman's essay The GNU Manifesto. The XEmacs manuals, which were inherited from older GNU Emacs manuals when the fork occurred, have the same license. Newer versions of the documentation use the GNU Free Documentation License with "invariant sections" that require the inclusion of the same documents and that the manuals proclaim themselves as GNU Manuals.
For GNU Emacs, like many other GNU packages, it remains policy to accept significant code contributions only if the copyright holder executes a suitable disclaimer or assignment of their copyright interest to the Free Software Foundation (FSF.) Small contributions of fewer than 10 lines of code are exempt. This policy is in place so that the FSF can defend the software in court if its copyleft license is violated.
In 2011, it was noticed that GNU Emacs had been accidentally releasing some binaries without corresponding source code for two years, in opposition to the intended spirit of the GPL.License revoked: Applying Section 4 of the GPL and the lessons of Best Buy to Google’s Android by Edward J. Naughton (Aug 8, 2011) Richard Stallman described this incident as "a very bad mistake," which was promptly fixed. The FSF did not sue any downstream redistributors who unknowingly violated the GPL by distributing these binaries.
Using GNU Emacs
Commands In its normal editing mode, GNU Emacs behaves like common text editors by allowing the user to type text with the keyboard and move the editing point with arrow keys. Escape key sequences or pressing the control key and/or the meta key, alt key or super keys in conjunction with a regular key produces modified keystrokes that invoke functions from the Emacs Lisp environment. Commands such as save-buffer and save-buffers-kill-emacs combine multiple modified keystrokes.
Some GNU Emacs commands work by invoking external programs, such as ispell for spell-checking and the GNU Compiler Collection (GCC) for program compilation. Emacs also supports "inferior processes," long-lived child processes that interact with the editor. This is used to implement , running a Unix shell as inferior process, as well as read–eval–print loop (REPL) modes for various programming languages. Emacs' support for external processes makes it suitable for interactive programming along the lines of Interlisp or Smalltalk.
Users who prefer the widely used IBM Common User Access keyboard shortcut layout can use , a package that originally was a third-party add-on but has been included in GNU Emacs since version 22.
Minibuffer Emacs uses the "minibuffer," normally the bottommost line, to display messages and request information, functions that are often performed by dialog boxes in GUI editors. The minibuffer holds information such as text to target in a search or the name of a file to read or save. When applicable, command-line completion is available using the tab and space keys.
File management and display Emacs keeps text in data structures known as buffers. Buffers may or may not be displayed onscreen, and all buffer features are accessible by both Emacs Lisp programs and the user interface. The user can create new buffers and dismiss unwanted ones, and many buffers can exist at the same time, limited only by available memory. Emacs can be configured to save the list of open buffers on exit, and reopen this list when it is restarted.
Some buffers contain text loaded from text files, which the user can edit and save back to permanent storage. These buffers are said to be "visiting" files. Buffers also serve to display other data, such as the output of Emacs commands, dired directory listings, documentation strings displayed by the "help" library and notification messages that in other editors would be displayed in a dialog box. Some of these notifications are displayed briefly in the minibuffer, and GNU Emacs provides a buffer that keeps a history of the most recent notifications of this type. When the minibuffer is used for output from Emacs, it is called the "echo area". Longer notifications are displayed in buffers of their own. The maximum length of messages that will be displayed in the minibuffer is, of course, configurable.
Buffers can also serve as input and output areas for an external process such as a shell or REPL. Buffers which Emacs creates on its own are typically named with asterisks on each end, to distinguish from user buffers. The list of open buffers is itself displayed in this type of buffer.
Most Emacs key sequences remain functional in any buffer. For example, the standard Ctrl-s isearch function can be used to search filenames in dired buffers, and the file list can be saved to a text file just as any other buffer. Dired buffers can be switched to a writable mode, in which filenames and attributes can be edited textually; when the buffer is saved, the changes are written to the filesystem. This allows multiple files to be renamed using the search and replace features of Emacs. When so equipped, Emacs displays image files in buffers. Emacs is binary safe and 8-bit clean.
Emacs can split the editing area into separate non-overlapping sections called "windows," a feature that has been available since 1975, predating the graphical user interface in common use. In Emacs terminology, "windows" are similar to what other systems call "frames" or "panes" a rectangular portion of the program's display that can be updated and interacted with independently. Each Emacs window has a status bar called the "mode line" displayed by default at the bottom edge of the window. Emacs windows are available both in text-terminal and graphical modes and allow more than one buffer, or several parts of a buffer, to be displayed at once. Common applications are to display a dired buffer along with the contents of files in the current directory (there are special modes to make the file buffer follow the file highlighted in dired), to display the source code of a program in one window while another displays a shell buffer with the results of compiling the program, to run a debugger along with a shell buffer running the program, to work on code while displaying a man page or other documentation (possibly loaded over the World Wide Web using one of Emacs' built-in web browsers) or simply to display multiple files for editing at once such as a header along with its implementation file for C-based languages. In addition, there is , a minor mode that chains windows to display non-overlapping portions of a buffer. Using , a single file can be displayed in multiple side-by-side windows that update appropriately when scrolled. In addition, Emacs supports "narrowing" a buffer to display only a portion of a file, with top/bottom of buffer navigation functionality and buffer size calculations reflecting only the selected range.
Emacs windows are tiled and cannot appear "above" or "below" their companions. Emacs can launch multiple "frames", which are displayed as individual windows in a graphical environment. On a text terminal, multiple frames are displayed stacked filling the entire terminal, and can be switched using the standard Emacs commands.
Major modes