bug in evil-default-cursor with function value?
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) 'hollow 'box)) (set-cursor-color (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.)
On Wed, Mar 20 2013 (13:39), Óscar Fuentes <[email protected]> wrote:
For setting the color and shape of the cursor I wrote this code:
[14 lines snipped]
The color is correctly updated, but not the shape: apparently it still uses the default shapes (box for normal, bar for insert, etc).
No it does not, problematic are only the insert, replace and operator states. But for that I can confirm. All those states have a `:cursor` spec and that seems to override the default as you found:
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.)
I think a variable that specifies that state-cursors should not override the default cursor would fix it. I don't share your concerns as missing values just mean that it won't be changed. Michael
Michael Markert <[email protected]> writes:
All those states have a `:cursor` spec and that seems to override the default as you found:
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.)
I think a variable that specifies that state-cursors should not override the default cursor would fix it. I don't share your concerns as missing values just mean that it won't be changed.
Instead of adding a new variable right away we should consider what's the current state of affairs. I guess that the original intent of evil-default-cursor was to provide a base and apply further customizations (for the cases they are defined) onto it. IMHO, what is needed is a variable that takes complete responsibility of cursor setting. Such variable would contain a function. Default value would be something like evil-refresh-cursor. Sounds good?
On Wed, Mar 20 2013 (14:53), Óscar Fuentes <[email protected]> wrote:
Michael Markert <[email protected]> writes: [16 lines snipped]
I think a variable that specifies that state-cursors should not override the default cursor would fix it. I don't share your concerns as missing values just mean that it won't be changed.
Instead of adding a new variable right away we should consider what's the current state of affairs. I guess that the original intent of evil-default-cursor was to provide a base and apply further customizations (for the cases they are defined) onto it.
IMHO, what is needed is a variable that takes complete responsibility of cursor setting. Such variable would contain a function. Default value would be something like evil-refresh-cursor.
`evil-default-cursor' would/could be such a function with a variable to ignore state cursors. I don't think it would be helpful to move that to a more complex function like `evil-refresh-cursor'. And then you end up with two such functions. Another approach would be to make the changing of the state cursor variables easier but that would be less dynamic -- maybe someone builds upon `evil-default-cursor' being so dynamic. Michael
participants (2)
-
Michael Markert -
Óscar Fuentes