emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Blink cursor changes, possible W32 breakage.


From: Jan Djärv
Subject: Re: Blink cursor changes, possible W32 breakage.
Date: Wed, 17 Jul 2013 18:29:46 +0200

Hello.

17 jul 2013 kl. 16:56 skrev Eli Zaretskii <address@hidden>:

>> From: Jan Djärv <address@hidden>
>> Date: Wed, 17 Jul 2013 09:38:32 +0200
>> Cc: Eli Zaretskii <address@hidden>,
>> address@hidden
>> 
>>> Eli Zaretskii <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]