Skip to content

enzuru/company-spell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 

Repository files navigation

company-spell

GNU Emacs MELPA

A dropdown selection in Emacs with word suggestions

If you are happy with company-ispell, this package is not for you, and you are encouraged to stick with company-ispell.

company-spell is a hackable minimalist framework for spellchecking.

company-spell directly uses your spellcheck program with no questions asked, and is compatible with ispell, aspell, and hunspell. Unlike company-ispell, this works outside of the default Emacs ispell machinery.

There are three variables you can modify to adjust how in buffer spellchecking works. This minimalist approach that keeps less machinery between you and your spellchecker, and allows you to cultivate your in buffer spellchecking with a different approach than spellchecking elsewhere.

Due to this minimalist approach, multilingual support is probably not very good yet, as it currently does not track which language you are requesting spellchecking for.

I have not discovered any notable performance issues with this approach, and in fact, I have anecdotally found it to be faster than company-ispell (no promises though!). aspell is the default because I find that it returns the best results.

It will automatically run on any buffer that has a major mode derived from text-mode, which includes almost all modes meant for human writing.

Instructions

Preparation

Ensure that:

  • A terminal spellchecker is installed (aspell, hunspell, ispell, etc)
  • You have setup access to MELPA
  • Company is installed

Installation

package-install

M-x package-install company-spell
(push 'company-spell company-backends)

use-package

(use-package company-spell
  :config (push 'company-spell company-backends)
  :ensure t)

Configuration

company-spell-command

Optionally, set a spellchecker that isn't the default value of aspell:

(setf company-spell-command "hunspell")
;; or
(setf company-spell-command "ispell")

company-spell-args

You can further customize your results by setting custom args (only -a is enabled by default). For instance, search via "soundslike":

(setf company-spell-args "-a soundslike")

company-spell-function

You might want to setup your own function. This is a simple function that calls your spellcheck command with your arguments, and turns it into a list for Company.

(setf company-spell-function #'my-custom-function)

Using with Corfu and Cape

I've started using Corfu and Cape these days, which use completion-at-point. Thankfully, this package is easy to adapt to completion-at-point. With Cape installed, just write a hook like this for various text editing modes like markdown-mode:

(setq-local completion-at-point-functions
              (mapcar #'cape-company-to-capf (list #'company-spell)))

License

Licensed under the GPLv3; copyright is assigned to my eponymous charity enzu.ru

About

A hackable minimalist framework for spellchecking

Topics

Resources

License

Stars

Watchers

Forks