I am getting very inconsistent behavior with js-mode and js2-mode hooks and I am not sure why.

I have three "hooks":

(add-hook 'js2-mode-hook (lambda () (setq mode-name "Zono-mode"))) 
(add-hook 'js2-mode-hook (lambda () (tern-mode t)))  

For some reason these do work on my Mac but do not work on my Fedora Linux system, and I am wondering if anyone can offer a reason as to why this would happen.

To further the strangeness, the very similar (add-hook 'js-mode-hook (lambda () (ac-js2-mode t))) does work on both machines.

Any advice would be much appreciated.

All of the libaries have been installed, and, when opening a file that ends in .js I do enter js2-mode (it just seems none of the hooks are run) The only possible difference I see is on my Fedora machine Emacs is 24.5.1 and on my Mac it is Emacs 24.4.1. but I looked and this should make no difference (in fact the newer versions should help make sure hooks are run)

  • To get the obvious question out of the way -- have you installed the js2-mode library on your Fedora machine? And if so, is it the same version which is working on your other machine?
    – phils
    Commented Oct 7, 2015 at 3:32
  • sorry @phils I just updated the question. It is the same version as my other machine, everything except the emacs version number is the same.
    – Startec
    Commented Oct 7, 2015 at 3:43

1 Answer 1


This was called because ac-js2 mode was being called and raising an error. Commenting it out fixed the problem.


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.