all repos — nixfiles @ b809de14280337dc6cdcf696b66469540cfab325

System and user configuration, managed by nix and home-manager

Emacs: Install and configure tern package
Alan Pearce alan@alanpearce.co.uk
Wed, 06 May 2015 09:28:04 +0200
commit

b809de14280337dc6cdcf696b66469540cfab325

parent

e364a183f35cfe88d07b169f5cef08e4fbcfc0fb

1 files changed, 11 insertions(+), 1 deletions(-)

jump to
M tag-emacs/emacs.d/init.eltag-emacs/emacs.d/init.el
@@ -240,7 +240,7 @@ :diminish "Cmpl"   :bind (("C-<tab>" . company-complete))
   :init (progn
           (add-hook 'prog-mode-hook #'company-mode)
-          (setq company-backends '((php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-ropemacs company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords)
+          (setq company-backends '(company-tern (php-extras-company company-elisp company-bbdb company-nxml company-css company-eclim company-semantic company-clang company-xcode company-ropemacs company-cmake company-capf company-gtags company-dabbrev-code company-etags company-keywords)
                                    company-oddmuse company-files company-dabbrev)
                 company-idle-delay .3
                 company-begin-commands '(self-insert-command)
@@ -1391,6 +1391,16 @@ (auto-indent-mode -1))             (add-hook 'js2-mode-hook #'ap/javascript-setup)
             (setq js2-basic-offset 4
                   js2-global-externs '("$"))))
+
+(req-package tern
+  :config (progn
+            (setq tern-command (list (executable-find "tern")))
+            (defun ap/enable-tern ()
+              (tern-mode 1))
+            (add-hook 'js2-mode-hook #'ap/enable-tern)))
+
+(req-package tern-company
+  :require (tern company))
 
 (add-to-list 'auto-mode-alist '("composer\\.lock" . js-mode))