From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Wiesner Newsgroups: gmane.emacs.bugs Subject: bug#18157: 24.4.50; battery-pmset fails to report critical battery state Date: Tue, 16 Feb 2016 19:41:25 +0100 Message-ID: References: <874md81z5z.fsf@amu.edu.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1455648188 4442 80.91.229.3 (16 Feb 2016 18:43:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 16 Feb 2016 18:43:08 +0000 (UTC) Cc: 18157@debbugs.gnu.org To: Marcin Borkowski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Feb 16 19:42:58 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aVkaM-0007w0-Lh for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Feb 2016 19:42:54 +0100 Original-Received: from localhost ([::1]:49620 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkaM-0007og-2S for geb-bug-gnu-emacs@m.gmane.org; Tue, 16 Feb 2016 13:42:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53339) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkZZ-0006gM-Ea for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:42:06 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aVkZW-0004s2-Js for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:42:05 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aVkZW-0004ry-HE for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:42:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aVkZW-0000Da-CW for bug-gnu-emacs@gnu.org; Tue, 16 Feb 2016 13:42:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Sebastian Wiesner Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 Feb 2016 18:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18157 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18157-submit@debbugs.gnu.org id=B18157.1455648094802 (code B ref 18157); Tue, 16 Feb 2016 18:42:02 +0000 Original-Received: (at 18157) by debbugs.gnu.org; 16 Feb 2016 18:41:34 +0000 Original-Received: from localhost ([127.0.0.1]:38366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aVkZ4-0000Cr-3B for submit@debbugs.gnu.org; Tue, 16 Feb 2016 13:41:34 -0500 Original-Received: from mx2.mailbox.org ([80.241.60.215]:49703) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aVkZ2-0000Cf-KP for 18157@debbugs.gnu.org; Tue, 16 Feb 2016 13:41:33 -0500 Original-Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 922A4434D0; Tue, 16 Feb 2016 19:41:26 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Original-Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id ZTC8LGB4zTG1; Tue, 16 Feb 2016 19:41:25 +0100 (CET) In-Reply-To: <874md81z5z.fsf@amu.edu.pl> X-Mailer: Apple Mail (2.3112) 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-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113147 Archived-At: > Am 16.02.2016 um 15:56 schrieb Marcin Borkowski : >=20 > On 2014-07-31, at 16:16, Sebastian Wiesner = wrote: >=20 >> `battery-pmset' fails to correctly report critical battery state: = Even >> if the battery charge level is below `battery-load-critical', it = reports >> "low" battery state only. >>=20 >> The culprit is the `cond' expression in the body of `battery-pmset' >> which compares the reported `load-percentage' against = `battery-load-low' >> first, and then against `battery-load-critical'. >>=20 >> Since the latter is typically lower, it will never be reached, = because >> `cond' already returns after the former succeeded. >>=20 >> To fix this issue, `batter-pmset' needs to check = `battery-load-critical' >> *first*, and then `battery-load-low'. >=20 > Does this patch help? I'm sorry, are you asking me? It would be bold to believe that I still = cared for this issue now, almost *two years* after I reported it. =20 At a cursory look the fix surely looks correct, but I hope you = understand that Emacs taking two years for what seems to be a trivial = issue to fix does not particularly contribute to my enthusiasm, nor does = it motivate me to test this patch. > --8<---------------cut here---------------start------------->8--- > diff -u --label /usr/local/share/emacs/25.1.50/lisp/battery.el.gz = --label \#\ /tmp/jka-com1889YvM = /tmp/buffer-content-1889yDZ > --- /usr/local/share/emacs/25.1.50/lisp/battery.el.gz > +++ # > @@ -628,12 +628,12 @@ > (cond ((looking-at "; charging") > (setq battery-status "charging" > battery-status-symbol "+")) > - ((< (string-to-number load-percentage) = battery-load-low) > - (setq battery-status "low" > - battery-status-symbol "-")) > ((< (string-to-number load-percentage) = battery-load-critical) > (setq battery-status "critical" > battery-status-symbol "!")) > + ((< (string-to-number load-percentage) = battery-load-low) > + (setq battery-status "low" > + battery-status-symbol "-")) > (t > (setq battery-status "high" > battery-status-symbol ""))) >=20 > Diff finished. Tue Feb 16 15:56:03 2016 > --8<---------------cut here---------------end--------------->8--- >=20 > Best, >=20 > -- > mb