Emacs with Company Mode - Short Review

Coding Tools



Product Overview: Emacs with Company Mode



Introduction

Emacs, a highly customizable and powerful text editor, can be significantly enhanced with the integration of Company Mode, a modular in-buffer completion framework. Company Mode, which stands for “complete anything,” transforms Emacs into a robust development environment by providing advanced auto-completion capabilities.



What Company Mode Does

Company Mode is designed to assist users in completing text by suggesting candidates based on the context of the typed characters. It leverages a variety of back-ends to retrieve and display completion candidates, making it versatile and adaptable to different programming languages and use cases.



Key Features and Functionality



Installation and Activation

  • Company Mode can be installed via Emacs package archives using the command M-x package-install RET company RET.
  • To activate Company Mode, use the command M-x company-mode, which toggles the mode on and off. For persistent activation across sessions, add (global-company-mode) to your Emacs configuration file.


Auto-Completion

  • Company Mode auto-starts suggesting completion candidates after a few characters are typed, based on configurable settings such as company-minimum-prefix-length and company-idle-delay.
  • Users can manually initiate completion using the command M-x company-complete.


Navigation and Selection

  • Completion candidates can be navigated using key bindings C-n and C-p to select the next or previous candidate, respectively. Other key bindings include company-complete-selection to insert the selected candidate, company-complete-common to insert the common part of all candidates, and company-abort to cancel the completion process.


Customization

  • Company Mode is highly customizable. Users can configure various aspects such as the delay before auto-completion starts, the minimum prefix length required to trigger completion, and the major modes in which Company Mode is enabled using options like company-idle-delay, company-minimum-prefix-length, and company-global-modes.
  • The customization interface can be accessed via M-x customize-group RET company, allowing users to review and adjust all available options.


Back-Ends and Integration

  • Company Mode supports a wide range of back-ends, including Elisp, Clang, Semantic, Eclim, Ropemacs, Ispell, CMake, BBDB, Yasnippet, dabbrev, etags, gtags, and files. This allows it to work seamlessly with various major modes and programming languages.
  • The CAPF back-end provides a bridge to the standard completion-at-point-functions facility, ensuring compatibility with any major mode that defines a proper completion function.


Additional Features

  • Users can display documentation for the selected candidate using company-show-doc-buffer and view the definition of the selected candidate with company-show-location.
  • Key bindings can be customized to perform specific actions, such as assigning the TAB key to complete the common part of candidates or cycle through them.


Conclusion

Emacs with Company Mode offers a powerful and flexible text completion framework that enhances the editing experience by providing intelligent and context-aware auto-completion. Its extensive customization options, support for multiple back-ends, and intuitive navigation make it an indispensable tool for developers and users seeking to streamline their workflow within the Emacs environment.

Scroll to Top