Various battery.el improvements (bug#41808)
* lisp/battery.el: Mention BSD support in Commentary. Don't load preloaded lisp/emacs-lisp/timer.el. (battery--files): New function. (battery--find-linux-sysfs-batteries): Use it and make fewer syscalls. (battery-status-function): Perform GNU/Linux checks in increasing order of obsolescence: sysfs, ACPI, and then APM. Simplify Darwin check. Add :version tag now that battery-upower is the default. (battery-echo-area-format, battery-mode-line-format): Mention %s. (battery-load-low, battery-load-critical): New faces. (battery-update): Display battery-mode-line-format even if percentage is N/A. Apply faces battery-load-low or battery-load-critical according to the percentage, but append them so they don't override user customizations. Update all mode lines since we are in global-mode-string. (battery-linux-proc-apm-regexp): Mark as obsolete, replacing with... (battery--linux-proc-apm): ...this new rx definition. (battery-linux-proc-apm): Use it. Fix indentation. Simplify. (battery--acpi-rate, battery--acpi-capacity): New rx definitions. (battery-linux-proc-acpi): Use them. Fix pathological whitespace regexps. Simplify. (battery-linux-sysfs): Fix docstring and indentation. Reduce number of file searches. Simplify. (battery-bsd-apm): Fix docstring. Simplify. (battery-pmset): Fix docstring. Simplify ID regexp. * lisp/emacs-lisp/rx.el (rx-define): Indent as a defun. * test/lisp/battery-tests.el (battery-linux-proc-apm-regexp): Test new battery--linux-proc-apm rx definition. (battery-acpi-rate-regexp, battery-acpi-capacity-regexp): New tests.
This commit is contained in:
parent
0185d76e74
commit
23a148c950
3 changed files with 229 additions and 175 deletions
|
@ -1381,7 +1381,7 @@ To make local rx extensions, use `rx-let' for `rx',
|
|||
For more details, see Info node `(elisp) Extending Rx'.
|
||||
|
||||
\(fn NAME [(ARGS...)] RX)"
|
||||
(declare (indent 1))
|
||||
(declare (indent defun))
|
||||
`(eval-and-compile
|
||||
(put ',name 'rx-definition ',(rx--make-binding name definition))
|
||||
',name))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue