diff options
| author | Juri Linkov | 2011-08-25 22:49:57 +0300 |
|---|---|---|
| committer | Juri Linkov | 2011-08-25 22:49:57 +0300 |
| commit | f1cf7a31ca9849486ba00f10517e7d536d90e797 (patch) | |
| tree | 5485d230e8bb111fc4f4d34a7f373fc7f6f96830 | |
| parent | e25be79236edca0e26a9fcd81b7f2a3746e8f9ef (diff) | |
| download | emacs-f1cf7a31ca9849486ba00f10517e7d536d90e797.tar.gz emacs-f1cf7a31ca9849486ba00f10517e7d536d90e797.zip | |
* 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 @@ | |||
| 1 | 2011-08-25 Juri Linkov <juri@jurta.org> | ||
| 2 | |||
| 3 | * battery.el (display-battery-mode): If `battery-status-function' | ||
| 4 | or `battery-mode-line-format' is nil, display the message and set | ||
| 5 | `display-battery-mode' to nil (bug#9363). | ||
| 6 | |||
| 1 | 2011-08-25 Eli Zaretskii <eliz@gnu.org> | 7 | 2011-08-25 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * buff-menu.el (Buffer-menu-buffer+size): Remove calls to | 9 | * 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." | |||
| 173 | (setq battery-mode-line-string "") | 173 | (setq battery-mode-line-string "") |
| 174 | (or global-mode-string (setq global-mode-string '(""))) | 174 | (or global-mode-string (setq global-mode-string '(""))) |
| 175 | (and battery-update-timer (cancel-timer battery-update-timer)) | 175 | (and battery-update-timer (cancel-timer battery-update-timer)) |
| 176 | (if (not display-battery-mode) | 176 | (if (and battery-status-function battery-mode-line-format) |
| 177 | (setq global-mode-string | 177 | (if (not display-battery-mode) |
| 178 | (delq 'battery-mode-line-string global-mode-string)) | 178 | (setq global-mode-string |
| 179 | (add-to-list 'global-mode-string 'battery-mode-line-string t) | 179 | (delq 'battery-mode-line-string global-mode-string)) |
| 180 | (setq battery-update-timer (run-at-time nil battery-update-interval | 180 | (add-to-list 'global-mode-string 'battery-mode-line-string t) |
| 181 | 'battery-update-handler)) | 181 | (setq battery-update-timer (run-at-time nil battery-update-interval |
| 182 | (battery-update))) | 182 | 'battery-update-handler)) |
| 183 | (battery-update)) | ||
| 184 | (message "Battery status not available") | ||
| 185 | (setq display-battery-mode nil))) | ||
| 183 | 186 | ||
| 184 | (defun battery-update-handler () | 187 | (defun battery-update-handler () |
| 185 | (battery-update) | 188 | (battery-update) |