From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Philipp Stephani Newsgroups: gmane.emacs.bugs Subject: bug#24372: 25.1.50; After losing focus, cursor is hidden when moving point Date: Sun, 11 Sep 2016 17:37:36 +0000 Message-ID: References: <83a8flaud3.fsf@gnu.org> <831t0t83br.fsf@gnu.org> <83mvjg8bk2.fsf@gnu.org> <8360q2be2b.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1146a1527dc46a053c3ed6fd X-Trace: blaine.gmane.org 1473615501 24529 195.159.176.226 (11 Sep 2016 17:38:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 11 Sep 2016 17:38:21 +0000 (UTC) Cc: 24372@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Sep 11 19:38:16 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj8hr-0005jq-CK for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 Sep 2016 19:38:15 +0200 Original-Received: from localhost ([::1]:38527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bj8hp-0000dT-Dl for geb-bug-gnu-emacs@m.gmane.org; Sun, 11 Sep 2016 13:38:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38414) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bj8hi-0000dI-8I for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2016 13:38:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bj8he-0006iH-KY for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2016 13:38:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bj8he-0006iD-GD for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2016 13:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bj8he-0005zE-AZ for bug-gnu-emacs@gnu.org; Sun, 11 Sep 2016 13:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philipp Stephani Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 11 Sep 2016 17:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24372 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 24372-submit@debbugs.gnu.org id=B24372.147361547522999 (code B ref 24372); Sun, 11 Sep 2016 17:38:02 +0000 Original-Received: (at 24372) by debbugs.gnu.org; 11 Sep 2016 17:37:55 +0000 Original-Received: from localhost ([127.0.0.1]:56705 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj8hX-0005ys-8C for submit@debbugs.gnu.org; Sun, 11 Sep 2016 13:37:55 -0400 Original-Received: from mail-wm0-f50.google.com ([74.125.82.50]:37989) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bj8hV-0005yf-FB for 24372@debbugs.gnu.org; Sun, 11 Sep 2016 13:37:54 -0400 Original-Received: by mail-wm0-f50.google.com with SMTP id 1so109608331wmz.1 for <24372@debbugs.gnu.org>; Sun, 11 Sep 2016 10:37:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=VR8OCZD6US0MiXV6Q2R+4F2fXTAJI912+ZxFAbvAdSI=; b=itlkWO2rq1z2jp/4QdTGJf0t49d69OiK9YV0llKSQuwGMBEb2boCkCC/1l57aqe8J1 KOlP22pVwUrlthXyuPHLN/lUCV10QMEK1uokpgPm+4HRO3bU1PGB18NQRxGEqE8K+38L PLQwcFUc9JzMAMTbdackshoG1HKWI1YPJLslUvHGYYh1lDnLhp1IZsxVxAvRXxcZ9+tL x/tzQc3kvsDBmQf/StiBZ4RusP+W0LbJyIWabaKJ0+4ZzJgLG5V4hmRwHX/t9Uf/hrKT Fk80QALEAFO2dQokE0xY3R19WbHWHhkRPD2NV73aX4F+yYJoaFtWOdgRbnX7BaKOxo+J /ZEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=VR8OCZD6US0MiXV6Q2R+4F2fXTAJI912+ZxFAbvAdSI=; b=fz1y4E47rhzAnbDHTnUiB1/uh/GZ51FOCvTE0a4CmEIIrCwiJlEt0HQkemJTkI+IsN gg5TXLLZwvPoBv+TQrgXJPTYAkJBLy9t8pvUvB859ySjGEHUvm6wU2ATO6+Y16rxKuur IwF0xBruHitGzQLR74FYD4wCy75tSwQVot3ccjeGizoiSluvXarbC8R7wtazHDAwBX2x niQbC+VraZVrZq1Iz8orsDYulM1MChCP8846MA2897X1ZXG9iH4H4zW90egho7khlufr xtd9X+AsINw/JWL9+Rn5ETeFTTDBxSiR2u3bpFxywZ+mpWepMedslC0TX7XszaoO+6Jj 1WJA== X-Gm-Message-State: AE9vXwMinW1sgae7wpm2h0pwiRMKd2jXd130Of0dYR53mdCbLqwJcT76nA8V53eURCOlMfM7tsW+tfKvJn/PLw== X-Received: by 10.28.232.71 with SMTP id f68mr7347537wmh.55.1473615467756; Sun, 11 Sep 2016 10:37:47 -0700 (PDT) In-Reply-To: <8360q2be2b.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:123187 Archived-At: --001a1146a1527dc46a053c3ed6fd Content-Type: text/plain; charset=UTF-8 Eli Zaretskii schrieb am So., 11. Sep. 2016 um 18:23 Uhr: > > From: Philipp Stephani > > Date: Sun, 11 Sep 2016 09:15:49 +0000 > > Cc: 24372@debbugs.gnu.org > > > > > OK, I guess one issue is that setting blink-cursor-delay doesn't > restart blink-cursor-idle-timer. > > (Similarly, > > > changing blink-cursor-interval doesn't restart blink-cursor-timer.) > While obviously we can't fix that > > when using > > > setq, I'd suggest adding custom setters to the variables 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 > the cursor starts blinking when Emacs becomes idle, doesn't it? Yes. I tried to figure out what the intention of blink-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 way round (delay > interval) is useful if you want to keep the cursor visible for a bit longer after a command. > 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. > Plus, 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. > > How about a variant of this below? It uses a fixed limitation from > below on the delay, but only for the first blink. (The value 0.2 was > 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 customization options. (TBH, I already doubt the usefulness of blink-cursor-delay, but that's already there.) > > > It does introduce the adverse side effect that now the first blink takes > 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. (Also, don't you > need to set the timer variable to nil when the timer is disabled?) > I don't understand - the patch doesn't create any additional timers, it only changes the initial delay of the idle-timer. > > I'd prefer something along the lines of the first idea, the patch > below or some variant of it. 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 > (not blink-cursor-idle-timer)) > (remove-hook 'post-command-hook 'blink-cursor-check) > (setq blink-cursor-idle-timer > - (run-with-idle-timer blink-cursor-delay > + (run-with-idle-timer (max 0.2 blink-cursor-delay) > blink-cursor-delay > 'blink-cursor-start)))) > > @@ -2148,7 +2148,7 @@ blink-cursor-mode > (add-hook 'focus-in-hook #'blink-cursor-check) > (add-hook 'focus-out-hook #'blink-cursor-suspend) > (setq blink-cursor-idle-timer > - (run-with-idle-timer blink-cursor-delay > + (run-with-idle-timer (max 0.2 blink-cursor-delay) > blink-cursor-delay > #'blink-cursor-start)))) > > My patch is identical, except is uses blink-cursor-interval as lower bound. --001a1146a1527dc46a053c3ed6fd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


Eli Za= retskii <eliz@gnu.org> schrieb am= So., 11. Sep. 2016 um 18:23=C2=A0Uhr:
> 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= =A0
Plus, 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.)
=C2=A0

> 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 don't understand - th= e patch doesn't create any additional timers, it only changes the initi= al delay of the idle-timer.
=C2=A0

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))))


My patch is identi= cal, except is uses blink-cursor-interval as lower bound.=C2=A0
= --001a1146a1527dc46a053c3ed6fd--