From 69ea5c2020c77ad31a2234732684dbf17ee318e3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 28 May 2021 14:06:16 -0400 Subject: [PATCH] editor/evil: simplify cursor color change logic Fixes race conditions where the cached cursor's color doesn't match the loaded theme's. --- modules/editor/evil/config.el | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/modules/editor/evil/config.el b/modules/editor/evil/config.el index f5d195fb6..071a0deee 100644 --- a/modules/editor/evil/config.el +++ b/modules/editor/evil/config.el @@ -83,20 +83,11 @@ directives. By default, this only recognizes C directives.") ("^\\*Command Line" :size 8))))) ;; Change the cursor color in emacs state. We do it this roundabout way - ;; instead of changing `evil-default-cursor' (or `evil-emacs-state-cursor') so - ;; it won't interfere with users who have changed these variables. - (defvar +evil--default-cursor-color "#ffffff") - (defvar +evil--emacs-cursor-color "#ff9999") - - (add-hook! 'doom-load-theme-hook - (defun +evil-update-cursor-color-h () - (setq +evil--default-cursor-color (face-background 'cursor) - +evil--emacs-cursor-color (face-foreground 'warning)))) - + ;; to ensure changes in theme doesn't break these colors. (defun +evil-default-cursor-fn () - (evil-set-cursor-color +evil--default-cursor-color)) + (evil-set-cursor-color (face-background 'cursor))) (defun +evil-emacs-cursor-fn () - (evil-set-cursor-color +evil--emacs-cursor-color)) + (evil-set-cursor-color (face-foreground 'warning))) (setq-hook! 'after-change-major-mode-hook evil-shift-width tab-width)