diff options
| author | Richard M. Stallman | 2014-03-21 19:20:31 -0400 |
|---|---|---|
| committer | Richard M. Stallman | 2014-03-21 19:20:31 -0400 |
| commit | 8266cd885b38e8f03187ab0886d49d5976bd7b35 (patch) | |
| tree | 994ba738947f8f6af96267a099e4f5a175d518d7 | |
| parent | 16ec0742ffd77057d58a9cf203ead02e06a645d5 (diff) | |
| download | emacs-8266cd885b38e8f03187ab0886d49d5976bd7b35.tar.gz emacs-8266cd885b38e8f03187ab0886d49d5976bd7b35.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/battery.el | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index cdb9c3536a6..90a608a069d 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2014-03-21 Richard Stallman <rms@gnu.org> | 1 | 2014-03-21 Richard Stallman <rms@gnu.org> |
| 2 | 2 | ||
| 3 | * battery.el (battery-linux-sysfs): Search for each field | ||
| 4 | from the beginning of the buffer. | ||
| 5 | |||
| 3 | * subr.el (set-transient-map): Clear out function and value | 6 | * subr.el (set-transient-map): Clear out function and value |
| 4 | of the temporary symbol when we're done with it. | 7 | of the temporary symbol when we're done with it. |
| 5 | 8 | ||
diff --git a/lisp/battery.el b/lisp/battery.el index 28ddf368f5f..1eef80ab339 100644 --- a/lisp/battery.el +++ b/lisp/battery.el | |||
| @@ -458,12 +458,15 @@ The following %-sequences are provided: | |||
| 458 | (and (re-search-forward "POWER_SUPPLY_STATUS=\\(.*\\)$" nil t) | 458 | (and (re-search-forward "POWER_SUPPLY_STATUS=\\(.*\\)$" nil t) |
| 459 | (member charging-state '("Unknown" "Full" nil)) | 459 | (member charging-state '("Unknown" "Full" nil)) |
| 460 | (setq charging-state (match-string 1))) | 460 | (setq charging-state (match-string 1))) |
| 461 | (goto-char (point-min)) | ||
| 461 | (when (re-search-forward | 462 | (when (re-search-forward |
| 462 | "POWER_SUPPLY_\\(CURRENT\\|POWER\\)_NOW=\\([0-9]*\\)$" | 463 | "POWER_SUPPLY_\\(CURRENT\\|POWER\\)_NOW=\\([0-9]*\\)$" |
| 463 | nil t) | 464 | nil t) |
| 464 | (setq rate (float (string-to-number (match-string 2))))) | 465 | (setq rate (float (string-to-number (match-string 2))))) |
| 466 | (goto-char (point-min)) | ||
| 465 | (when (re-search-forward "POWER_SUPPLY_TEMP=\\([0-9]*\\)$" nil t) | 467 | (when (re-search-forward "POWER_SUPPLY_TEMP=\\([0-9]*\\)$" nil t) |
| 466 | (setq temperature (match-string 1))) | 468 | (setq temperature (match-string 1))) |
| 469 | (goto-char (point-min)) | ||
| 467 | (let (full-string now-string) | 470 | (let (full-string now-string) |
| 468 | ;; Sysfs may list either charge (mAh) or energy (mWh). | 471 | ;; Sysfs may list either charge (mAh) or energy (mWh). |
| 469 | ;; Keep track of both, and choose which to report later. | 472 | ;; Keep track of both, and choose which to report later. |
| @@ -477,7 +480,8 @@ The following %-sequences are provided: | |||
| 477 | (string-to-number full-string)) | 480 | (string-to-number full-string)) |
| 478 | charge-now (+ charge-now | 481 | charge-now (+ charge-now |
| 479 | (string-to-number now-string)))) | 482 | (string-to-number now-string)))) |
| 480 | ((and (re-search-forward | 483 | ((and (progn (goto-char (point-min)) t) |
| 484 | (re-search-forward | ||
| 481 | "POWER_SUPPLY_ENERGY_FULL=\\([0-9]*\\)$" nil t) | 485 | "POWER_SUPPLY_ENERGY_FULL=\\([0-9]*\\)$" nil t) |
| 482 | (setq full-string (match-string 1)) | 486 | (setq full-string (match-string 1)) |
| 483 | (re-search-forward | 487 | (re-search-forward |