aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Richard2014-04-25 14:01:18 -0400
committerStefan Monnier2014-04-25 14:01:18 -0400
commit0507406b6ca75c4366dd16855123e8fc9b012c6b (patch)
treea8810668f268969f5f63ff07ee21eac084cb4343
parent844465d6cac7c243e37e446067b1a2e06be293da (diff)
downloademacs-0507406b6ca75c4366dd16855123e8fc9b012c6b.tar.gz
emacs-0507406b6ca75c4366dd16855123e8fc9b012c6b.zip
* lisp/battery.el (battery-update): Handle the case where battery
status is "N/A". Fixes: debbugs:17319
-rw-r--r--lisp/ChangeLog9
-rw-r--r--lisp/battery.el17
2 files changed, 15 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 60543c67f8c..9943884c372 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,7 +1,12 @@
12014-04-25 Nicolas Richard <theonewiththeevillook@yahoo.fr>
2
3 * battery.el (battery-update): Handle the case where battery
4 status is "N/A" (bug#17319).
5
12014-04-24 Eli Zaretskii <eliz@gnu.org> 62014-04-24 Eli Zaretskii <eliz@gnu.org>
2 7
3 * tooltip.el (tooltip-show-help-non-mode, tooltip-show-help): Use 8 * tooltip.el (tooltip-show-help-non-mode, tooltip-show-help):
4 equal-including-properties to compare help-echo strings. (Bug#17331) 9 Use equal-including-properties to compare help-echo strings (bug#17331).
5 10
62014-04-24 Leo Liu <sdl.web@gmail.com> 112014-04-24 Leo Liu <sdl.web@gmail.com>
7 12
diff --git a/lisp/battery.el b/lisp/battery.el
index 1eef80ab339..b49363489a8 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -201,19 +201,18 @@ seconds."
201 201
202(defun battery-update () 202(defun battery-update ()
203 "Update battery status information in the mode line." 203 "Update battery status information in the mode line."
204 (let ((data (and battery-status-function (funcall battery-status-function)))) 204 (let* ((data (and battery-status-function (funcall battery-status-function)))
205 (percentage (car (read-from-string (cdr (assq ?p data))))))
205 (setq battery-mode-line-string 206 (setq battery-mode-line-string
206 (propertize (if (and battery-mode-line-format 207 (propertize (if (and battery-mode-line-format
207 (<= (car (read-from-string (cdr (assq ?p data)))) 208 (numberp percentage)
208 battery-mode-line-limit)) 209 (<= percentage battery-mode-line-limit))
209 (battery-format 210 (battery-format battery-mode-line-format data)
210 battery-mode-line-format
211 data)
212 "") 211 "")
213 'face 212 'face
214 (and (<= (car (read-from-string (cdr (assq ?p data)))) 213 (and (numberp percentage)
215 battery-load-critical) 214 (<= percentage battery-load-critical)
216 'error) 215 'error)
217 'help-echo "Battery status information"))) 216 'help-echo "Battery status information")))
218 (force-mode-line-update)) 217 (force-mode-line-update))
219 218