From 893c9e22492fc2c4a42a433d2cedd97040604965 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Thu, 23 May 2019 07:57:01 -0700 Subject: Enable company-posframe as late as possible ‘company-posframe’ checks to see if posframe can actually work. Unfortunately it thinks it can’t work when the first frame is created. So instead only enable ‘company-posframe-mode’ when company starts trying to complete something. --- oni-company.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'oni-company.el') diff --git a/oni-company.el b/oni-company.el index 74aa826..2153f46 100644 --- a/oni-company.el +++ b/oni-company.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190523070353 +;; Version: 20190523075637 ;; Package-Requires: (company company-posframe diminish) ;; This program is free software; you can redistribute it and/or modify @@ -31,6 +31,13 @@ (require 'company-posframe) (require 'diminish) +(defun oni-company--enable-posframe (_) + "Enable posframe and remove this function from the hook." + (when (display-graphic-p) + (company-posframe-mode) + (remove-hook 'company-completion-started-hook + 'oni-company--enable-posframe))) + (setq company-dabbrev-ignore-case nil) (setq company-idle-delay 0.2) (setq company-tooltip-align-annotations t) @@ -40,10 +47,10 @@ company-echo-metadata-frontend company-preview-frontend)) -(company-posframe-mode) +(add-hook 'company-completion-started-hook 'oni-company--enable-posframe) (diminish 'company-mode) -(diminish 'company-posrame-mode) +(diminish 'company-posframe-mode) ;;;###autoload(with-eval-after-load 'company (require 'oni-company)) -- cgit v1.2.3-54-g00ecf