Variable: display-battery-mode
display-battery-mode is a customizable variable defined in
battery.el.gz.
Value
nil
Documentation
Non-nil if Display-Battery mode is enabled.
See the display-battery-mode(var)/display-battery-mode(fun) command
for a description of this minor mode.
Setting this variable directly does not take effect;
either customize it (see the info node (emacs)Easy Customization)
or call the function display-battery-mode(var)/display-battery-mode(fun).
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.
The function which updates the mode-line display will call the
functions in `battery-update-functions', which can be used to
trigger actions based on battery-related events."
: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)))