Refactor how company-backends are set and stored

Company backends are now built from an alist (+company-backend-alist),
which can be manipulated through set-company-backend!. Backends can now
be set to all children of a parent mode (text-mode, prog-mode, etc),
like so:

  (set-company-backend! :derived 'text-mode 'company-dabbrev)

or only for an exact major-mode:

  (set-company-backend! 'markdown-mode 'company-dabbrev-code)

Backends cascade. So combining the two examples above will cause
company-backends in a markdown-buffer (which is derived from text-mode)
to be (company-dabbrev-code company-dabbrev).
This commit is contained in:
Henrik Lissner 2018-07-29 21:31:58 +02:00
parent 248e9a487f
commit 22aeaec399
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
3 changed files with 107 additions and 48 deletions

View file

@ -15,10 +15,9 @@
company-frontends
'(company-pseudo-tooltip-frontend
company-echo-metadata-frontend)
company-backends
'((:separate company-capf company-yasnippet))
company-transformers '(company-sort-by-occurrence))
:config
(add-hook 'company-mode-hook #'+company|init-backends)
(global-company-mode +1))