diff options
author | Juri Linkov <juri@jurta.org> | 2011-08-25 22:49:57 +0300 |
---|---|---|
committer | Juri Linkov <juri@jurta.org> | 2011-08-25 22:49:57 +0300 |
commit | f1cf7a31ca9849486ba00f10517e7d536d90e797 (patch) | |
tree | 5485d230e8bb111fc4f4d34a7f373fc7f6f96830 | |
parent | e25be79236edca0e26a9fcd81b7f2a3746e8f9ef (diff) | |
download | emacs-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
-rw-r--r-- | lisp/ChangeLog | 6 | ||||
-rw-r--r-- | lisp/battery.el | 17 |
2 files changed, 16 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 064e745d1f5..6ce18817f4f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-08-25 Juri Linkov <juri@jurta.org> + + * 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 (bug#9363). + 2011-08-25 Eli Zaretskii <eliz@gnu.org> * buff-menu.el (Buffer-menu-buffer+size): Remove calls to 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) |