1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-12-30 11:09:23 +00:00

battery.el not working when multiple batteries are present

* battery.el (battery-linux-proc-acpi): 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.

Fixes: debbugs:10332
This commit is contained in:
Dan Nicolaescu 2012-04-11 01:24:31 +02:00 committed by Lars Magne Ingebrigtsen
parent 2a718f6fbc
commit 6a8c9eafb9
2 changed files with 11 additions and 3 deletions

View File

@ -1,3 +1,10 @@
2012-04-10 Dan Nicolaescu <dann@gnu.org>
* battery.el (battery-linux-proc-acpi): 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
(bug#10332).
2012-04-10 Stefan Monnier <monnier@iro.umontreal.ca>
* emacs-lisp/autoload.el (autoload-make-program): Remove, unused.

View File

@ -344,14 +344,15 @@ The following %-sequences are provided:
(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