casouri / vundo

Visualize the undo tree.
413 stars 20 forks source link

cursor hiding doesn't work with evil-mode #49

Open Dickby opened 2 years ago

Dickby commented 2 years ago

evil-mode prevents that cursor hiding in the vundo-undo-tree buffer somehow.

Dickby commented 2 years ago

I found that this is a well known problem with evil-mode. Other packages are trying to work around that issue: https://github.com/alexluigit/dirvish/issues/43 https://github.com/jaypei/emacs-neotree/issues/233

but really it should be resolved in evil itself. here is the open issue https://github.com/emacs-evil/evil/issues/592 .

The hack mentioned in that issue works for vundo too: (setq-local evil-normal-state-cursor '(bar . 0)) maybe this could be added to vundo until that evil cursor problem is solved (if it ever will be).

Thanks

geza-herman commented 3 months ago

I solved this problem by adding ("^ \\*vundo tree\\*" . nil) to evil-buffer-regexps, so evil will completely ignore vundo's buffer.

DeesonGao commented 1 month ago

I solved this problem by adding ("^ \\*vundo tree\\*" . nil) to evil-buffer-regexps, so evil will completely ignore vundo's buffer.

This hack avoids the problem, but also misses the evil feature (such as leader key, or evil key binding).

The hack mentioned in that issue works for vundo too: (setq-local evil-normal-state-cursor '(bar . 0)) maybe this could be added to vundo until that evil cursor problem is solved (if it ever will be).

I found this hack performs differently in Emacs Mac Port and Emacs Plus. In Emacs Mac Port, this hack work as expect, while in Emacs Plus, still a narrow bar lefts (It seems like Emacs Plus treat 'zero' width bar as a very narrow bar, not just nothing).

Actually, (setq-local cursor-type nil) means don't display a cursor, BUT somehow evil refreshes this variable, and don't supports just (setq-local evil-normal-state-cursor nil).

Fortunately, we can also set evil-normal-state-cursor as a "zero-argument function", So I try this hack:

(setq-local evil-normal-state-cursor '(lambda () (setq-local cursor-type nil)))

and now, it works perfectlly in both Emacs Mac Port and Emacs Plus! :-)