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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 28 Mar 2025 10:17:51 +0300

> Date: Thu, 27 Mar 2025 16:41:39 -0400
> From: Daniel Colascione <[email-masked]>
> CC: [email-masked], [email-masked], [email-masked]
> 
> >> Regarding Emacs sluggishness, the `cursor-indicators-mode' is an
> >> optional mode. If it increases sluggishness unnacceptably (which it
> >> won't), users can turn it off.
> >
> >Experience shows that many users turn on a lot of features which rely
> >on post-command-hook, and then complain that Emacs is slow to respond.
> >Telling them to turn off features they like doesn't really work.
> 
> Nor does telling external package authors not to use post-command-hook.

Well, I could at least try ;-)  Who knows, some of them might even
listen...

> I think there are two worthwhile approaches: 1) time the entries in post-command-hook and alert users about slow ones, and 2) provide a "do something when X, Y, or Z changes" API that authors could use when they would otherwise put something on PCH and check X, Y, and Z internally. Internally, we could DTRT and omit running those hooks when the relevant conditions haven't changed.

I'd be okay with developing 1), I think it's a good feature, given the
proliferation of features that use this hook.

As for 2), I think we already have that: add-variable-watcher.  We
already use this for a small number of features.  Does that fit the
bill?