HCoop
/
bpt
/
emacs.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* lisp/battery.el (battery-update): Handle the case where battery
[bpt/emacs.git]
/
lisp
/
battery.el
diff --git
a/lisp/battery.el
b/lisp/battery.el
index
1eef80a
..
b493634
100644
(file)
--- a/
lisp/battery.el
+++ b/
lisp/battery.el
@@
-201,19
+201,18
@@
seconds."
(defun battery-update ()
"Update battery status information in the mode line."
(defun battery-update ()
"Update battery status information in the mode line."
- (let ((data (and battery-status-function (funcall battery-status-function))))
+ (let* ((data (and battery-status-function (funcall battery-status-function)))
+ (percentage (car (read-from-string (cdr (assq ?p data))))))
(setq battery-mode-line-string
(propertize (if (and battery-mode-line-format
(setq battery-mode-line-string
(propertize (if (and battery-mode-line-format
- (<= (car (read-from-string (cdr (assq ?p data))))
- battery-mode-line-limit))
- (battery-format
- battery-mode-line-format
- data)
+ (numberp percentage)
+ (<= percentage battery-mode-line-limit))
+ (battery-format battery-mode-line-format data)
"")
'face
"")
'face
-
(and (<= (car (read-from-string (cdr (assq ?p data)))
)
-
battery-load-critical)
- 'error)
+
(and (numberp percentage
)
+
(<= percentage
battery-load-critical)
+
'error)
'help-echo "Battery status information")))
(force-mode-line-update))
\f
'help-echo "Battery status information")))
(force-mode-line-update))
\f