73 |
|
|
74 |
(defvar battery-mode-line-string nil |
(defvar battery-mode-line-string nil |
75 |
"String to display in the mode line.") |
"String to display in the mode line.") |
76 |
|
;;;###autoload (put 'battery-mode-line-string 'risky-local-variable t) |
77 |
|
|
78 |
(defcustom battery-mode-line-format |
(defcustom battery-mode-line-format |
79 |
(cond ((eq battery-status-function 'battery-linux-proc-apm) |
(cond ((eq battery-status-function 'battery-linux-proc-apm) |
80 |
" [%b%p%%]") |
"[%b%p%%]") |
81 |
((eq battery-status-function 'battery-linux-proc-acpi) |
((eq battery-status-function 'battery-linux-proc-acpi) |
82 |
" [%b%p%%,%d°C]")) |
"[%b%p%%,%d°C]")) |
83 |
"*Control string formatting the string to display in the mode line. |
"*Control string formatting the string to display in the mode line. |
84 |
Ordinary characters in the control string are printed as-is, while |
Ordinary characters in the control string are printed as-is, while |
85 |
conversion specifications introduced by a `%' character in the control |
conversion specifications introduced by a `%' character in the control |
129 |
|
|
130 |
(defun battery-update () |
(defun battery-update () |
131 |
"Update battery status information in the mode line." |
"Update battery status information in the mode line." |
132 |
(setq battery-mode-line-string (propertize (if (and battery-mode-line-format |
(setq battery-mode-line-string |
133 |
battery-status-function) |
(propertize (if (and battery-mode-line-format |
134 |
(battery-format |
battery-status-function) |
135 |
battery-mode-line-format |
(battery-format |
136 |
(funcall battery-status-function)) |
battery-mode-line-format |
137 |
"") |
(funcall battery-status-function)) |
138 |
'help-echo "Battery status information")) |
"") |
139 |
|
'help-echo "Battery status information")) |
140 |
(force-mode-line-update)) |
(force-mode-line-update)) |
141 |
|
|
142 |
|
|