emacs-devel
[Top][All Lists]
Advanced

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

Power: blink-cursor-mode is a pig


From: Daniel Colascione
Subject: Power: blink-cursor-mode is a pig
Date: Thu, 29 Dec 2011 15:54:50 -0800
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0

blink-cursor-mode uses an idle timer to activate a regular timer that
blinks the cursor every 500ms.  While an Emacs frame has focus, we want
this timer to run so that we can make the cursor blink.  The problem is
that although the cursor stops blinking when Emacs loses focus, the
timer keeps running because Emacs has no idea it lost focus and doesn't
know it can turn off the timer.  The unnecessary Emacs wakeups caused by
this timer waste power.

We should turn off blink-cursor's timer when Emacs loses focus.  But as
far as I see, we don't send a focus-lost event to lisp.  The manual
specifically says that this switch-frame behavior is a feature, not a bug:

"Some X window managers are set up so that just moving the mouse into
a window is enough to set the focus there.  Usually, there is no need
for a Lisp program to know about the focus change until some other kind
of input arrives.  Emacs generates a focus event only when the user
actually types a keyboard key or presses a mouse button in the new
frame; just moving the mouse between frames does not generate a focus
event."

I think the reasoning behind this behavior has gone stale: blink-cursor
is on by default; most people use click-to-focus windowing systems; and
Emacs often runs on devices with batteries.  We should send focus and
blur events eagerly so blink-cursor can turn itself off.  (Ideally, we'd
also stop blinking the cursor when Emacs is invisible, but I imagine
it's rare for a window to be both focused and invisible.)

Is there an easier way of stopping the blink-cursor timer than plumbing
new events through the Emacs core, or turning blink-cursor off?

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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