Fix #1335: company keymaps losing precedence to evil

This commit is contained in:
Henrik Lissner 2020-10-16 00:28:25 -04:00
parent b6fe731153
commit 2e476de446
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -56,7 +56,18 @@
(add-hook 'after-change-major-mode-hook #'+company-init-backends-h 'append)
(when (featurep! +tng)
(company-tng-mode +1)))
(company-tng-mode +1))
;; NOTE Fix #1335: ensure `company-emulation-alist' is the first item of
;; `emulation-mode-map-alists', thus higher priority than keymaps of
;; evil-mode. We raise the priority of company-mode keymaps
;; unconditionally even when completion is not activated. This should not
;; cause problems, because when completion is activated, the value of
;; `company-emulation-alist' is ((t . company-my-keymap)), when
;; completion is not activated, the value is ((t . nil)).
(add-hook! 'evil-local-mode-hook
(when (memq 'company-emulation-alist emulation-mode-map-alists)
(company-ensure-emulation-alist))))
;;