From 427691d5cb19183050e132615cd1b895ec25547a Mon Sep 17 00:00:00 2001 From: rekado Date: Fri, 25 Nov 2016 11:10:36 +0100 Subject: Add workaround for company-mode/fci-mode interaction --- init.org | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/init.org b/init.org index 6d93360..dcfcaa6 100644 --- a/init.org +++ b/init.org @@ -883,9 +883,28 @@ This is even more stuff to be done after initialising packages. I still need to (require 'fill-column-indicator) (setq fci-rule-use-dashes t) +(setq fci-rule-color "#cccccc") (setq fci-dash-pattern 0.3) (add-hook 'prog-mode-hook 'fci-mode) +;; This is a workaround to display the company-mode completion popup +;; when fci-mode is enabled. It was taken from here: +;; https://github.com/company-mode/company-mode/issues/180#issuecomment-55047120 +(defvar-local company-fci-mode-on-p nil) + +(defun company-turn-off-fci (&rest ignore) + (when (boundp 'fci-mode) + (setq company-fci-mode-on-p fci-mode) + (when fci-mode (fci-mode -1)))) + +(defun company-maybe-turn-on-fci (&rest ignore) + (when company-fci-mode-on-p (fci-mode 1))) + +(add-hook 'company-completion-started-hook 'company-turn-off-fci) +(add-hook 'company-completion-finished-hook 'company-maybe-turn-on-fci) +(add-hook 'company-completion-cancelled-hook 'company-maybe-turn-on-fci) + + ;; keep the cursor centered to avoid sudden scroll jumps (require 'centered-cursor-mode) -- cgit v1.2.3