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

From: Eli Zaretskii <[email-masked]>
Date: Thu, 27 Mar 2025 10:38:02 +0200

> From: Daniel Mendler <[email-masked]>
> Cc: Eli Zaretskii <[email-masked]>,  [email-masked],  Juri Linkov
>  <[email-masked]>
> Date: Thu, 27 Mar 2025 06:48:15 +0100
> 
> Elijah Gabe Pérez <[email-masked]> writes:
> 
> >> Would it be better to use an idle timer instead?  post-command-hook
> >> tends to make Emacs sluggish.
> >
> > Yeah, that is that what worried me when i decided to use that hook.
> >
> > I've fixed the patch to use only idle-timer instead.
> 
> The problem with the idle timer is that it might not run immediately.

That depends on the value of the SECS argument to run-with-idle-timer,
doesn't it.

> However when the user changes the input method, overwrite mode or
> similar, the users expects that the cursor reflects the change
> immediately after the last key press and does not lag behind. Therefore
> I think there is no alternative to the `post-command-hook'. It seems to
> me that only a bunch of mode variables are checked and then
> `cursor-type' is set. In CUA the cursor indicator is also updated in the
> `post-command-hook'. So this should not be too costly?

Sorry, I object to adding stuff to post-command-hook in these cases.
Emacs becomes very sluggish, and we should avoid that as much as we
can.