I find occasionally hard to read the labels from avy or ace-window when they overlap with the cursor (I have cursor-on-non-selected-window set to t). Same issue with ace-window (even more relevant since many times the cursor is sitting at pos 0). Is there a proper way to hide cursors (and visible-marks) temporarily while using avy or ace-window?

A possibility would be to override the faces while using the commands, but I wonder if there is a more proper approach

  • I don't use either library, but the buffer-local variable you may be interested in setting to nil on a temporary basis is cursor-type.
    – lawlist
    Commented Dec 5, 2022 at 21:54

1 Answer 1


This snippet works under the assumption the cursor type is same everywhere. It uses setq-default for buffer-local variables cursor-in-non-selected-windows and cursor-in-non-selected-windows.

;; When the inactive cursor is on one of the avy targets,
;; the overlay and cursor colors mix and the avy sequence gets hard to read.
;; Let's fix this by hiding cursor everywhere.
(defun avy-jump-advice--hide-cursor-temporarily (orig-func &rest args)
  (let ((ct  cursor-type)
        (ctn cursor-in-non-selected-windows))
    (setq-default cursor-in-non-selected-windows nil)
    (setq-default cursor-type nil)
    (apply orig-func args)
    (setq-default cursor-type ct)
    (setq-default cursor-in-non-selected-windows ctn)))
(advice-add 'avy-jump :around #'avy-jump-advice--hide-cursor-temporarily)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.