2

So I just switched from autocomplete to company-mode. I followed the steps outlined on http://company-mode.github.io

and added these lines to my .emacs

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)

but even then I get no autocomplete suggestions when I type any sort of string.

To debug this I ran a vanilla emacs init file with essentially only company mode and nothing else:

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)

After this I opened a simple test file to test company mode

monkey = 3
donkey= 4
elephant= 3

def fox():
    return

I tried typing the string "mon" in the editor waiting for some sort of autocomplete popup and nothing appeared. I even trying typing M-x company-complete

but it did nothing

Is there something really trivial I'm missing?

  • 1
    Too vague to encourage a useful answer, IMO. There is nothing here to go on. The question risks being closed because it is unclear. Provide a step-by-step recipe, starting from emacs -Q (no init file), to reproduce your problem. Describe the symptoms clearly, and describe what you expected to happen instead. – Drew Jun 17 '15 at 1:24
  • 1
    Also, try M-x company-diag. – Dmitry Jun 17 '15 at 7:25
  • And mention the versions of Emacs and company. – Dmitry Jun 17 '15 at 9:30
1

From what I understood reading your question, you're trying to use company to complete python code, right?

Well, python completion does not work out of the box with company. You need to install a python backend. The options I tried so far are:

  • Jedi mode. This is the most popular and is implemented in many other editors as well
  • Anaconda mode. This one is not so complete as Jedi, AFAIK, but it works great and it's simpler to install.

Both packages are available in melpa, and don't forget to enable their modes after installing, otherwise the completion won't work. For more information check anaconda or jedi github pages.

  • "python completion does not work out of the box with company" It should work well enough, either through company-capf when there's a Python shell running, or using company-dabbrev-code. Of course, you might be hitting some bug with the former, when using some older Emacs version. – Dmitry Jun 18 '15 at 20:02
  • I believe anaconda-mode is actually a wrapper around jedi, so it's at least as complete as jedi is. – PythonNut Aug 17 '15 at 19:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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