summaryrefslogtreecommitdiff
path: root/lisp/battery.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@jurta.org>2011-08-25 22:49:57 +0300
committerJuri Linkov <juri@jurta.org>2011-08-25 22:49:57 +0300
commitf1cf7a31ca9849486ba00f10517e7d536d90e797 (patch)
tree5485d230e8bb111fc4f4d34a7f373fc7f6f96830 /lisp/battery.el
parente25be79236edca0e26a9fcd81b7f2a3746e8f9ef (diff)
downloademacs-f1cf7a31ca9849486ba00f10517e7d536d90e797.tar.gz
* lisp/battery.el (display-battery-mode): If `battery-status-function'
or `battery-mode-line-format' is nil, display the message and set `display-battery-mode' to nil. Fixes: debbugs:9363
Diffstat (limited to 'lisp/battery.el')
-rw-r--r--lisp/battery.el17
1 files changed, 10 insertions, 7 deletions
diff --git a/lisp/battery.el b/lisp/battery.el
index e0bba96b655..f5c01fbef58 100644
--- a/lisp/battery.el
+++ b/lisp/battery.el
@@ -173,13 +173,16 @@ seconds."
(setq battery-mode-line-string "")
(or global-mode-string (setq global-mode-string '("")))
(and battery-update-timer (cancel-timer battery-update-timer))
- (if (not display-battery-mode)
- (setq global-mode-string
- (delq 'battery-mode-line-string global-mode-string))
- (add-to-list 'global-mode-string 'battery-mode-line-string t)
- (setq battery-update-timer (run-at-time nil battery-update-interval
- 'battery-update-handler))
- (battery-update)))
+ (if (and battery-status-function battery-mode-line-format)
+ (if (not display-battery-mode)
+ (setq global-mode-string
+ (delq 'battery-mode-line-string global-mode-string))
+ (add-to-list 'global-mode-string 'battery-mode-line-string t)
+ (setq battery-update-timer (run-at-time nil battery-update-interval
+ 'battery-update-handler))
+ (battery-update))
+ (message "Battery status not available")
+ (setq display-battery-mode nil)))
(defun battery-update-handler ()
(battery-update)