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

From: Eli Zaretskii <[email-masked]>
Date: Fri, 28 Mar 2025 09:48:49 +0300

> From: Daniel Mendler <[email-masked]>
> Cc: [email-masked],  [email-masked],  [email-masked]
> Date: Thu, 27 Mar 2025 21:17:25 +0100
> 
> Here we discuss changing only the color of the cursor, a much much less
> complex operation.

My point is that when the list on post-command-hook is long, it takes
Emacs time to process all the functions on the list, and the longer
the list, the less responsive Emacs will be.  These small
insignificant delays add up.

How long is the post-command-hook list in your production sessions?
Should we poll users to give their data?  Just yesterday someone
complained on Reddit that Emacs is too slow, and I have no doubt that
features that use post-command-hook are at least part of the reason if
not _the_ reason.

So I maintain that we should try to avoid post-command-hook for
operations that should happen very rarely (this case is one such case:
we only want to run this code when something is turned on or off).
Even if the reaction to the change is a bit slower, it is worth our
while to pay that price: users will be a tad happier with Emacs
response times.  And if there are alternative methods of doing the
same, like the respective mode hooks in this case, we should use them
without thinking twice.  Ideally, post-command-hook should only be
used for stuff that really must be done after almost every command;
for any other cases we should look for other Emacs features to do the
job.

Emacs is a very old program, and if we do it right, it will live a
long time since.  We should realize the long-run effects of (ab)using
stuff like post-command-hook, and try to imagine how much more stuff
will be accrued in post-command-hook 40 years hence if we lower our
guards in this regard.

But I repeat myself.