From 94aad9cdb43e8fc1fe944e7f9b9cdb3553269925 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 15 Mar 2016 01:16:54 +0100 Subject: [PATCH] Add Company mode --- emacs/.emacs.d/Cask | 1 + emacs/.emacs.d/init.el | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/emacs/.emacs.d/Cask b/emacs/.emacs.d/Cask index 0803a11..b0801c3 100644 --- a/emacs/.emacs.d/Cask +++ b/emacs/.emacs.d/Cask @@ -15,6 +15,7 @@ (depends-on "circe") (depends-on "clojure-mode") (depends-on "coffee-mode") +(depends-on "company") (depends-on "corral") (depends-on "csharp-mode") (depends-on "css-eldoc") diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 3832785..e2ed37b 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -190,6 +190,13 @@ MODE1 is enabled and vice-versa." (with-eval-after-load 'cc-mode (define-key c-mode-map (kbd "") 'compile)) +(stante-after company + (setq company-frontends + '(company-pseudo-tooltip-unless-just-one-frontend + company-echo-metadata-frontend + company-preview-frontend)) + (setq company-idle-delay 0.2)) + (stante-after compile (setq compilation-scroll-output t)) @@ -654,6 +661,14 @@ MODE1 is enabled and vice-versa." (oni:add-hooks 'text-mode-hook #'auto-fill-mode #'flyspell-mode 'oni:make-readable) +;; Turn off FCI when company completion starts and turn it on again +;; when it finishes or is cancelled. This is to work around a +;; long-standing incompatibility between company (as well as +;; auto-complete) and fill-column-indicator. +(add-hook 'company-completion-started-hook (lambda (&rest _) (fci-mode -1))) +(add-hook 'company-completion-cancelled-hook (lambda (&rest _) (fci-mode 1))) +(add-hook 'company-completion-finished-hook (lambda (&rest _) (fci-mode 1))) + ;; Load my theme (if (daemonp) (add-hook 'after-make-frame-functions 'oni:set-theme-graphically) @@ -753,7 +768,8 @@ MODE1 is enabled and vice-versa." (desktop-registry-auto-register) (yas-global-mode) (projectile-global-mode) - (hes-mode)) + (hes-mode) + (global-company-mode)) (with-eval-after-load 'ruby (global-rinari-mode))