Emacs with Company Mode - Short Review

Developer 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 text completion framework. Company Mode transforms Emacs into a robust development environment by providing intelligent and configurable auto-completion capabilities.



What Company Mode Does

Company Mode is designed to retrieve, manipulate, and display text completion candidates within Emacs. It automates the process of suggesting possible completions as you type, making coding and text editing more efficient and streamlined.



Key Features and Functionality



Installation and Activation

To use Company Mode, you need to install the package via Emacs’s package manager by executing M-x package-install RET company RET. Once installed, you can activate Company Mode using the command M-x company-mode, which toggles the mode on and off. To enable it globally for all future sessions, add (global-company-mode) to your Emacs configuration file.



Auto-Completion

Company Mode auto-starts suggesting completion candidates based on the characters you type. You can configure the behavior using options such as company-minimum-prefix-length and company-idle-delay. For example, you can set company-minimum-prefix-length to a lower number than the default 3 to start showing candidates sooner, and adjust company-idle-delay to control how quickly Company reacts to your input.



Manual Completion Initiation

If auto-completion is not triggered automatically, you can initiate it manually using the command M-x company-complete.



Navigation and Selection

Company Mode provides key bindings to navigate through completion candidates:

  • C-n to select the next candidate
  • C-p to select the previous candidate
  • Commands to insert the selected candidate, the common part of all candidates, or to cancel the completion process.


Customization

Company Mode is highly customizable:

  • You can specify in which major modes Company Mode should be enabled using company-global-modes.
  • Configure the auto-start behavior with company-idle-delay and company-minimum-prefix-length.
  • Set up custom key bindings for various Company commands, such as company-show-doc-buffer to display documentation for the selected candidate or company-show-location to show the definition of the selected candidate.


Backend Support

Company Mode supports multiple backends, which are functions that provide completions. This allows integration with various programming languages and tools, such as PHP with company-ac-php-backend or Yasnippet for snippet completions.



Integration with Other Tools

Company Mode can be integrated with other Emacs packages and modes, such as Yasnippet, ElDoc, and language-specific modes like c-mode, sgml-mode, and php-mode, enhancing its functionality across different programming environments.



Conclusion

Emacs with Company Mode offers a powerful and customizable auto-completion solution, making it an indispensable tool for developers and writers. Its ability to integrate with various backends, customize behavior, and provide extensive key bindings makes it a versatile and efficient addition to the Emacs ecosystem.

Scroll to Top