Function: display-battery-mode
display-battery-mode is an autoloaded, interactive and byte-compiled
function defined in battery.el.gz.
Signature
(display-battery-mode &optional ARG)
Documentation
Toggle battery status display in mode line (Display Battery mode).
This is a minor mode. If called interactively, toggle the
Display-Battery mode mode. If the prefix argument is positive,
enable the mode, and if it is zero or negative, disable the mode.
If called from Lisp, toggle the mode if ARG is toggle. Enable the
mode if ARG is nil, omitted, or is a positive number. Disable the
mode if ARG is a negative number.
To check whether the minor mode is enabled in the current buffer,
evaluate (default-value \=display-battery-mode)'.
The mode's hook is called both when the mode is enabled and when it is disabled.
The text displayed in the mode line is controlled by
battery-mode-line-format and battery-status-function.
The mode line is be updated every battery-update-interval
seconds.
Probably introduced at or before Emacs version 22.1.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/battery.el.gz
;;;###autoload
(define-minor-mode display-battery-mode
"Toggle battery status display in mode line (Display Battery mode).
The text displayed in the mode line is controlled by
`battery-mode-line-format' and `battery-status-function'.
The mode line is be updated every `battery-update-interval'
seconds."
:global t
(setq battery-mode-line-string "")
(or global-mode-string (setq global-mode-string '("")))
(and battery-update-timer (cancel-timer battery-update-timer))
(battery--upower-unsubscribe)
(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)
(and (eq battery-status-function #'battery-upower)
battery-upower-subscribe
(battery--upower-subscribe))
(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)))