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

From: Daniel Mendler <[email-masked]>
Date: Sat, 29 Mar 2025 08:52:09 +0100

Eli Zaretskii <[email-masked]> writes:

>> From: Daniel Mendler <[email-masked]>
>> Cc: [email-masked],  [email-masked],  [email-masked]
>> Date: Fri, 28 Mar 2025 17:49:44 +0100
>> 
>> Eli Zaretskii <[email-masked]> writes:
>> 
>> >> From: Daniel Mendler <[email-masked]>
>> >> Cc: [email-masked],  [email-masked],  [email-masked]
>> >> Date: Fri, 28 Mar 2025 16:40:29 +0100
>> >> 
>> >> Eli Zaretskii <[email-masked]> writes:
>> >> 
>> >> My `post-command-hook' list looks like this:
>> >> 
>> >> Buffer-local:
>> >> (jit-lock--antiblink-post-command eldoc-schedule-timer
>> >>  corfu--auto-post-command jinx--reschedule
>> >>  whitespace-post-command-hook hl-line-highlight t)
>> >
>> > And in Org buffers?
>> 
>> The first list was from the *scratch* buffer. This one is from an Org
>> buffer:
>> 
>> (eldoc-schedule-timer corfu--auto-post-command jinx--reschedule
>>  whitespace-post-command-hook hl-line-highlight t)
>
> That's already problematic, IMO.  And then some people might enable
> flyspell-mode on top of all that.

In my experience, there is no problem, neither in Org nor in Elisp
buffers. I wrote in my other mail:

>> I don't have any problems with these hooks, since they are either
>> cheap or only schedule some timers for more expensive operations. At
>> least I don't notice any sluggishness and the PCHs don't appear in
>> profiles.

Enabling Flyspell on top is not a realistic scenario since
`jinx--reschedule' comes from the Jinx spell checker, which is an
alternative to Flyspell. The spell checking takes place later when Emacs
is idle. The functions `jinx--reschedule', `eldoc-schedule-timer' and
`corfu--auto-post-command' only schedule timers.

The `hl-line-highlight' moves the line highlight overlay, such that it
moves immediately with the cursor and does not lag behind. This is a
similar scenario to changing the `cursor-type', where the cursor type
should immediately reflect the editing state. Yes, we will check the
cursor conditions too often, and often unnecessarily, but this does not
cause slowdown as long as the check is sufficiently fast in comparison
to the executed command.

The only seemingly problematic hook is `whitespace-post-command'. I
haven't checked it in detail. It looks complex but it mostly seems to
modify some overlays and trigger fontification. Potentially some of the
work there could be deferred.

Daniel