Subject: Re: bug#19895: 24.4; battery.el does not support /sys/class/power_supply/BATX

From: Marcin Borkowski <[email-masked]>
Date: Mon, 21 Mar 2016 06:44:46 +0100

On 2015-02-18, at 09:53, Greg Farough <[email-masked]> wrote:

> It seems that battery-linux-sysfs does not support certain laptop
> batteries which are not classified as BAT0, but by BATX instead. I had
> to add this to my .emacs to get display-battery-mode working properly:
>
> (eval-after-load 'battery
>   '(progn
>      (setq battery--linux-sysfs-regexp "[bB][aA][tT][xX]$")
>      (setq battery-status-function 'battery-linux-sysfs
>       battery-echo-area-format "Power %L, battery %B (%p%% charged, remaining time %t)"
>       battery-mode-line-format " [%p%%] ")))
> (display-battery-mode 1)
>
> Hope this helps, and thanks for all your hard work.
> -g

Hi,

thanks for your report.  IMHO, this suggests a simple patch, replacing

(defconst battery--linux-sysfs-regexp "[bB][aA][tT][0-9]?$")

with e.g.

(defconst battery--linux-sysfs-regexp "[bB][aA][tT][0-9X]?$")

in battery.el.  Could someone more knowledgeable about what sits in
/sys/class/power_supply/ confirm that this shouldn't break anything?
(On my laptop, the right directory is called BAT0, btw.)

Best,

-- 
Marcin