X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/e427b55370b28f55e285ce0ee4328246eb7522ea..455700d69a1a6861dc8c9b2ba19733429727d3c3:/lisp/battery.el diff --git a/lisp/battery.el b/lisp/battery.el index b9ce5b4909..1b58489161 100644 --- a/lisp/battery.el +++ b/lisp/battery.el @@ -1,6 +1,6 @@ -;;; battery.el --- display battery status information -*- coding: utf-8 -*- +;;; battery.el --- display battery status information -;; Copyright (C) 1997-1998, 2000-2015 Free Software Foundation, Inc. +;; Copyright (C) 1997-1998, 2000-2016 Free Software Foundation, Inc. ;; Author: Ralph Schleicher ;; Keywords: hardware @@ -38,8 +38,12 @@ :prefix "battery-" :group 'hardware) -;; Either BATn or yeeloong-bat, basically. -(defconst battery--linux-sysfs-regexp "[bB][aA][tT][0-9]?$") +(defcustom battery-linux-sysfs-regexp "[bB][aA][tT][0-9]?$" + "Regexp for folder names to be searched under + /sys/class/power_supply/ that contain battery information." + :version "25.2" + :type 'regexp + :group 'battery) (defcustom battery-status-function (cond ((and (eq system-type 'gnu/linux) @@ -51,7 +55,7 @@ ((and (eq system-type 'gnu/linux) (file-directory-p "/sys/class/power_supply/") (directory-files "/sys/class/power_supply/" nil - battery--linux-sysfs-regexp)) + battery-linux-sysfs-regexp)) #'battery-linux-sysfs) ((and (eq system-type 'berkeley-unix) (file-executable-p "/usr/sbin/apm")) @@ -445,7 +449,7 @@ The following %-sequences are provided: (dolist (dir (ignore-errors (directory-files "/sys/class/power_supply/" t - battery--linux-sysfs-regexp))) + battery-linux-sysfs-regexp))) (erase-buffer) (ignore-errors (insert-file-contents (expand-file-name "uevent" dir))) @@ -628,12 +632,12 @@ The following %-sequences are provided: (cond ((looking-at "; charging") (setq battery-status "charging" battery-status-symbol "+")) - ((< (string-to-number load-percentage) battery-load-low) - (setq battery-status "low" - battery-status-symbol "-")) ((< (string-to-number load-percentage) battery-load-critical) (setq battery-status "critical" battery-status-symbol "!")) + ((< (string-to-number load-percentage) battery-load-low) + (setq battery-status "low" + battery-status-symbol "-")) (t (setq battery-status "high" battery-status-symbol "")))