From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Colascione Newsgroups: gmane.emacs.devel Subject: Power: blink-cursor-mode is a pig Date: Thu, 29 Dec 2011 15:54:50 -0800 Message-ID: <4EFCFDCA.6060802@dancol.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="------------enig886A23711D71C3351E3FC5FD" X-Trace: dough.gmane.org 1325202911 9176 80.91.229.12 (29 Dec 2011 23:55:11 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 29 Dec 2011 23:55:11 +0000 (UTC) To: Emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Dec 30 00:55:07 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RgPoR-0003yx-7j for ged-emacs-devel@m.gmane.org; Fri, 30 Dec 2011 00:55:07 +0100 Original-Received: from localhost ([::1]:40467 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgPoQ-0006Lv-E0 for ged-emacs-devel@m.gmane.org; Thu, 29 Dec 2011 18:55:06 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:44945) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgPoN-0006LO-W7 for Emacs-devel@gnu.org; Thu, 29 Dec 2011 18:55:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RgPoM-0000ru-NW for Emacs-devel@gnu.org; Thu, 29 Dec 2011 18:55:03 -0500 Original-Received: from dancol.org ([96.126.100.184]:34829) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RgPoM-0000rq-In for Emacs-devel@gnu.org; Thu, 29 Dec 2011 18:55:02 -0500 Original-Received: from c-24-18-179-193.hsd1.wa.comcast.net ([24.18.179.193] helo=edith.local) by dancol.org with esmtpsa (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1RgPoL-0008T3-FH for Emacs-devel@gnu.org; Thu, 29 Dec 2011 15:55:01 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:8.0) Gecko/20111105 Thunderbird/8.0 X-Enigmail-Version: 1.3.4 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 96.126.100.184 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:147022 Archived-At: This is an OpenPGP/MIME signed message (RFC 2440 and 3156) --------------enig886A23711D71C3351E3FC5FD Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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? --------------enig886A23711D71C3351E3FC5FD Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (Darwin) Comment: GPGTools - http://gpgtools.org iEYEARECAAYFAk78/cwACgkQ17c2LVA10Vu16wCfeqbdAD2kI62H15UCmvGp5rbf bdgAnjuSyYTy75S3Zb9pF6+NyaYyTtA5 =4tLq -----END PGP SIGNATURE----- --------------enig886A23711D71C3351E3FC5FD--