emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r116837: Fix bugs that screwed M-x battery on Yeeloo


From: Richard M. Stallman
Subject: [Emacs-diffs] trunk r116837: Fix bugs that screwed M-x battery on Yeeloong
Date: Fri, 21 Mar 2014 23:24:28 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 116837
revision-id: address@hidden
parent: address@hidden
author: Richard Stallman
committer: Richard Stallman <address@hidden>
branch nick: trunk
timestamp: Fri 2014-03-21 19:20:31 -0400
message:
  Fix bugs that screwed M-x battery on Yeeloong
  
  * lisp/battery.el (battery-linux-sysfs): Search for each field
  from the beginning of the buffer.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/battery.el                battery.el-20091113204419-o5vbwnq5f7feedwu-1189
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-03-21 23:16:26 +0000
+++ b/lisp/ChangeLog    2014-03-21 23:20:31 +0000
@@ -1,5 +1,8 @@
 2014-03-21  Richard Stallman  <address@hidden>
 
+       * battery.el (battery-linux-sysfs): Search for each field
+       from the beginning of the buffer.
+
        * subr.el (set-transient-map): Clear out function and value
        of the temporary symbol when we're done with it.
 

=== modified file 'lisp/battery.el'
--- a/lisp/battery.el   2014-01-01 07:43:34 +0000
+++ b/lisp/battery.el   2014-03-21 23:20:31 +0000
@@ -458,12 +458,15 @@
          (and (re-search-forward "POWER_SUPPLY_STATUS=\\(.*\\)$" nil t)
               (member charging-state '("Unknown" "Full" nil))
               (setq charging-state (match-string 1)))
+         (goto-char (point-min))
          (when (re-search-forward
                  "POWER_SUPPLY_\\(CURRENT\\|POWER\\)_NOW=\\([0-9]*\\)$"
                  nil t)
            (setq rate (float (string-to-number (match-string 2)))))
+         (goto-char (point-min))
          (when (re-search-forward "POWER_SUPPLY_TEMP=\\([0-9]*\\)$" nil t)
            (setq temperature (match-string 1)))
+         (goto-char (point-min))
          (let (full-string now-string)
            ;; Sysfs may list either charge (mAh) or energy (mWh).
            ;; Keep track of both, and choose which to report later.
@@ -477,7 +480,8 @@
                                        (string-to-number full-string))
                         charge-now  (+ charge-now
                                        (string-to-number now-string))))
-                 ((and (re-search-forward
+                 ((and (progn (goto-char (point-min)) t)
+                       (re-search-forward
                         "POWER_SUPPLY_ENERGY_FULL=\\([0-9]*\\)$" nil t)
                        (setq full-string (match-string 1))
                        (re-search-forward


reply via email to

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