* bug#10332: battery.el not working when multiple batteries are present
@ 2011-12-19 22:36 Dan Nicolaescu
2012-04-10 23:25 ` Lars Magne Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Dan Nicolaescu @ 2011-12-19 22:36 UTC (permalink / raw
To: 10332
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#10332: battery.el not working when multiple batteries are present
2011-12-19 22:36 bug#10332: battery.el not working when multiple batteries are present Dan Nicolaescu
@ 2012-04-10 23:25 ` Lars Magne Ingebrigtsen
0 siblings, 0 replies; 2+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-04-10 23:25 UTC (permalink / raw
To: Dan Nicolaescu; +Cc: 10332
Dan Nicolaescu <dann@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/
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-04-10 23:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-19 22:36 bug#10332: battery.el not working when multiple batteries are present Dan Nicolaescu
2012-04-10 23:25 ` Lars Magne Ingebrigtsen
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.