From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani
> From: Philipp Stephani <p.stephani2@gmail.com>
> Date: Sun, 11 Sep 2016 09:15:49 +0000
> Cc: 24372@debbugs.gnu.org
>
>=C2=A0 > OK, I guess one issue is that setting blink-cursor-delay do= esn't restart blink-cursor-idle-timer.
>=C2=A0 (Similarly,
>=C2=A0 > changing blink-cursor-interval doesn't restart blink-cu= rsor-timer.) While obviously we can't fix that
>=C2=A0 when using
>=C2=A0 > setq, I'd suggest adding custom setters to the variable= s nevertheless.
>
> I've attached a patch for this. It shouldn't be controversial = because it only reduces the possibility for surprises,
> but doesn't change any behavior.
Using the maximum of blink-cursor-delay and blink-cursor-interval
effectively removes the user's ability of controlling the delay before<= br class=3D"gmail_msg"> the cursor starts blinking when Emacs becomes idle, doesn't it?Yes. I tried to figure out what the intention of b= link-cursor-delay was, but couldn't find anything (the commit where it = was introduced doesn't provide any motivation). I don't think that = blink-cursor-delay < blink-cursor-interval ever makes sense. The other w= ay round (delay > interval) is useful if you want to keep the cursor vis= ible for a bit longer after a command.=C2=A0=C2=A0 If
so, I don't think this could qualify as not changing any behavior.My comment is about the= other patch, the one that fixes the customization options.=C2= =A0Plus, if the user sets the interval to a very small value, we have the
same problem again.True, but so far that hasn't happened. Also it seems less surprising: = if you increase the frequency, the cursor blinks faster, as expected.==C2=A0
How about a variant of this below?=C2=A0 It uses a fixed limitation from
below on the delay, but only for the first blink.=C2=A0 (The value 0.2 was<= br class=3D"gmail_msg"> found by experimentation, not sure if we need to add yet another
defcustom for that.)I don't think we should introduce magic numbers or further customizat= ion options. (TBH, I already doubt the usefulness of blink-cursor-delay, bu= t that's already there.)
> It does introduce the adverse side effect that now the first blink tak= es one second (the sum of
> cursor-blink-delay and cursor-blink-interval).
Right.
> I've attached another patch with the change I have in mind.
This has a disadvantage of creating a new timer object each time,
which I think we'd like to avoid: too much consing.=C2=A0 (Also, don= 9;t you
need to set the timer variable to nil when the timer is disabled?)
I'd prefer something along the lines of the first idea, the patch
below or some variant of it.=C2=A0 It is simpler.
diff --git a/lisp/frame.el b/lisp/frame.el
index cfd40bf..4540172 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -2114,7 +2114,7 @@ blink-cursor-check
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(not blink-cursor-idle-time= r))
=C2=A0 =C2=A0 =C2=A0(remove-hook 'post-command-hook 'blink-cursor-c= heck)
=C2=A0 =C2=A0 =C2=A0(setq blink-cursor-idle-timer
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (run-with-idle-timer blink-cursor-delay=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (run-with-idle-timer (max 0.2 blink-cur= sor-delay)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 blink-cursor-delay
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 'blink-cursor-start))))
@@ -2148,7 +2148,7 @@ blink-cursor-mode
=C2=A0 =C2=A0 =C2=A0(add-hook 'focus-in-hook #'blink-cursor-check)<= br class=3D"gmail_msg"> =C2=A0 =C2=A0 =C2=A0(add-hook 'focus-out-hook #'blink-cursor-suspen= d)
=C2=A0 =C2=A0 =C2=A0(setq blink-cursor-idle-timer
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (run-with-idle-timer blink-cursor-delay=
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (run-with-idle-timer (max 0.2 blink-cur= sor-delay)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 blink-cursor-delay
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 #'blink-cursor-start))))