Function: evil-refresh-cursor

evil-refresh-cursor is a byte-compiled function defined in evil-common.el.

Signature

(evil-refresh-cursor &optional STATE BUFFER)

Documentation

Refresh the cursor for STATE in BUFFER.

BUFFER defaults to the current buffer. If STATE is nil the cursor type is either evil-force-cursor or the current state.

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-common.el
(defun evil-refresh-cursor (&optional state buffer)
  "Refresh the cursor for STATE in BUFFER.
BUFFER defaults to the current buffer.  If STATE is nil the
cursor type is either `evil-force-cursor' or the current state."
  (defvar evil-local-mode)
  (when evil-local-mode
    (let* ((state (or state evil-force-cursor evil-state 'normal))
           (default (or evil-default-cursor t))
           (cursor (evil-state-property state :cursor t))
           (color (or (and (stringp cursor) cursor)
                      (and (listp cursor) (evil-member-if #'stringp cursor))
                      (frame-parameter nil 'cursor-color))))
      (with-current-buffer (or buffer (current-buffer))
        ;; if both STATE and `evil-default-cursor'
        ;; specify a color, don't set it twice
        (evil-set-cursor (if (and color (listp default))
                             (cl-remove-if #'stringp default)
                           default))
        (evil-set-cursor cursor)))))