I have a running Emacs on my gentoo, with doom configuration (with evil mode disabled). It works great. One issue i want to solve...

Some company-backends - for example like company-files in Lisp files, do not work.

When I run Emacs and try to enter a path to a load function - nothing happens. If I do eval-buffer on the file that I have the company-backends settings - it starts to work. So it seems that that piece of code runs too late.

Here's what i do: On my .doom.d/config.el file I load my custom el file. in that file I do

(after! company (setq company-backend '(company-files company-capf)) )

I also tried to add (setq company-backends '(company-files)) to the config.el file.

None of the above worked.

  • Looks like doom has a function to set the backends (and also a variable to define the default backends used): github.com/hlissner/doom-emacs/blob/…
    – Hubisan
    Commented Jan 13, 2020 at 22:54
  • @Hubisan - you're a genius! that worked perfect! Thanks!! - too bad you answered in comment and not a real answer - i'd set it as accepted.
    – drizzt13
    Commented Jan 15, 2020 at 7:17

1 Answer 1


Doom has its own function set-company-backend! to set the backends:

(defun set-company-backend! (modes &rest backends)
  "Prepends BACKENDS (in order) to `company-backends' in MODES.

MODES should be one symbol or a list of them, representing major or minor modes.
This will overwrite backends for MODES on consecutive uses.

If the car of BACKENDS is nil, unset the backends for MODES.

  (set-company-backend! 'js2-mode
    'company-tide 'company-yasnippet)


You can also change the default backends used. They are defined in +company-backend-alist:

(defvar +company-backend-alist
  '((text-mode company-dabbrev company-yasnippet company-ispell)
    (prog-mode company-capf company-yasnippet)
    (conf-mode company-capf company-dabbrev-code company-yasnippet))
  "An alist matching modes to company backends. The backends for any mode is
built from this.")

Those variables and functions are defined in https://github.com/hlissner/doom-emacs/blob/develop/modules/completion/company/autoload.el.

  • Great, working perfectly. Thanks!
    – drizzt13
    Commented Jan 16, 2020 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.