Lately, I'm working on how to configure the best grouped company-backends for different major modes, although having been using company-mode for over one year (already got a configuration long time ago), but recently realized it was not working as I expected, and started looking for the official documentation on how to configure it, but found nothing useful.
For example in emacs-lisp-mode, words in buffers, yasnippet, elisp(company-capf), etc., sorted in this order in the droplist
in c/c++-mode, words in buffers, yasnippet, the name(variable, function, struct etc.), etc,.
in org-mode, words in buffers, yasnippet, etc,
in latex-mode, words in buffers, yasnippet, latex-environment, etc.
If I insert and "/", it should use company-files as the primary backend.
In above examples, there will be a default company-backends for all the major modes when company-mode is enabled, there will be an extra configuration for a specific minor mode to work with the default.
For example:
(setq company-backends
'(
(
company-files
company-dabbrev
company-keywords
company-capf
company-yasnippet
)
(company-abbrev company-dabbrev)
))
(add-hook 'emacs-lisp-mode-hook
(lambda ()
(set (make-local-variable 'company-backends)
(append company-backends
'((
company-elisp
))))))
But I cannot make the company-elisp work, there always are such problems for other major modes, the two backends won't work well for a specific major mode. there always are one or more backends is not working.
No official documentation or examples.
How to create grouped company-backends list to work with an extra one for specific major mode?