I switched from sublime text to emacs a while back, and while I feel emacs is much nicer, its autocompletion is really lacking in responsiveness. I went and customized company so that it would try to complete after two characters had been typed and so the delay was only 0.1s, but it doesn't show up half the time and when it does, it's really not useful. Has anyone else had success in getting company to be as responsive as sublime/visual studio/eclipse? Any other IDE really.
Asked
Active
Viewed 9,916 times
12
-
2Which language are you working with? – abo-abo Nov 11 '15 at 09:46
-
Have you tried [auto-complete](https://github.com/auto-complete/auto-complete)? I customize it without problem, the user manual is really comprehensive. – Carlo Espino Nov 11 '15 at 09:54
-
1I suggest you make an actual `M-x report-emacs-bug` with reproducible recipes. – Stefan Nov 11 '15 at 15:29
1 Answers
14
I had also a bad experience with company at the beginning, but in my setup I just put these lines.
(setq company-dabbrev-downcase 0)
(setq company-idle-delay 0)
The first variable is used to skip the downcase that company does to the variables I autocomplete, the second one I think you already have.
(defun tab-indent-or-complete ()
(interactive)
(if (minibufferp)
(minibuffer-complete)
(if (or (not yas-minor-mode)
(null (do-yas-expand)))
(if (check-expansion)
(company-complete-common)
(indent-for-tab-command)))))
(global-set-key [backtab] 'tab-indent-or-complete)
Also these lines are useful to trigger the completion pressing the key you want.

Scott Weldon
- 2,695
- 1
- 17
- 31

user3347359
- 327
- 2
- 7
-
Appreciate it, but I kinda switched off emacs now :p. I still use the keybindings though. – m0meni Jun 13 '16 at 15:44
-
5"(setq company-idle-delay 0)" Don't do that, you're wasting a lot of CPU clocks this way. – Dmitry Jun 13 '16 at 16:02
-
I get "Symbol’s value as variable is void: do-yas-expand" when using your `tab-indent-or-complete` function. – SergiyKolesnikov Aug 24 '18 at 16:29
-
-
If you're polling backends right after every keypress, whenever you don't get back responses fast enough, that background processing simply goes to waste. – Dmitry Sep 02 '20 at 13:46