Overview

Company is a modular text completion framework for GNU Emacs.

In other words, it is a package for retrieving, manipulating, and displaying text completion candidates. It aims to assist developers, writers, and scientists during code and text writing.


Terminology

Completion is an act of intelligently guessing possible variants of words based on already typed characters. To complete a word means to insert a correctly guessed variant into the buffer.

Consequently, the candidates are the aforementioned guessed variants of words. Each of the candidates has the potential to be chosen for successful completion. And each of the candidates contains the initially typed characters: either only at the beginning (so-called prefix matches), or also inside of a candidate (non-prefix matches). Which matching method is used, depends on the current backend (see Structure). company-capf is an example of a backend that supports a number of particular non-prefix matching algorithms which are configurable through the user option completion-styles, which see. For illustrations on how Company visualizes the matches, see Frontends.

The package’s name ‘Company’ is based on the combination of the two words: ‘Complete’ and ‘Anything’. These words reflect the package’s commitment to handling completion candidates and its extensible nature allowing it to cover a wide range of usage scenarios.


Structure

The Company is easily extensible because its significant building blocks are pluggable modules: backends (see Backends) and frontends (see Frontends).

The backends are responsible for retrieving completion candidates; which are then displayed by the frontends. For an easy and quick initial setup, Company is supplied with the preconfigured sets of the backends and frontends. The default behavior of the modules can be adjusted for particular needs, and preferences. It is also typical to utilize backends from a variety of third-party libraries, developed to be pluggable with Company.

But Company consists not only of the backends and frontends.

A core of the package plays the role of a controller, connecting the modules, making them work together; and exposing configurations and commands for the user to operate with. For more details, Customization and Commands.

Also, Company is bundled with an alternative workflow configuration company-tng — defining company-tng-frontend, company-tng-mode, and company-tng-map — that allows performing completion with just TAB. To enable this configuration, add the following line to the Emacs initialization file (see (emacs)Init File):

(add-hook 'after-init-hook 'company-tng-mode)