GNU bug report logs - #10332
battery.el not working when multiple batteries are present

Previous Next

Package: emacs;

Reported by: Dan Nicolaescu <dann <at> gnu.org>

Date: Mon, 19 Dec 2011 22:38:02 UTC

Severity: normal

Tags: fixed, patch

Fixed in version 24.2

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10332 in the body.
You can then email your comments to 10332 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#10332; Package emacs. (Mon, 19 Dec 2011 22:38:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dan Nicolaescu <dann <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 19 Dec 2011 22:38:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dan Nicolaescu <dann <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Subject: battery.el not working when multiple batteries are present
Date: Mon, 19 Dec 2011 17:36:00 -0500
On a machine that has a normal battery and another one that can be put
in the CD/DVD slot M-x battery does not work when both batteries are
present.  

Only one battery is discharged at a time, but that seems to confuse
battery.el when computing `rate-type' for the battery not being
discharged.

Here's a proposed patch.



=== modified file 'lisp/battery.el'
--- lisp/battery.el	2011-10-19 12:54:24 +0000
+++ lisp/battery.el	2011-10-20 21:40:57 +0000
@@ -337,14 +337,15 @@
 	       (setq charging-state (match-string 1)))
 	  (when (re-search-forward "present rate: +\\([0-9]+\\) \\(m[AW]\\)$"
 				   nil t)
-	    (setq rate (+ (or rate 0) (string-to-number (match-string 1)))
-		  rate-type (or (and rate-type
+	    (setq rate (+ (or rate 0) (string-to-number (match-string 1))))
+	    (when (> rate 0)
+	      (setq rate-type (or (and rate-type
 				     (if (string= rate-type (match-string 2))
 					 rate-type
 				       (error
 					"Inconsistent rate types (%s vs. %s)"
 					rate-type (match-string 2))))
-				(match-string 2))))
+				  (match-string 2)))))
 	  (when (re-search-forward "remaining capacity: +\\([0-9]+\\) m[AW]h$"
 				   nil t)
 	    (setq capacity







Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#10332; Package emacs. (Tue, 10 Apr 2012 23:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 10332 <at> debbugs.gnu.org (full text, mbox):

From: Lars Magne Ingebrigtsen <larsi <at> gnus.org>
To: Dan Nicolaescu <dann <at> gnu.org>
Cc: 10332 <at> debbugs.gnu.org
Subject: Re: bug#10332: battery.el not working when multiple batteries are
	present
Date: Wed, 11 Apr 2012 01:25:11 +0200
Dan Nicolaescu <dann <at> gnu.org> writes:

> On a machine that has a normal battery and another one that can be put
> in the CD/DVD slot M-x battery does not work when both batteries are
> present.  
>
> Only one battery is discharged at a time, but that seems to confuse
> battery.el when computing `rate-type' for the battery not being
> discharged.

I don't use battery.el, but the patch looks sensible to me, so I've
applied it to the Emacs trunk.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/




Added tag(s) fixed. Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 10 Apr 2012 23:27:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 24.2, send any further explanations to 10332 <at> debbugs.gnu.org and Dan Nicolaescu <dann <at> gnu.org> Request was from Lars Magne Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Tue, 10 Apr 2012 23:27:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 09 May 2012 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 11 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.