From 22097b5a755a5b1d661e362a8441b61e37f777c9 Mon Sep 17 00:00:00 2001 From: Anh T Nguyen Date: Thu, 2 Mar 2023 22:05:56 +0700 Subject: [PATCH] fix(company): hook company-abort when +childframe enabled --- modules/completion/company/config.el | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/modules/completion/company/config.el b/modules/completion/company/config.el index 46216a79d..15beb0092 100644 --- a/modules/completion/company/config.el +++ b/modules/completion/company/config.el @@ -46,17 +46,14 @@ :config (when (modulep! :editor evil) (add-hook 'company-mode-hook #'evil-normalize-keymaps) - (unless (modulep! +childframe) - ;; Don't persist company popups when switching back to normal mode. - ;; `company-box' aborts on mode switch so it doesn't need this. - (add-hook! 'evil-normal-state-entry-hook - (defun +company-abort-h () - ;; HACK `company-abort' doesn't no-op if company isn't active; causing - ;; unwanted side-effects, like the suppression of messages in the - ;; echo-area. - ;; REVIEW Revisit this to refactor; shouldn't be necessary! - (when company-candidates - (company-abort))))) + (add-hook! 'evil-normal-state-entry-hook + (defun +company-abort-h () + ;; HACK `company-abort' doesn't no-op if company isn't active; causing + ;; unwanted side-effects, like the suppression of messages in the + ;; echo-area. + ;; REVIEW Revisit this to refactor; shouldn't be necessary! + (when company-candidates + (company-abort)))) ;; Allow users to switch between backends on the fly. E.g. C-x C-s followed ;; by C-x C-n, will switch from `company-yasnippet' to ;; `company-dabbrev-code'.