GNU Emacs


GNU Emacs is a free and open source text editor. It was created by GNU Project founder Richard Stallman. In common with other varieties of Emacs, GNU Emacs is extensible using a Turing complete programming language. GNU Emacs has been called "the most powerful text editor available today". With proper support from the underlying system, GNU Emacs is able to display files in multiple character sets, and has been able to simultaneously display most human languages since at least 1999. Throughout its history, GNU Emacs has been a central component of the GNU project, and a flagship of the free software movement. GNU Emacs is sometimes abbreviated as GNUMACS, especially to differentiate it from other EMACS variants. The tag line for GNU Emacs is "the extensible self-documenting text editor".

History

In 1976, Stallman wrote the first Emacs, and in 1984, began work on GNU Emacs, to produce a free software 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, 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' 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 have overseen maintenance since 2008. 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.

Licensing

The terms of the GNU General Public License 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. Bug fixes and minor code contributions of fewer than 10 lines 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. Richard Stallman described this incident as "a very bad mistake", which was promptly fixed. Naturally, the FSF didn't 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 other text editors and allows the user to insert characters with the corresponding keys and to move the editing point with the 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 an external program, such as ispell for spell-checking or GNU Compiler Collection for program compilation, parsing the program's output, and displaying the result in GNU Emacs. Emacs also supports "inferior processes"—long-lived processes that interact with an Emacs buffer. This is used to implement shell-mode, running a Unix shell as inferior process, as well as read–eval–print loop modes for various programming languages. Emacs' support for external processes makes it an attractive environment for interactive programming along the lines of Interlisp or Smalltalk.
Users who prefer IBM Common User Access-style keys can use cua-mode, 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 present status and request information—the functions that would typically be performed by dialog boxes in most GUIs. 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 to both an Emacs Lisp program and to the user interface. The user can create new buffers and dismiss unwanted ones, and many buffers can exist at the same time. There is no upper limit on the number of buffers Emacs allows, other than hardware memory limits. Advanced users may amass hundreds of open buffers of various types relating to their current work. 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 minubuffer, and GNU Emacs provides a *Messages* 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 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, 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 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 follow-mode, a minor mode that chains windows to display non-overlapping portions of a buffer. Using follow-mode, 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

GNU Emacs can display or edit a variety of different types of text and adapts its behavior by entering add-on modes called "major modes". There are major modes for many different purposes including editing ordinary text files, the source code of many markup and programming languages, as well as displaying web pages, directory listings and other system info. Each major mode involves an Emacs Lisp program that extends the editor to behave more conveniently for the specified type of text. Major modes typically provide some or all of the following common features:
The use of "minor modes" enables further customization. A GNU Emacs editing buffer can use only one major mode at a time, but multiple minor modes can operate simultaneously. These may operate directly on documents, as in the way the major mode for the C programming language defines a separate minor mode for each of its popular indent styles, or they may alter the editing environment. Examples of the latter include a mode that adds the ability to undo changes to the window configuration and one that performs on-the-fly syntax checking. There is also a minor mode that allows multiple major modes to be used in a single file, for convenience when editing a document in which multiple programming languages are embedded.

"Batch mode"

GNU Emacs supports the capability to use it as an interpreter for the Emacs Lisp language without displaying the text editor user interface. In batch mode, user configuration is not loaded and the terminal interrupt characters C-c and C-z will have their usual effect of exiting the program or suspending execution instead of invoking Emacs keybindings. GNU Emacs has command line options to specify either a file to load and execute, or an Emacs Lisp function may be passed in from the command line. Emacs will start up, execute the passed-in file or function, print the results, then exit. The shebang line #!/usr/bin/emacs --script allows the creation of standalone scripts in Emacs Lisp.
Batch mode is not an Emacs mode per se, but describes an alternate execution mode for the Emacs program.

Manuals

Apart from the built-in documentation, GNU Emacs has an unusually long and detailed manual. An electronic copy of the GNU Emacs Manual, written by Richard Stallman, is bundled with GNU Emacs and can be viewed with the built-in info browser. Two additional manuals, the Emacs Lisp Reference Manual by Bil Lewis, Richard Stallman, and Dan Laliberte and An Introduction to Programming in Emacs Lisp by Robert Chassell, are included. All three manuals are also published in book form by the Free Software Foundation. The XEmacs manual is similar to the GNU Emacs Manual, from which it forked at the same time that the XEmacs software forked from GNU Emacs.

