emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r107854: battery.el not working when


From: Lars Magne Ingebrigtsen
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r107854: battery.el not working when multiple batteries are present
Date: Wed, 11 Apr 2012 01:24:31 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 107854
fixes bug(s): http://debbugs.gnu.org/10332
author: Dan Nicolaescu <address@hidden>
committer: Lars Magne Ingebrigtsen <address@hidden>
branch nick: trunk
timestamp: Wed 2012-04-11 01:24:31 +0200
message:
  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.
modified:
  lisp/ChangeLog
  lisp/battery.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2012-04-10 20:15:08 +0000
+++ b/lisp/ChangeLog    2012-04-10 23:24:31 +0000
@@ -1,3 +1,10 @@
+2012-04-10  Dan Nicolaescu  <address@hidden>
+
+       * 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  <address@hidden>
 
        * emacs-lisp/autoload.el (autoload-make-program): Remove, unused.

=== modified file 'lisp/battery.el'
--- a/lisp/battery.el   2012-02-11 22:13:29 +0000
+++ b/lisp/battery.el   2012-04-10 23:24:31 +0000
@@ -344,14 +344,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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]