GNU bug report logs -
#77224
[PATCH] New minor mode 'cursor-indicators-mode'
Previous Next
Full log
View this message in rfc822 format
Eli Zaretskii <eliz <at> gnu.org> writes:
>> From: Daniel Mendler <mail <at> daniel-mendler.de>
>> Cc: Eli Zaretskii <eliz <at> gnu.org>, 77224 <at> debbugs.gnu.org, Juri Linkov
>> <juri <at> linkov.net>
>> Date: Thu, 27 Mar 2025 06:48:15 +0100
>>
>> Elijah Gabe Pérez <eg642616 <at> gmail.com> 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.
No, there is no guarantee that the idle timer will run soon enough after
the given time if Emacs stays busy.
>> 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.
I see your point about sluggishness and I am very careful myself to not
enable modes which add expensive computations to the
`post-command-hook'. Nevertheless in this case using the
`post-command-hook' is the right thing, such that the `cursor-type' is
changed effective immediately, as had been done before in CUA, see
`cua--post-command-handler-1'. The computation in this case is not
expensive.
Daniel
This bug report was last modified 117 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.