Skip to content

Commit da52a62

Browse files
author
pRot0ta1p
authored
Fix two minore issue with cursor updating. (#327)
* meow--set-cursor-color: call set-cursor-color only when cursor color actually changed, because set-cursor-color will trigger a redisplay. * meow--update-cursor: only update cursor with current window buffer, this solve the issue that flymake or flycheck cause cursor color change during typing.
1 parent 41c6e12 commit da52a62

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

meow-util.el

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@
106106

107107
(defun meow--set-cursor-color (face)
108108
"Set cursor color by face."
109-
(set-cursor-color (meow--read-cursor-face-color face)))
109+
(let ((color (meow--read-cursor-face-color face)))
110+
(unless (equal (frame-parameter nil 'cursor-color) color)
111+
(set-cursor-color color))))
110112

111113
(defun meow--update-cursor-default ()
112114
"Set default cursor type and color"
@@ -146,10 +148,11 @@
146148
This uses the variable meow-update-cursor-functions-alist, finds the first
147149
item in which the car evaluates to true, and runs the cdr. The last item's car
148150
in the list will always evaluate to true."
149-
(thread-last meow-update-cursor-functions-alist
150-
(cl-remove-if-not (lambda (el) (funcall (car el))))
151-
(cdar)
152-
(funcall)))
151+
(with-current-buffer (window-buffer)
152+
(thread-last meow-update-cursor-functions-alist
153+
(cl-remove-if-not (lambda (el) (funcall (car el))))
154+
(cdar)
155+
(funcall))))
153156

154157
(defun meow--get-state-name (state)
155158
"Get the name of the current state.

0 commit comments

Comments
 (0)