GNU bug report logs - #77224
[PATCH] New minor mode 'cursor-indicators-mode'

Previous Next

Package: emacs;

Reported by: Elijah Gabe Pérez <eg642616 <at> gmail.com>

Date: Sun, 23 Mar 2025 22:59:03 UTC

Severity: normal

Tags: patch

Full log


View this message in rfc822 format

From: Daniel Colascione <dancol <at> dancol.org>
To: 77224 <at> debbugs.gnu.org, eliz <at> gnu.org, mail <at> daniel-mendler.de
Cc: eg642616 <at> gmail.com, juri <at> linkov.net
Subject: bug#77224: [PATCH] New minor mode 'cursor-indicators-mode'
Date: Thu, 27 Mar 2025 16:41:39 -0400

On March 27, 2025 12:29:59 PM EDT, Eli Zaretskii <eliz <at> gnu.org> wrote:
>> From: Daniel Mendler <mail <at> daniel-mendler.de>
>> Cc: eg642616 <at> gmail.com,  77224 <at> debbugs.gnu.org,  juri <at> linkov.net
>> Date: Thu, 27 Mar 2025 17:04:09 +0100
>> 
>> Eli Zaretskii <eliz <at> gnu.org> writes:
>> 
>> > I disagree that the cursor must change "immediately", in the rigorous
>> > sense of that word.  I think if it changes after 10 or 20 or 50
>> > milliseconds, that's "immediately" for any practical purpose.
>> 
>> No, 50ms are not acceptable for the user if they except an immediate
>> response to a key press.
>
>50ms was just an example, and it is actually quite improbable to be
>that large.
>
>post-command-hook is run by the same loop that decides that Emacs is
>idle and runs timers, so the difference in practice should be very
>small if at all.
>
>> 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. 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.

For example, instead of putting something buffer and focus dependent in PCH or fiddling with buffer and window and frame hooks, you could write something like

(call-on-change (:buffer :window :focus) #'my-thing)

or something like that.

It's not that you can't do the equivalent by manually adding my-thing to the appropriate hooks directly, but the convenient one stop syntax might guide people away from PCH.

>
>Anyway, I think making the cursor change from a mode hook is a better
>solution.

+1 




>




This bug report was last modified 64 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.