Emacs Lisp
By the GNU Project
Emacs Lisp is a dialect of the Lisp programming language used to configure and extend the GNU Emacs text editor, letting users and package authors write everything from simple keybinding customizations to complete new editing modes and…
Definition
Emacs Lisp is a dialect of the Lisp programming language used to configure and extend the GNU Emacs text editor, letting users and package authors write everything from simple keybinding customizations to complete new editing modes and applications that run inside Emacs. Nearly all of Emacs's own functionality, beyond a small C core, is implemented in Emacs Lisp itself, making the editor almost entirely self-hosted and modifiable at runtime.
Overview
Emacs Lisp exists because Emacs was designed from the outset not as a fixed text editor but as a platform whose behavior is defined by a programming language running inside it, addressing the desire of early Emacs developers to make every part of the editor inspectable, customizable, and extensible while it is running, without requiring recompilation of a C core. This design goal shaped Emacs Lisp into a dialect specifically suited to describing editor behavior: buffers, text, keybindings, and windows are all first-class values the language manipulates directly. Mechanically, Emacs Lisp is a Lisp-1 dialect, meaning functions and variables share a single namespace unlike Scheme's more separated approach, and it uses dynamic scoping by default for many variables, a choice that predates and differs from the lexical scoping common in most modern Lisps, though lexical binding was added later as an option. Code is represented as data using the classic Lisp s-expression syntax, so programs can generate and manipulate other programs, and the interpreter (with an optional native or byte compiler) executes this code directly against the live editor state, meaning a user can redefine a function while Emacs is running and see the change take effect immediately. Among Lisp dialects, Emacs Lisp is closest in spirit to Common Lisp and Scheme but is deliberately narrower in scope, built specifically around Emacs's internal data structures like buffers, markers, and overlays rather than as a general-purpose language, and it lacks some modern conveniences those languages have accumulated, though newer libraries have added things like structured data types and lexical closures over time. Compared to configuration formats used by other editors, such as JSON or Lua in some code editors, Emacs Lisp gives users a full programming language for configuration, at the cost of a steeper learning curve. In practice, Emacs Lisp is used to write the thousands of packages available through repositories like MELPA, ranging from small utilities to complete development environments, email clients, and project management systems built entirely on top of the Emacs platform, and ordinary users routinely write short Emacs Lisp snippets in their personal configuration files to customize keybindings and behavior. Emacs Lisp's dynamic scoping legacy and its idiosyncratic standard library, shaped by decades of incremental growth rather than a unified redesign, can make it harder to learn than more modern, consistently designed languages, and its tight coupling to Emacs's internals means code written in it has little use outside the editor. Users who want Lisp-style programming without this coupling typically choose Scheme, Common Lisp, or Clojure instead.
Key Features
- Lisp-1 dialect using classic s-expression syntax for code and data
- Dynamic scoping by default with optional lexical binding support
- Direct manipulation of Emacs buffers, windows, and keybindings
- Live redefinition of functions while the editor is running
- Implements nearly all of Emacs's own functionality above a small C core
- Byte compilation and native compilation for improved performance
- Large package ecosystem distributed through repositories like MELPA
- First-class support for text properties, markers, and overlays