11

In org-mode, when I type some numbers, company always pops up the number completion like:

20
20001 -----------1
200111 ----------2

These numbers come from my org-mode files.

I would like to turn off company number completion. How can I do this?

3 Answers 3

10

This can be solved by modifying company-transformers with the following code:

(push (apply-partially #'cl-remove-if
                      (lambda (c)
                        (or (string-match-p "[^\x00-\x7F]+" c)
                            (string-match-p "[0-9]+" c)
                            (if (equal major-mode "org")
                                (>= (length c) 15)))))
             company-transformers)

With this code:

  1. remove those non-ANSII candidates.
  2. remove any completion containing numbers.
  3. remove any candidate which is longer than 15 in org-mode.

All kinds of things can be customized.

Hope this helps!

1
  • Although this answer is good, I think sharing emacs snippets it's a lot easier if they just do one thing, and specifically the one thing asked for. I could probably remove all the code I don't need, but as someone who's not proficient in and doesn't care that much for elisp sharing a cleaner method recudes the complexity of my .emacs greatly
    – rien333
    May 5, 2018 at 13:09
6

This is probably coming from the dabbrev back end. You can remove it like this:

(delete 'company-dabbrev company-backends)
-2

You can set company-dabbrev-other-buffers to nil, so company only searches in the active buffer:

(setq company-dabbrev-other-buffers nil)

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.