I use gtags, jedi and dabbrev for python. Sometimes the duplicates get a bit annoying. I read that using :with should sort out the duplicates problem. However, it does not... Is there a better solution that this? :

(add-hook 'python-mode-hook
          (lambda ()
            (set (make-local-variable 'company-backends)
                 '((company-gtags :with company-jedi company-dabbrev-code)))))

In the Company documentation, Company Backends section there is a line that reads: "‘duplicates’: If non-nil, company will take care of removing duplicates from the list.". I just can't figure out how to enable it.

  • I use anaconda-mode and using company-anaconda along with company-dabbrev-code created a lot of duplicates for me as well. Deleting company-dabbrev-code fixed the problem for me. anaconda backend does the job of dabbrev-code as well. I'm not sure jedi though Oct 22, 2016 at 12:01
  • I like the dabbrev's functionality of scanning other buffers as well. Does anaconda do that too? Oct 22, 2016 at 17:18
  • I dont think anaconda-mode does that. But, if you import said file, you will get company completions for that imported file, otherwise not. Oct 22, 2016 at 17:31

1 Answer 1


Depending on what causes the duplicates, you might be talking about https://github.com/company-mode/company-mode/issues/413, https://github.com/company-mode/company-mode/issues/285 (which are actual bugs/design problems, though they only should come up with certain customizations), or about having the same symbols show up twice coming from different backends, once with annotation and once without (for example).

We count such completions as different, which sometimes is a good choice (for certain kinds of backend combinations), and sometimes not so much. Perhaps we could do better by default (detailed proposals welcome), but until then, this answer is as good workaround as any: Delete duplicates from company popups

  • Yes I used the last link and then github.com/company-mode/company-mode/issues/… (Frustrating as so much code to make company useable - whilst other editors/IDE just work - also I had copied much of jojojames' work here but not all)
    – mmmmmm
    Jan 6, 2022 at 7:26
  • It is usable out of the box. Note that we are discussing custom configurations here; it shouldn't be a problem that to make a custom setup work to your preference you'd need to tweak it a little.
    – Dmitry
    Jan 6, 2022 at 22:58
  • I have a solution in mind for #413, but if your problem is #285, it's more of a design choice. Doesn't the answer to the question I linked here work for you? It's one extra line of configuration.
    – Dmitry
    Jan 6, 2022 at 22:59
  • I also wanted yasnippet in the popup and so had used parts of jojojames's code - now I use the whole lot. (The yasnippets are separate but the dabbrev and capf completions are now not duplicated I can live with that)
    – mmmmmm
    Jan 7, 2022 at 7:10
  • On attempting the short code it seems OK after editing to use :with etc - The issue I think I had was that I need to understand a lot of the details of company before I got a working version - ie your example use :separate which is the opposite of what I want which is :with jojojames's code even though much more complex can just be cut and paste
    – mmmmmm
    Jan 7, 2022 at 15:54

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.