Internationalization

GNU Emacs has support for many alphabets, scripts, writing systems, and cultural conventions and provides spell-checking for many languages by calling external programs such as ispell. Version 24 added support for bidirectional text and left-to-right and right-to-left writing direction for languages such as Arabic, Persian and Hebrew.
Many character encoding systems, including UTF-8, are supported. GNU Emacs uses UTF-8 for its encoding as of GNU 23, while prior versions used their own encoding internally and performed conversion upon load and save. The internal encoding used by XEmacs is similar to that of GNU Emacs but differs in details.
The GNU Emacs user interface originated in English and, with the exception of the beginners' tutorial, has not been translated into any other language.
A subsystem called Emacspeak enables visually impaired and blind users to control the editor through audio feedback.

Extensibility

The behavior of GNU Emacs can be modified and extended almost without limit by incorporating Emacs Lisp programs that define new commands, new buffer modes, new keymaps, add command-line options, and so on. Many extensions providing user-facing functionality define a major mode ; others define only commands or minor modes, or provide functions that enhance another extension.
Many extensions are bundled with the GNU Emacs installation; others used to be downloaded as loose files but there has been a development of managed packages and package download sites since version 24, with a built-in package manager to download, install, and keep them up to date. The list of available packages is itself displayed in an Emacs buffer set to package-mode major mode.
Notable examples include:
GNU Emacs often ran noticeably slower than rival text editors on the systems in which it was first implemented, because the loading and interpreting of its Lisp-based code incurs a performance overhead. Modern computers are powerful enough to run GNU Emacs without slowdowns, but versions prior to 19.29 couldn't edit files larger than 8 MB. The file size limit was raised in successive versions, and 32 bit versions after GNU Emacs 23.2 can edit files up to 512 MB in size. Emacs compiled on a 64-bit machine can handle much larger buffers.

Platforms

GNU Emacs is one of the most-ported non-trivial computer programs and runs on a wide variety of operating systems, including DOS, Windows and OpenVMS. Support for some "obsolete platforms was removed in Emacs 23.1", such as VMS and most commercial Unix variants. It is available for most Unix-like operating systems, such as Linux, the various BSDs, Solaris, AIX, HP-UX and macOS, and is often included with their system installation packages. Native ports of GNU Emacs exist for Android and Nokia's Maemo.
GNU Emacs runs both on text terminals and in graphical user interface environments. On Unix-like operating systems, GNU Emacs can use the X Window System to produce its GUI either directly using Athena widgets or by using a "widget toolkit" such as Motif, LessTif, or GTK+. GNU Emacs can also use the graphics systems native to macOS and Windows to provide menubars, toolbars, scrollbars and context menus conforming more closely to each platform's look and feel.

Forks

XEmacs

Lucid Emacs, based on an early version of GNU Emacs 19, was developed beginning in 1991 by Jamie Zawinski and others at Lucid Inc. One of the best-known forks in free software 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. After Lucid filed for bankruptcy, Lucid Emacs was renamed XEmacs and remains the second most popular variety of Emacs, after GNU Emacs. XEmacs development has slowed, with the most recent stable version 21.4.22 released in January 2009, while GNU Emacs has implemented many formerly XEmacs-only features. This has led some users to proclaim XEmacs' death.

Other forks of GNU Emacs

