fix(company): hook company-abort when +childframe enabled

This commit is contained in:
Anh T Nguyen 2023-03-02 22:05:56 +07:00 committed by Henrik Lissner
parent e1c962cdf9
commit 22097b5a75

View file

@ -46,17 +46,14 @@
:config :config
(when (modulep! :editor evil) (when (modulep! :editor evil)
(add-hook 'company-mode-hook #'evil-normalize-keymaps) (add-hook 'company-mode-hook #'evil-normalize-keymaps)
(unless (modulep! +childframe) (add-hook! 'evil-normal-state-entry-hook
;; Don't persist company popups when switching back to normal mode. (defun +company-abort-h ()
;; `company-box' aborts on mode switch so it doesn't need this. ;; HACK `company-abort' doesn't no-op if company isn't active; causing
(add-hook! 'evil-normal-state-entry-hook ;; unwanted side-effects, like the suppression of messages in the
(defun +company-abort-h () ;; echo-area.
;; HACK `company-abort' doesn't no-op if company isn't active; causing ;; REVIEW Revisit this to refactor; shouldn't be necessary!
;; unwanted side-effects, like the suppression of messages in the (when company-candidates
;; echo-area. (company-abort))))
;; 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 ;; 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 ;; by C-x C-n, will switch from `company-yasnippet' to
;; `company-dabbrev-code'. ;; `company-dabbrev-code'.