Subject: Re: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'

From: Eli Zaretskii <[email-masked]>
Date: Mon, 14 Apr 2025 08:15:35 +0300

> From: Elijah Gabe Pérez <[email-masked]>
> Date: Sun, 13 Apr 2025 22:34:47 -0600
> Cc: [email-masked], Juri Linkov <[email-masked]>, 
> 	Daniel Colascione <[email-masked]>, Daniel Mendler <[email-masked]>
> 
>  >> The code needs to run each time the cursor moves, (is there
>  >> a function/code that do this?) and each time user changes window
>  >> (because cursor color is not buffer-local).
>  >
>  > I understand the general idea, but did you have more detailed ideas
>  > for how to implement that?
> 
>  Maybe in a kind of loop?
>  I'm still thinking.
> 
>  Another idea is to make the cursor color buffer local.
> 
> I got an idea, what about add an advice-add to setq as a kind of variable watcher? setq is the standard for
> changing the value to a  variable, and compared to post-command-hook, it wouldn't run on every function
> calls, ofc the advice will be removed after disabling the minor mode.
> 
> Maybe it sounds hacky and could already been talked about in this thread that I've missed, but there are
> built-in packages in emacs that use advice-add.

If that's what you want, why not use a variable watcher directly?  We
do that in some cases already, see the end of frame.el.