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?

erikstokes
  • 12,686
  • 2
  • 34
  • 56
Leu_Grady
  • 2,420
  • 1
  • 17
  • 27

3 Answers3

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!

Leu_Grady
  • 2,420
  • 1
  • 17
  • 27
  • 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 05 '18 at 13:09
6

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

(delete 'company-dabbrev company-backends)
Ista
  • 1,148
  • 8
  • 12
-2

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

(setq company-dabbrev-other-buffers nil)
itsjeyd
  • 14,586
  • 3
  • 58
  • 87
Pedro
  • 137
  • 3