bug in evil-default-cursor with function value?

Óscar Fuentes ofv at wanadoo.es
Wed Mar 20 13:39:12 CET 2013

For setting the color and shape of the cursor I wrote this code:

(setq evil-default-cursor #'ofv/evil-cursor)
(defun ofv/evil-cursor ()
  "Change cursor color according to evil-state."
  (setq cursor-type (if (eq evil-state 'visual)
   (case evil-state
     ('insert "dark orange")
     ('emacs "sienna")
     ('visual "white")
     (otherwise "green"))))

The color is correctly updated, but not the shape: apparently it still
uses the default shapes (box for normal, bar for insert, etc).

Looking at evil-refresh-cursor I see that it ends with

        (evil-set-cursor default)
        (evil-set-cursor cursor)

The second call to evil-set-cursor seems to override the first one,
where the value obtained from evil-default-cursor is used.

I see no easy fix for that, because `default' might contain shape and
color, or only one of those, or nil (because evil-default-cursor
contains a function that does all the job.)

More information about the implementations-list mailing list