8

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.

  • 2
    Which language are you working with? – abo-abo Nov 11 '15 at 9:46
  • Have you tried auto-complete? I customize it without problem, the user manual is really comprehensive. – Carlo Rodríguez Nov 11 '15 at 9:54
  • 1
    I suggest you make an actual M-x report-emacs-bug with reproducible recipes. – Stefan Nov 11 '15 at 15:29
10

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.

  • Appreciate it, but I kinda switched off emacs now :p. I still use the keybindings though. – m0meni Jun 13 '16 at 15:44
  • 3
    "(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

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.