all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Jan Djärv" <jan.h.d@swipnet.se>
To: Eli Zaretskii <eliz@gnu.org>
Cc: miles@gnu.org, emacs-devel@gnu.org
Subject: Re: Blink cursor changes, possible W32 breakage.
Date: Wed, 17 Jul 2013 18:29:46 +0200	[thread overview]
Message-ID: <534E99D7-CC13-4C8D-A80B-EC00995F741A@swipnet.se> (raw)
In-Reply-To: <8338rd2q1h.fsf@gnu.org>

Hello.

17 jul 2013 kl. 16:56 skrev Eli Zaretskii <eliz@gnu.org>:

>> From: Jan Djärv <jan.h.d@swipnet.se>
>> Date: Wed, 17 Jul 2013 09:38:32 +0200
>> Cc: Eli Zaretskii <eliz@gnu.org>,
>> emacs-devel@gnu.org
>> 
>>> Eli Zaretskii <eliz@gnu.org> writes:
>>>> If you only stop the timers that blink the cursor, then this isn't
>>>> going to fix the problem.  There's any number of timers active at
>>>> any given time in any non-trivial Emacs session.  You need to stop
>>>> them all, or the battery drain will continue.
>>> 
>> 
>> We can't know what other timers do, in general.  Maybe they are supposed to run some Elisp in the background and/or when the frame has no focus.  In contrast, we know very well what blinking timers are supposed to do, so we have control over those.
> 
> But if you stop one timer, but leave the other N running, what did you
> accomplish, exactly, in terms of allowing the laptop stop using
> battery power and perhaps swap Emacs out of RAM?

In the default configuration, i.e. starting Emacs, editing files and so on, the only repeating timer there is is the blinking timer, there are no N other timers.  So for the majority of setups, this is a win.

> 
>>> Is it _timers_ that cause battery drain, or _timers firing_?  I'd
>>> imagine that with a reasonable implementation, it would be the
>>> latter...
>> 
>> You are right, it is the latter of course.
> 
> Now I'm completely confused: if blink-cursor timer doesn't drain the
> battery, why should we try hard to stop it?  Why isn't it enough to
> stop blinking when no Emacs frame has focus?

The terms used here are not clear.  When I say timer I mean when the timer fires.  The blink timer fires every 0.5 seconds, so saying "the blink timer" and "the blink timer firing" is almost the same thing.  It would be another thing for a timer that only fires every hour or so.

Emacs did not previously stop the blink timer from firing when focus was lost, hence the introduction if the FOCUS_OUT_EVENT.  Before, even if there was no visible blinking going on in any Emacs window, the timer kept firing every 0.5 seconds, running code to update the cursor state for the window.  This is the main issue, stop executing code for no reason every 0.5 seconds.

The other change, to stop blinking after 10 blinks, is a separate issue, inspired by other applications, and the comment made by Chong Yidong at http://lists.gnu.org/archive/html/emacs-devel/2011-12/msg00718.html:

> On the Gnome terminal, the cursor stops blinking after ten blinks
> (edits, X window selection, and cursor motion cause the blinking to
> resume).  I think this idea is a reasonable one for us copy, and it
> would eliminate the power wasting problem.

We can have focus out stopping the timer from firing without the "stopping after 10 blinks".
That is what happens if you set blink-cursor-blinks to 0.

	Jan D.




  reply	other threads:[~2013-07-17 16:29 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-16 11:48 Blink cursor changes, possible W32 breakage Jan Djärv
2013-07-16 15:55 ` Glenn Morris
2013-07-16 16:15   ` Jan Djärv
2013-07-16 18:29   ` covici
2013-07-16 18:49     ` Eli Zaretskii
2013-07-16 20:19       ` covici
2013-07-16 17:00 ` Juanma Barranquero
2013-07-16 17:39 ` Eli Zaretskii
2013-07-16 18:02   ` Lars Magne Ingebrigtsen
2013-07-16 18:30     ` Eli Zaretskii
2013-07-16 22:05       ` Stefan Monnier
2013-07-16 21:12   ` Jan Djärv
2013-07-16 21:23     ` Lars Magne Ingebrigtsen
2013-07-16 22:04       ` Óscar Fuentes
2013-07-17  1:58       ` Miles Bader
2013-07-17  7:42       ` Jan Djärv
2013-07-17 14:58         ` Eli Zaretskii
2013-07-17 15:02         ` Lars Magne Ingebrigtsen
2013-07-17  8:38       ` Stefan Monnier
2013-07-17  4:04     ` Eli Zaretskii
2013-07-17  4:56       ` Miles Bader
2013-07-17  7:38         ` Jan Djärv
2013-07-17 14:56           ` Eli Zaretskii
2013-07-17 16:29             ` Jan Djärv [this message]
2013-07-17 17:05               ` Eli Zaretskii
2013-07-17 18:53                 ` Jan Djärv
2013-07-17 19:23                   ` Eli Zaretskii
2013-07-17 19:38                     ` Jan Djärv
2013-07-19  2:12                     ` Miles Bader
2013-07-19  6:39                       ` Eli Zaretskii
2013-07-19  9:33                         ` Stefan Monnier
2013-07-19 10:07                           ` Eli Zaretskii
2013-07-19 10:50                             ` Óscar Fuentes
2013-07-19 11:13                               ` Eli Zaretskii
2013-07-19 12:02                                 ` Óscar Fuentes
2013-07-19 13:43                                   ` Eli Zaretskii
2013-07-19 17:52                                     ` Thien-Thi Nguyen
2013-07-20  8:18                                     ` Stefan Monnier
2013-07-20  9:25                                       ` Eli Zaretskii
2013-07-20 22:42                                         ` Stefan Monnier
2013-07-21  2:45                                           ` Eli Zaretskii
2013-07-21  7:46                                             ` Stefan Monnier
2013-07-21 15:43                                               ` Eli Zaretskii
2013-07-22  2:47                                                 ` Stefan Monnier
2013-07-19 10:54                             ` Lars Magne Ingebrigtsen
2013-07-19  9:32                       ` Stefan Monnier
2013-07-19 10:08                         ` Eli Zaretskii
2013-07-20  8:16                           ` Stefan Monnier
2013-07-20  9:26                             ` Eli Zaretskii
2013-07-20 22:40                               ` Stefan Monnier
2013-07-21  2:44                                 ` Eli Zaretskii
2013-07-21  7:45                                   ` Stefan Monnier
2013-07-21 15:42                                     ` Eli Zaretskii
2013-07-22  2:46                                       ` Stefan Monnier
2013-07-21  9:20                                 ` martin rudalics
2013-07-22  2:55                                   ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=534E99D7-CC13-4C8D-A80B-EC00995F741A@swipnet.se \
    --to=jan.h.d@swipnet.se \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=miles@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.