]> git.eshelyaron.com Git - emacs.git/commitdiff
battery.el not working when multiple batteries are present
authorDan Nicolaescu <dann@gnu.org>
Tue, 10 Apr 2012 23:24:31 +0000 (01:24 +0200)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Tue, 10 Apr 2012 23:24:31 +0000 (01:24 +0200)
* 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
lisp/ChangeLog
lisp/battery.el

index 135f01d62683d4830100c1108d98a0a69721c08c..8cdff58369faf57b4bbb5198e007e78b5d5313bc 100644 (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.
index 586be9e8938ca9529c34b689fba220073813bfed..5cb1025253917edf03e3fedb8106d1e980f5631b 100644 (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