diff options
| author | Richard M. Stallman | 2011-06-27 04:04:55 -0400 |
|---|---|---|
| committer | Richard M. Stallman | 2011-06-27 04:04:55 -0400 |
| commit | 43d5bf84cf4f81bc11045971f34cc2b51fa06b03 (patch) | |
| tree | 07cc08174b1bd90df34dfa0ebd26dc88ea3edd24 | |
| parent | d31fd9acf0992922c3e9d80eae7c6a74529623ab (diff) | |
| download | emacs-43d5bf84cf4f81bc11045971f34cc2b51fa06b03.tar.gz emacs-43d5bf84cf4f81bc11045971f34cc2b51fa06b03.zip | |
Implement battery-mode-line-limit option.
| -rw-r--r-- | lisp/ChangeLog | 3 | ||||
| -rw-r--r-- | lisp/battery.el | 28 |
2 files changed, 22 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3fcb5e59fc6..c7fb8fcd069 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,8 @@ | |||
| 1 | 2011-06-27 Richard Stallman <rms@gnu.org> | 1 | 2011-06-27 Richard Stallman <rms@gnu.org> |
| 2 | 2 | ||
| 3 | * battery.el (battery-mode-line-limit): New variable. | ||
| 4 | (battery-update): Handle it. | ||
| 5 | |||
| 3 | * mail/rmailmm.el (rmail-mime-process-multipart): | 6 | * mail/rmailmm.el (rmail-mime-process-multipart): |
| 4 | Handle truncated messages. | 7 | Handle truncated messages. |
| 5 | 8 | ||
diff --git a/lisp/battery.el b/lisp/battery.el index 9afe9de7b98..d7d3045fa58 100644 --- a/lisp/battery.el +++ b/lisp/battery.el | |||
| @@ -102,6 +102,11 @@ string are substituted as defined by the current value of the variable | |||
| 102 | "String to display in the mode line.") | 102 | "String to display in the mode line.") |
| 103 | ;;;###autoload (put 'battery-mode-line-string 'risky-local-variable t) | 103 | ;;;###autoload (put 'battery-mode-line-string 'risky-local-variable t) |
| 104 | 104 | ||
| 105 | (defcustom battery-mode-line-limit 100 | ||
| 106 | "Percentage of full battery load below which display battery status" | ||
| 107 | :type 'integer | ||
| 108 | :group 'battery) | ||
| 109 | |||
| 105 | (defcustom battery-mode-line-format | 110 | (defcustom battery-mode-line-format |
| 106 | (cond ((eq battery-status-function 'battery-linux-proc-acpi) | 111 | (cond ((eq battery-status-function 'battery-linux-proc-acpi) |
| 107 | "[%b%p%%,%d°C]") | 112 | "[%b%p%%,%d°C]") |
| @@ -182,16 +187,21 @@ seconds." | |||
| 182 | 187 | ||
| 183 | (defun battery-update () | 188 | (defun battery-update () |
| 184 | "Update battery status information in the mode line." | 189 | "Update battery status information in the mode line." |
| 185 | (setq battery-mode-line-string | 190 | (let ((data (and battery-status-function (funcall battery-status-function)))) |
| 186 | (propertize (if (and battery-mode-line-format | 191 | (setq battery-mode-line-string |
| 187 | battery-status-function) | 192 | (propertize (if (and battery-mode-line-format |
| 188 | (battery-format | 193 | (<= (car (read-from-string (cdr (assq ?p data)))) |
| 189 | battery-mode-line-format | 194 | battery-mode-line-limit)) |
| 190 | (funcall battery-status-function)) | 195 | (battery-format |
| 191 | "") | 196 | battery-mode-line-format |
| 192 | 'help-echo "Battery status information")) | 197 | data) |
| 198 | "") | ||
| 199 | 'face | ||
| 200 | (and (<= (car (read-from-string (cdr (assq ?p data)))) | ||
| 201 | battery-load-critical) | ||
| 202 | 'font-lock-warning-face) | ||
| 203 | 'help-echo "Battery status information"))) | ||
| 193 | (force-mode-line-update)) | 204 | (force-mode-line-update)) |
| 194 | |||
| 195 | 205 | ||
| 196 | ;;; `/proc/apm' interface for Linux. | 206 | ;;; `/proc/apm' interface for Linux. |
| 197 | 207 | ||