From ec1a9aa30c27c02b92b6c433cdb86773ae55734e Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 17 Mar 2016 00:39:42 +0100 Subject: [PATCH] Fix company in non-fci buffers --- emacs/.emacs.d/init.el | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index e2ed37b..a2e6e4d 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -665,9 +665,22 @@ MODE1 is enabled and vice-versa." ;; 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))) +(defvar-local oni:company-fci-enabled-p nil) +(add-hook 'company-completion-started-hook + (lambda (&rest _) + (when fci-mode + (setq-local oni:company-fci-enabled-p t) + (fci-mode -1)))) +(add-hook 'company-completion-cancelled-hook + (lambda (&rest _) + (when oni:company-fci-enabled-p + (fci-mode 1) + (setq-local oni:company-fci-enabled-p nil)))) +(add-hook 'company-completion-finished-hook + (lambda (&rest _) + (when oni:company-fci-enabled-p + (fci-mode 1) + (setq-local oni:company-fci-enabled-p nil)))) ;; Load my theme (if (daemonp)