Emacs (pronounced /’iːmæks/) is a class of feature-rich text editors, usually characterized by their extensibility. Emacs has, perhaps, more editing commands than other editors, numbering over 1,000 commands. It also allows the user to combine these commands into macros to automate work.

Development began in the mid-70s and continues actively. Emacs text editors are most popular with technically proficient computer users and computer programmers. The most popular version of Emacs is ‘GNU Emacs’, a part of the GNU project, which is commonly referred to simply as “Emacs”.

The GNU Emacs manual describes it as “the extensible, customizable, self-documenting, real-time display editor.” It is also the most ported of the implementations of Emacs. As of 2010, the latest stable release of GNU Emacs is version 23.2.

Aside from GNU Emacs, another version of Emacs in common use, XEmacs, forked from GNU Emacs in 1991. XEmacs has remained mostly compatible and continues to use the same extension language, Emacs Lisp, as GNU Emacs. Large parts of GNU Emacs and XEmacs are written in Emacs Lisp, so the extensibility of Emacs’ features is deep.

The original EMACS consisted of a set of Editor MACroS for the TECO editor. It was written in 1976 by Richard Stallman, initially together with Guy L. Steele, Jr..1) 2) 3) It was inspired by the ideas of TECMAC and TMACS, a pair of TECO-macro editors written by Steele, Dave Moon, Richard Greenblatt, Charles Frankston, and others.4)

Editing modes

Emacs adapts its behavior to the types of text it edits by entering add-on modes called “major modes”. Defined major modes exist for ordinary text files, for source code of many programming languages, for HTML documents, for TeX and Latex documents, and for many other types of text. Each major mode involves an Emacs Lisp program that extends the editor to behave more conveniently for the particular type of text it covers. Typical major modes will provide some or all of the following common features:

Syntax highlighting (called “font lock” in Emacs): using different fonts or colors to display keywords, comments, and so forth. Automatic indentation: maintaining consistent formatting within a file. “Electric” features, i.e. the automatic insertion of elements such as spaces, newlines, and parentheses which the structure of the document requires. Special editing commands: for example, major modes for programming languages usually define commands to jump to the beginning and the end of a function, while major modes for markup languages such as XML provide commands to validate documents or to insert closing tags.

Programmers can add extra customized features by using “minor modes”. While an Emacs editing buffer can use only one major mode at a time, multiple minor modes can operate simultaneously. These may affect documents directly. For example, the major mode for the C programming language defines a different minor mode for each of the popular indent styles. Or minor modes may affect the editing environment instead. For example, “Winner mode” adds the ability to undo changes to the window configuration, while “MMM-mode” adds the ability to use more than one major mode in a single file, as required in common cases such as editing an HTML document with embedded CSS and JavaScript.

The SLIME major mode extends Emacs into a development environment for Common Lisp. With SLIME the Emacs editor communicates with a (possibly remote) Common Lisp system over a special communication protocol and provides tools like a Read-Eval-Print-Loop, a data inspector and a debugger.

List of useful editing modes

  • Mediawiki-mode - major-mode for wiki-syntax
  • org-mode - major-mode for organizing your life (aka basically the only software you will ever need)

Useful stuff to be added in ones .emacs

Here is a list of some of the (in my opinion) smart stuff that I have written and added to my .emacs file. I’ll be adding more stuff here all the time so stay tuned. Also check out my technical blog where I post lots of useful Emacs information.

Tips and tricks

TeX as input

I have never payed attention to the input-method in Emacs before (since I don’t write strange non-Latin languages). However I found out today that I should have. I came across an really great feature:

By setting M-x set-input-method TeX one can while typing type any TeX/LaTeX symbol and it automatically gets converted to UTF-8.

Thus if you type for example \copyright Emacs automatically inserts ©

1) Bernard S. Greenberg: Multics Emacs: The History, Design and Implementation
2) GNU Emacs FAQ
3) Jamie Zawinski: Emacs Timeline
4) A history of Emacs

Last modified: 22.09.2010