Skip to content

Instantly share code, notes, and snippets.

@jdtsmith
Created September 15, 2023 00:55
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Emacs: change cursor color during active repeat-mode commands
(add-hook 'post-command-hook
(defalias 'my/repeat-change-cursor ; change cursor to bar during repeat
(let (repeat-p ccol)
(lambda ()
(unless (eq repeat-p repeat-in-progress)
(if repeat-in-progress ; turning on
(setq ccol (face-background 'cursor)))
(setq repeat-p repeat-in-progress)
(set-cursor-color
(if repeat-in-progress
(face-foreground 'error)
ccol))))))
90)
@jdtsmith
Copy link
Author

jdtsmith commented Sep 15, 2023

After reading u/karthink's great post on simplified home-spun structural editing UIs, I've been playing with repeat-mode. It's trivial to configure a repeat map with a bunch of disparate commands all joined together by some entry binding(s).

The problem, as mentioned in the article, is that you can't tell when repeat mode is active. You just have to remember, unless you notice the message way down in the minibuffer. This contrasts with something like lispy, where you have visual confirmation at point that it's active (i.e. whether point is on a () boundary).

So I whipped this simple fix up: turn the cursor error-red while repeat mode is active. Working well so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment