Implement battery-mode-line-limit option.
This commit is contained in:
parent
d31fd9acf0
commit
43d5bf84cf
2 changed files with 22 additions and 9 deletions
|
@ -1,5 +1,8 @@
|
||||||
2011-06-27 Richard Stallman <rms@gnu.org>
|
2011-06-27 Richard Stallman <rms@gnu.org>
|
||||||
|
|
||||||
|
* battery.el (battery-mode-line-limit): New variable.
|
||||||
|
(battery-update): Handle it.
|
||||||
|
|
||||||
* mail/rmailmm.el (rmail-mime-process-multipart):
|
* mail/rmailmm.el (rmail-mime-process-multipart):
|
||||||
Handle truncated messages.
|
Handle truncated messages.
|
||||||
|
|
||||||
|
|
|
@ -102,6 +102,11 @@ string are substituted as defined by the current value of the variable
|
||||||
"String to display in the mode line.")
|
"String to display in the mode line.")
|
||||||
;;;###autoload (put 'battery-mode-line-string 'risky-local-variable t)
|
;;;###autoload (put 'battery-mode-line-string 'risky-local-variable t)
|
||||||
|
|
||||||
|
(defcustom battery-mode-line-limit 100
|
||||||
|
"Percentage of full battery load below which display battery status"
|
||||||
|
:type 'integer
|
||||||
|
:group 'battery)
|
||||||
|
|
||||||
(defcustom battery-mode-line-format
|
(defcustom battery-mode-line-format
|
||||||
(cond ((eq battery-status-function 'battery-linux-proc-acpi)
|
(cond ((eq battery-status-function 'battery-linux-proc-acpi)
|
||||||
"[%b%p%%,%d°C]")
|
"[%b%p%%,%d°C]")
|
||||||
|
@ -182,16 +187,21 @@ seconds."
|
||||||
|
|
||||||
(defun battery-update ()
|
(defun battery-update ()
|
||||||
"Update battery status information in the mode line."
|
"Update battery status information in the mode line."
|
||||||
|
(let ((data (and battery-status-function (funcall battery-status-function))))
|
||||||
(setq battery-mode-line-string
|
(setq battery-mode-line-string
|
||||||
(propertize (if (and battery-mode-line-format
|
(propertize (if (and battery-mode-line-format
|
||||||
battery-status-function)
|
(<= (car (read-from-string (cdr (assq ?p data))))
|
||||||
|
battery-mode-line-limit))
|
||||||
(battery-format
|
(battery-format
|
||||||
battery-mode-line-format
|
battery-mode-line-format
|
||||||
(funcall battery-status-function))
|
data)
|
||||||
"")
|
"")
|
||||||
'help-echo "Battery status information"))
|
'face
|
||||||
|
(and (<= (car (read-from-string (cdr (assq ?p data))))
|
||||||
|
battery-load-critical)
|
||||||
|
'font-lock-warning-face)
|
||||||
|
'help-echo "Battery status information")))
|
||||||
(force-mode-line-update))
|
(force-mode-line-update))
|
||||||
|
|
||||||
|
|
||||||
;;; `/proc/apm' interface for Linux.
|
;;; `/proc/apm' interface for Linux.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue