In my Emacs configuration for JavaScript/ JS2-mode, specifically .js buffer in node:

(1) company-tern and ELDoc are NOT working properly.

For eg. when I type 'console.l', 'log' does not pop up, rather 'let' alone pops up

(2) When opening the buffer, a message pop ups, "There is no ELDoc support in this buffer"

My key Emacs configurations, for this:


(use-package company
  :ensure t
  :config (global-company-mode t)
    (setq company-idle-delay 0)
    (setq company-minimum-prefix-length 1)
    (setq company-etags-everywhere '(html-mode web-mode js-mode js2-mode nxml-mode))


(use-package tern
  :ensure t
    (autoload 'tern-mode "tern.el" nil t)
    (add-hook 'js-mode-hook (lambda () (tern-mode t)))
    (add-hook 'js2-mode-hook (lambda () (tern-mode t)))))


(use-package company-tern   
  :ensure t   
    (with-eval-after-load 'company 'tern    
      '(add-to-list 'company-backends 'company-tern)))


(global-eldoc-mode 1)
(add-hook 'js2-mode-hook 'eldoc-mode)
(add-hook 'js-mode-hook 'eldoc-mode)

Can some one help me to sort out what I am doing wrong?

1 Answer 1



When eldoc-mode is enabled it checks whether eldoc-documentation-function is defined in current buffer. If not - it messages "There is no ElDoc support in this buffer" and exits.
Neither of these modes supports ElDoc, i.e. doesn't implement eldoc-documentation-function.


When new characters are typed, company after each command checks for a possibility to complete it.
If company triggers a completion process, it loops over each member of company-backends list:

(add-to-list 'company-backends 'company-tern)

So completion depends on which company backend first is able to return some completion.
BTW, add-to-list is quoted in your setup.

That company looping over all backends can be avoided:

M-x company-tern calls only tern backend at point.(try it first)

Or, instead of adding company-tern to company-backends list, it can be assigned to a variable:
company-backend (notice there's no "s" in the end). This variable is provided by company for "manual override" cases, it means - use only one this backend.
It's a buffer local variable, so it should be assigned inside javascript mode hooks:

(setq company-backend company-tern)
  • 1
    Thanks Alexandr Karbivnichiy: (1) I agree with your answer that there is no ELDoc support for company-tern. (2) Re: company, I had to quote add-to-list to get pop up of 'console' when typing c. And, (setq company-backend company-term) idea did not work for me.
    – tom_kp
    Commented Jan 17, 2019 at 16:35
  • So inside of a Javascript buffer, what is the value of ‘company-backends’?
    – InHarmsWay
    Commented Feb 14, 2019 at 11:30

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.