Other forks, less known than XEmacs, include:
Changes in each Emacs release are listed in a NEWS file distributed with Emacs. Changes brought about by downgrading to the previous release are listed in an "Antinews" file, often with some snarky commentary on why this might be desirable
VersionRelease dateSignificant changes
26.3August 28, 2019New GPG key for GNU ELPA package signature checking.
26.2April 12, 2019Emacs modules can now be built outside of the Emacs tree source. Compliance with Unicode version 11.0.
26.1May 28, 2018Limited form of concurrency with Lisp threads. Support for optional display of line numbers in the buffer. Emacs now uses double buffering to reduce flicker on the X Window System. Flymake has been completely redesigned. TRAMP has a new connection method for Google Drive. New single-line horizontal scrolling mode. A systemd user unit file is provided. Support for 24-bit colors on capable text terminals.
25.1September 17, 2016Support for loading shared/dynamic libraries. Validation of TLS/SSL certificates. New minor mode 'electric-quote-mode' for using curved quotes. Character folding support in isearch.el. Support for embedding native widgets inside Emacs buffers. New and improved facilities for inserting Unicode characters.
24.5April 10, 2015Mainly a bugfix release.
24.4October 20, 2014Support for ACLs and digital signatures of Emacs Lisp packages. Improved fullscreen and multi-monitor support. Support for saving and restoring the state of frames and windows. Improved menu support on text terminals. Another built-in web browser. A new rectangular mark mode. File notification support.
24.3March 10, 2013Generalized variables are now in core Emacs Lisp, an update for the Common Lisp emulation library, and a new major mode for Python.
24.2August 27, 2012Bugfix release
24.1June 10, 2012Emacs Lisp Package Archive, support for native color themes, optional GTK+3, support for bi-directional input, support for lexical scoping in emacs lisp
23.4January 29, 2012Fixes a security flaw.
23.3March 10, 2011Improved functionality for using Emacs with version control systems.
23.2May 8, 2010New tools for using Emacs as an IDE, including navigation across a project and automatic Makefile generation. New major mode for editing JavaScript source. In GUIs, the cursor is hidden while the user types.
23.1July 29, 2009Support for anti-aliased fonts on X through Xft, better Unicode support, Doc-view mode and new packages for viewing PDF and PostScript files, connection to processes through D-Bus, connection to the GNU Privacy Guard, nXML mode for editing XML documents, Ruby mode for editing Ruby programs, and more. Use of the Carbon GUI libraries on Mac OS X was replaced by use of the more modern Cocoa GUI libraries.
22.3September 5, 2008GTK+ toolkit support, enhanced mouse support, a new keyboard macro system, improved Unicode support, and drag-and-drop operation on X. Many new modes and packages including a graphical user interface to GDB, Python mode, the mathematical tool Calc, and the remote file editing system Tramp.
22.2March 26, 2008New support for the Bazaar, Mercurial, Monotone, and Git version control systems. New major modes for editing CSS, Vera, Verilog, and BibTeX style files. Improved scrolling support in Image mode.
22.1June 2, 2007Support for the GTK+ graphical toolkit, support for drag-and-drop on X, support for the Mac OS X Carbon UI, org-mode version 4.67d included
21.1October 20, 2001Support for displaying colors and some other attributes on terminals, built-in horizontal scrolling, sound support, wheel mouse support, improved menu-bar layout, support for images, toolbar, and tooltips, Unicode support
20.1September 17, 1997Multi-lingual support
19.34August 22, 1996bug fix release with no user-visible changes
19.31May 25, 1996Emacs opens X11 frames by default, scroll bars on Windows 95 and NT, subprocesses on Windows 95, to recover multiple files after a crash, some features removed to comply with the US Communications Decency Act
19.30November 24, 1995Multiple frame support on MS Windows, menu bar available on text terminals, package to emulate common Windows and Macintosh keybindings.
19.29June 19, 1995
19.28November 1, 1994First official v19 release. Support for multiple frames using the X Windowing System; VC, a new interface for version control systems, font-lock mode, hexl mode for hexadecimal editing.
19.7May 22, 1993
18.59October 31, 1992
18.53February 23, 1989
18.52August 17, 1988 a library for adding some "distract the NSA" keywords to every message you send.
18.24October 2, 1986Server mode,, Emacs can open TCP connections, to open Emacs in console mode on xterms.
17.36December 20, 1985Backup file version numbers
16.56July 15, 1985First Emacs 16 release. Emacs-lisp-mode distinct from lisp-mode, remove all code from Gosling Emacs due to copyright issues
15.10April 11, 1985
13.8?March 20, 1985First release. However, the VAXSIG VAX85b DECUS tape has version 13.8 with file dates of June 19, 1985 with RCS files dated March 31, 1985. It's a badly damaged copy. Version 13.9 is referenced in the news file, so 13.8 may have been the first release since there are no other 13.x releases named.