From 7a4f8085f3e1dc9c89b3bf3d1df1105cdaa1a42a Mon Sep 17 00:00:00 2001 From: randy1burrell Date: Wed, 27 Jan 2021 17:53:50 -0500 Subject: [PATCH] fix: Stop inhibiting company popup when not in evil-mode Evil-collection package inhibits company from showing completions when evil-mode is switched off. This commit will fix it and only activate evil-collection advice for company-mode when in evil-mode. If applied, this commit will: * Allow `company-mode` to show completions when not in `evil-mode`. * Only activate `evil-collection` advice for `company-mode` when in `evil-mode`. * Fixes #451. --- modes/company/evil-collection-company.el | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modes/company/evil-collection-company.el b/modes/company/evil-collection-company.el index d5c7a12..3eb8838 100644 --- a/modes/company/evil-collection-company.el +++ b/modes/company/evil-collection-company.el @@ -62,9 +62,13 @@ be set through custom or before evil-collection loads." (defun evil-collection-company-supported-p (command &rest _) "Return non-nil if `evil-state' is in supported states." (cond - ((eq command 'prefix) - (memq evil-state evil-collection-company-supported-states)) - (t t))) + ((eq command 'prefix) + (memq evil-state evil-collection-company-supported-states)) + (t t))) + +(defun evil-collection-company-popup () + "When `evil-mode' is active, make `company-mode' not show popup if not in supported state." + (advice-add 'company-call-backend :before-while 'evil-collection-company-supported-p)) ;;;###autoload (defun evil-collection-company-setup () @@ -98,7 +102,8 @@ be set through custom or before evil-collection loads." (company-tng-configure-default))) ;; Make `company-mode' not show popup when not in supported state - (advice-add 'company-call-backend :before-while 'evil-collection-company-supported-p)) + (add-hook 'evil-mode-hook 'evil-collection-company-popup)) + (provide 'evil-collection-company) ;;; evil-collection-company.el ends here