Variable: battery-status-function
battery-status-function is a customizable variable defined in
battery.el.gz.
Value
nil
Documentation
Function for getting battery status information.
The function has to return an alist of conversion definitions. Its cons cells are of the form
(CONVERSION . REPLACEMENT-TEXT)
CONVERSION is the character code of a "conversion specification"
introduced by a % character in a control string.
This variable was added, or its default value changed, in Emacs 28.1.
Probably introduced at or before Emacs version 28.1.
Source Code
;; Defined in /usr/src/emacs/lisp/battery.el.gz
(defcustom battery-status-function
(cond ((member battery-upower-service (dbus-list-activatable-names))
#'battery-upower)
((and (eq system-type 'gnu/linux)
(battery--find-linux-sysfs-batteries))
#'battery-linux-sysfs)
((and (eq system-type 'gnu/linux)
(file-directory-p "/proc/acpi/battery"))
#'battery-linux-proc-acpi)
((and (eq system-type 'gnu/linux)
(file-readable-p "/proc/apm"))
#'battery-linux-proc-apm)
((and (eq system-type 'berkeley-unix)
(file-executable-p "/usr/sbin/apm"))
#'battery-bsd-apm)
((and (eq system-type 'darwin)
(ignore-errors
(with-temp-buffer
(and (eq (call-process "pmset" nil t nil "-g" "ps") 0)
(not (bobp))))))
#'battery-pmset)
((fboundp 'w32-battery-status)
#'w32-battery-status))
"Function for getting battery status information.
The function has to return an alist of conversion definitions.
Its cons cells are of the form
(CONVERSION . REPLACEMENT-TEXT)
CONVERSION is the character code of a \"conversion specification\"
introduced by a `%' character in a control string."
:version "28.1"
:type '(choice (const nil) function))