summaryrefslogtreecommitdiff
path: root/modes
diff options
context:
space:
mode:
authorrandy1burrell <randy1burrell@yahoo.com>2021-01-27 17:53:50 -0500
committerJames N <james@jojojames.com>2021-01-28 23:44:33 -0800
commit7a4f8085f3e1dc9c89b3bf3d1df1105cdaa1a42a (patch)
tree32830b61e270304b8a54bc518cee542164e8170d /modes
parentbd44a32e83f0ad8d08975691a52e9525bfe0ff0a (diff)
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.
Diffstat (limited to 'modes')
-rw-r--r--modes/company/evil-collection-company.el13
1 files 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